Bug #29245 Bad Merge Caused Error Codes Conflict between 5.0/5.1
Submitted: 20 Jun 2007 16:40 Modified: 10 Jul 2007 14:02
Reporter: Mark Matthews Email Updates:
Status: Closed Impact on me:
None 
Category:MySQL Server Severity:S2 (Serious)
Version:5.1 OS:Any
Assigned to: Timothy Smith

[20 Jun 2007 16:40] Mark Matthews
Description:
We got a note from the folks at the Spring Framework project that certain error codes listed in the manual for 5.1 have different definitions than 5.0. I wrote a quick script to check:

1287 was ER_WARN_DEPRECATED_SYNTAX in 5.0, is ER_UNUSED_1 in 5.1
1458 was ER_SP_WRONG_NAME in 5.0, is ER_FOREIGN_SERVER_EXISTS in 5.1
1459 was ER_TABLE_NEEDS_UPGRADE in 5.0, is ER_SP_WRONG_NAME in 5.1
1460 was ER_SP_NO_AGGREGATE in 5.0, is ER_TABLE_NEEDS_UPGRADE in 5.1
1461 was ER_MAX_PREPARED_STMT_COUNT_REACHED in 5.0, is ER_SP_NO_AGGREGATE in 5.1
1462 was ER_VIEW_RECURSIVE in 5.0, is ER_MAX_PREPARED_STMT_COUNT_REACHED in 5.1
1463 was ER_NON_GROUPING_FIELD_USED in 5.0, is ER_VIEW_RECURSIVE in 5.1
1464 was ER_TABLE_CANT_HANDLE_SPKEYS in 5.0, is ER_NON_GROUPING_FIELD_USED in 5.1
1465 was ER_NO_TRIGGERS_ON_SYSTEM_SCHEMA in 5.0, is ER_TABLE_CANT_HANDLE_SPKEYS in 5.1
1466 was ER_REMOVED_SPACES in 5.0, is ER_ILLEGAL_HA_CREATE_OPTION in 5.1
1467 was ER_AUTOINC_READ_FAILED in 5.0, is ER_PARTITION_REQUIRES_VALUES_ERROR in 5.1
1468 was ER_USERNAME in 5.0, is ER_PARTITION_WRONG_VALUES_ERROR in 5.1
1469 was ER_HOSTNAME in 5.0, is ER_PARTITION_MAXVALUE_ERROR in 5.1
1470 was ER_WRONG_STRING_LENGTH in 5.0, is ER_PARTITION_SUBPARTITION_ERROR in 5.1
1471 was ER_ERROR_LAST in 5.0, is ER_PARTITION_SUBPART_MIX_ERROR in 5.1
 
I'm assuming this was due to a bad merge.

We should check why this wasn't flagged by abi_check (if it wasn't), or add a script to our testsuite to check between major versions.

How to repeat:
inspection of mysqld_error.h
[25 Jun 2007 22:22] Timothy Smith
Actually, not a bad merge; but ChangeSet @1.2303.180.1
[25 Jun 2007 22:27] Timothy Smith
Actually, not a bad merge; but ChangeSet @1.2303.180.1 on 1 Dec 2006, part of the work for WL 3031.

Planned fix:

- Move all error messages in 5.1 which exist in 5.0 down to match the 5.0 positions

- Set ER_WARN_DEPRECATED_SYNTAX back to 5.0 value, change new error id to ER_WARN_DEPRECATED_SYNTAX_WITH_VER, and use this in mysql_priv.h:

  push_warning_printf(((THD *)Thd), MYSQL_ERROR::WARN_LEVEL_WARN,
    ER_WARN_DEPRECATED_SYNTAX, ER(ER_WARN_DEPRECATED_SYNTAX_WITH_VER),
    (Old), (Ver), (New));
[26 Jun 2007 1:32] Timothy Smith
Yes, a few more result file changes needed (ndb_dd_basic, ndb_dd_ddl, ndb_single_user, rpl_extraCol*, rpl_row_tabledefs*).

Still awaiting completion of test-pr, will check back later.
[26 Jun 2007 5:27] Alexander Barkov
The patch is ok to push.
[26 Jun 2007 5:32] Ramil Kalimullin
The patch looks correct. Ok to push.
Unfortunately, I cannot guarantee all the differences have been eliminated.
The next step is to add a tool that checks the error numbers conformity.
[26 Jun 2007 19:14] Timothy Smith
A new bug created to track the addition of a tool to enforce cross-version compatibility of error numbers:  bug #29370
[27 Jun 2007 17:12] Trudy Pelzer
Docs team: A patch to fix this bug has been pushed
directly to the 5.1.20 clone. Please update the 
changelog accordingly. Thanks.
[27 Jun 2007 17:31] Paul Dubois
Noted in 5.1.20 changelog.

Some error codes had error numbers in MySQL 5.1 different from
the numbers in MySQL 5.0.
[27 Jun 2007 18:07] Timothy Smith
Paul,

Would you please consider adding a warning for existing 5.1 users, notifying them that some error codes (in particular, any code with value > 1468) have different values now?  If they hard-code the error code values in their application, they'll need to update their code.  Regardless, if they test for such values, they should recompile their clients before using them against a 5.1.20 server.

This is good practice anyways on a non-stable (pre-GA) version, as we don't require new error code values to remain constant during the development phase.

Please set this bug back to 'Patch approved', so I can ensure that its status is tracked properly.

Thanks,

Timothy
[28 Jun 2007 4:58] Timothy Smith
Oops, should have said ">= 1458" in previous comment.
[3 Jul 2007 18:24] Paul Dubois
New changelog entry, per Tim's request:

Incompatible change: Some error codes had error numbers in MySQL 5.1
different from the numbers in MySQL 5.0. Any error codes with value 
of 1458 or higher have a different value now. Client applications
that hard-coded error code values need to be updated. In any case,
clients that test error codes should be recompiled before being used
with a MySQL 5.1.20 server.
[3 Jul 2007 18:24] Paul Dubois
Setting report back to Patch approved per Tim's request.
[6 Jul 2007 17:59] Paul Dubois
Updated changelog entry:

Incompatible change: Some error codes had error numbers in MySQL 5.1
different from the numbers in MySQL 5.0. In MySQL 5.1, error numbers
have been changed to match the MySQL 5.0 values: Error codes with
value of 1458 or higher have changed in MySQL 5.1 now. Client
applications designed to work with MySQL 5.1 with hard-coded error
code values (for example, in statements such as if 
(mysql_errno(mysql) == 1463) { ... }) need to be updated in the
source code. All clients designed to work with MySQL 5.1 that test
error codes (for example, in statements such as if
(mysql_errno(mysql) == ER_VIEW_RECURSIVE) { ... }) should be
recompiled. Existing 5.0 clients should now work, without changes or
recompilation, against servers for MySQL 5.1.20 or higher.
[7 Jul 2007 16:34] Bugs System
Pushed into 5.1.21-beta
[22 Aug 2007 21:44] Timothy Smith
Old errors, for future reference

Attachment: mysqld_error.h (text/x-chdr), 21.55 KiB.