[debian-mysql] Bug#708176: mysql-server-5.5 postinst SQL error 1064 syntax error

Bob Proulx bob at proulx.com
Mon May 13 19:47:37 UTC 2013


Bob Proulx wrote:
> Therefore the problem seems to stem from trying to do this fixup when
> the fixup has already been done.  Unfortunately it produces the scary
> syntax error message that needs to be tracked down and understood.

Looking at this closer the fix_privs section I think it could be
simplified somewhat.  Instead of doing the entire fixup
non-interactively all at once if each column addition were run
individually then this error could be detected and ignored.

I thought about querying first to see if those columns exist.  But the
server may not have the client installed and so querying first seems
problematic.  Just going ahead and trying it and ignoring if it is a
duplicate seems best.

Instead of the current fix_privs variable section the following could
be used to run each column addition individually and then ignore the
error if the column already exists.  This still isn't perfect.  But it
is an improvement over the current situation that is completely dead
reckoning and doesn't handle the situation well and produce syntax
errors in the log.

    new_mysql_columns="
        Create_view_priv
        Show_view_priv
        Create_routine_priv
        Alter_routine_priv
        Create_user_priv
        Event_priv
        Trigger_priv
        Create_tablespace_priv
        "
    for col in $new_mysql_columns; do
      printf "USE mysql;\n ALTER TABLE user ADD column $col enum('N','Y') CHARACTER SET utf8 NOT NULL DEFAULT 'N';\n" | $MYSQL_BOOTSTRAP 2>&1 | sed "/^ERROR:.*Duplicate column name '$col'/d;/Aborting/d" | $ERR_LOGGER
    done

I will attach the idea as an attachment against this version of the
postinst script.  I still wish there were a better way.  Perhaps
someone else will think of something better.  But I think this is
still an improvement over the current syntax error production.

Thank you for maintaining mysql.

Bob
-------------- next part --------------
A non-text attachment was scrubbed...
Name: mysql-server-5.5.postinst.diff
Type: text/x-diff
Size: 2566 bytes
Desc: not available
URL: <http://lists.alioth.debian.org/pipermail/pkg-mysql-maint/attachments/20130513/2b09c07a/attachment.diff>


More information about the pkg-mysql-maint mailing list