At 11:37 AM -0200 1/30/08, Davi Arnaut wrote:
>Alexander Nozdrin wrote:
>> Hi Davi,
>>
>> this is just a summary of my thoughts about the bug and the patch.
>>
>> The bug has the following parts:
>>
>> 1. sql_mode enum was extended, but mysql.proc, mysql.event
>> were not updated. Strictly speaking, in order to fix the bug,
>> you only have to fix mysql_system_tables.sql script.
>
>The patch updates the tables by changing the table definition in the
>mysql_system_tables.sql script.
>
>> 2. There is no test case checking that when a new sql_mode value
>> is added, it's added/registered in all needed places.
>
>How to test that? I've can't come up with a test that will fail when a
>new sql_mode is added.
Perhaps have a reference value consisting of all the currently known
sql_mode values. Then set sql_mode to a value with all bits on (you
can set sql_mode to a numeric value; this is a "trick"), and compare
the result to the reference value. If they differ, a new sql_mode value
has been added.
% mysql -E
mysql> set sql_mode = pow(2,32)-1;
Query OK, 0 rows affected (0.00 sec)
mysql> select @@sql_mode;
*************************** 1. row ***************************
@@sql_mode:
REAL_AS_FLOAT,PIPES_AS_CONCAT,ANSI_QUOTES,IGNORE_SPACE,?,ONLY_FULL_GROUP_BY,NO_UNSIGNED_SUBTRACTION,NO_DIR_IN_CREATE,POSTGRESQL,ORACLE,MSSQL,DB2,MAXDB,NO_KEY_OPTIONS,NO_TABLE_OPTIONS,NO_FIELD_OPTIONS,MYSQL323,MYSQL40,ANSI,NO_AUTO_VALUE_ON_ZERO,NO_BACKSLASH_ESCAPES,STRICT_TRANS_TABLES,STRICT_ALL_TABLES,NO_ZERO_IN_DATE,NO_ZERO_DATE,ALLOW_INVALID_DATES,ERROR_FOR_DIVISION_BY_ZERO,TRADITIONAL,NO_AUTO_CREATE_USER,HIGH_NOT_PRECEDENCE,NO_ENGINE_SUBSTITUTION,PAD_CHAR_TO_FULL_LENGTH
1 row in set (0.00 sec)
I used -E because with NO_BACKSLASH_ESCAPES enabled, the \G terminator
doesn't work. Perhaps that should be considered a bug. But anyway,
this shows how to get a value with all the currently available modes
enabled. That could be compared against a reference value consisting
of all the currently known values as of the time the test is written.
The "?" in the middle of the string might be a problem that
needs to be handled specially.
--
Paul DuBois, MySQL Documentation Team
Madison, Wisconsin, USA
MySQL AB, www.mysql.com