[debian-mysql] Bug#507049: mysql-server-5.0: /usr/share/mysql/debian-start.inc.sh fails with 'Unknown column' when sql-mode="ansi-quotes"

Xavier Drudis Ferran xdrudis at ambarinformatica.com
Thu Nov 27 13:10:05 UTC 2008


Package: mysql-server-5.0
Version: 5.0.51a-17
Severity: normal
Tags: patch


Hi. 

I changed my mysql server config by putting a file in 
/etc/mysql/conf.d/baso.cnf like this 


[mysqld]
sql-mode="ORACLE"
lower_case_table_names=1

And then on /etc/init.d/mysql restart, the check for corrupt tables complained like this. 

ERROR 1054 (42S22) at line 2: Unknown column 'select count(*) into @discard from `' in 'field list'

I believe it is because sql-mode="ORACLE" includes sql-mode ansi-quotes.
Under ansi-quotes "" is used for literal strings, no schema identifiers,
while with ansi-quotes off "" is for field names, table names, etc. 

I fixed it for me with the attached patch (using ' instead of ") ,
 but I'm not sure this works for any server options. 

I haven't produced corrupt tables to check if the script still 
detects them. 

Thanks for your work on this package. 

Patch: 

--- /usr/share/mysql/debian-start.inc.sh.orig   2008-11-27 14:02:07.000000000 +0100
+++ /usr/share/mysql/debian-start.inc.sh        2008-11-27 14:03:05.000000000 +0100
@@ -18,12 +18,13 @@
   tempfile=`tempfile`
   # We have to use xargs in this case, because a for loop barfs on the
   # spaces in the thing to be looped over.
-  LC_ALL=C $MYSQL --skip-column-names --batch -e  '
-      select concat("select count(*) into @discard from `",
-                    TABLE_SCHEMA, "`.`", TABLE_NAME, "`")
-      from information_schema.TABLES where ENGINE="MyISAM"' | \
+
+LC_ALL=C $MYSQL --skip-column-names --batch -e  '
+      select concat('"'"'select count(*) into @discard from `'"'"',
+                    TABLE_SCHEMA, '"'"'`.`'"'"', TABLE_NAME, '"'"'`'"'"')
+      from information_schema.TABLES where ENGINE='"'"'MyISAM'"'" | \
     xargs -i $MYSQL --skip-column-names --silent --batch \
-                    --force -e "{}" >$tempfile
+                    --force -e "{}" >$tempfile
   if [ -s $tempfile ]; then
     (
       /bin/echo -e "\n" \

-- System Information:
Debian Release: lenny/sid
  APT prefers testing
  APT policy: (500, 'testing')
Architecture: amd64 (x86_64)

Kernel: Linux 2.6.26-1-amd64 (SMP w/2 CPU cores)
Locale: LANG=ca_ES.UTF-8, LC_CTYPE=ca_ES.UTF-8 (charmap=UTF-8)
Shell: /bin/sh linked to /bin/bash

Versions of packages mysql-server-5.0 depends on:
ii  adduser                3.110             add and remove users and groups
ii  debconf [debconf-2.0]  1.5.24            Debian configuration management sy
ii  libc6                  2.7-16            GNU C Library: Shared libraries
ii  libdbi-perl            1.605-1           Perl5 database interface by Tim Bu
ii  libgcc1                1:4.3.2-1         GCC support library
ii  libmysqlclient15off    5.0.51a-17        MySQL database client library
ii  libncurses5            5.6+20080830-1    shared libraries for terminal hand
ii  libreadline5           5.2-3             GNU readline and history libraries
ii  libstdc++6             4.3.2-1           The GNU Standard C++ Library v3
ii  libwrap0               7.6.q-16          Wietse Venema's TCP wrappers libra
ii  lsb-base               3.2-20            Linux Standard Base 3.2 init scrip
ii  mysql-client-5.0       5.0.51a-17        MySQL database client binaries
ii  mysql-common           5.0.51a-17        MySQL database common files
ii  passwd                 1:4.1.1-5         change and administer password and
ii  perl                   5.10.0-17         Larry Wall's Practical Extraction 
ii  psmisc                 22.6-1            Utilities that use the proc filesy
ii  zlib1g                 1:1.2.3.3.dfsg-12 compression library - runtime

Versions of packages mysql-server-5.0 recommends:
ii  bsd-mailx [mailx]  8.1.2-0.20071201cvs-3 A simple mail user agent
ii  libhtml-template-p 2.9-1                 HTML::Template : A module for usin
ii  mailx              1:20071201-3          Transitional package for mailx ren

Versions of packages mysql-server-5.0 suggests:
pn  tinyca                        <none>     (no description available)

-- debconf information:
  mysql-server-5.0/really_downgrade: false
  mysql-server-5.0/start_on_boot: true
  mysql-server-5.0/nis_warning:
  mysql-server-5.0/postrm_remove_databases: false
  mysql-server-5.0/need_sarge_compat: false
  mysql-server/error_setting_password:
  mysql-server-5.0/need_sarge_compat_done: true
  mysql-server/password_mismatch:





More information about the pkg-mysql-maint mailing list