The problem is that every time a new error message is added to a GA version of MySQL, the code (number) of the error messages only present in later versions will all change as the error added to 5.1 must have the same code (number) in every release. In a nutshell, the consequence is a stream of ever changing error codes in 6.0 every time we add a new error to 5.1, which makes developer's work hard as a lot of tests have to be updated and users can't depend upon the error codes of non-GA releases (eg: broken SP handlers, etc). Nonetheless, we could easily fix this problem by reserving, let's say, 25 error messages for each MySQL release. See also WL#4244 "Error codes supporting multiple releases".
In order to reserve error messages for a previous release, it's necessary to: 1) Modify extra/comp_err.c It's necessary to modify the start-error-number command to also reset the error code counter if a new "start error number" is specified. 2) Modify sql/share/errmsg.txt In later MySQL versions with start-error-number tags to reserve error code ranges. For example: MySQL 5.1 sql/share/errmsg.txt: start-error-number 1000 ER_NO "No" ER_YES "Yes" MySQL 6.0 sql/share/errmsg.txt: start-error-number 1000 ER_NO # 1000 "No" ER_YES # 1001 "Yes" start-error-number 1050 ER_MAYBE # 1050 "Maybe" This effectively reservers 50 error codes for MySQL 5.1.