The problem is that when upgrading the event table, the sql_mode
column was always being added instead of being updated to list new
sql_mode values, causing upgrades of the event which already have
a sql_mode column to not be updated to the new sql_mode values.
The solution is to always add first a stub sql_mode column and
subsequently update the column to the new sql_mode values.
scripts/mysql_system_tables_fix.sql:
Always add and update the sql_mode column of the event table.
The problem is that one can not create a stored routine if sql_mode
contains NO_ENGINE_SUBSTITUTION or PAD_CHAR_TO_FULL_LENGTH. Also when
a event is created, the mode is silently lost if sql_mode contains one
of the aforementioned. This was happening because the table definitions
which stored sql_mode values weren't being updated to accept new values
of sql_mode.
The solution is to update, in a backwards compatible manner, the various
table definitions (columns) that store the sql_mode value to take into
account the new possible values. One incompatible change is that if a event
that is being created can't be stored to the mysql.event table, an error
will be raised.
The tests case also ensure that new SQL modes will be added to the mysql.proc
and mysql.event tables, otherwise the tests will fail.
mysql-test/r/events_bugs.result:
Add test case result for Bug#32633
mysql-test/r/information_schema.result:
Update the sql_mode column definition.
mysql-test/r/sp.result:
Add test case result for Bug#32633
mysql-test/r/system_mysql_db.result:
Update the sql_mode column definition.
mysql-test/t/events_bugs.test:
Add test case for Bug#32633
mysql-test/t/sp.test:
Add test case for Bug#32633
mysql-test/t/system_mysql_db_fix50117.test:
Update the sql_mode column definition.
scripts/mysql_system_tables.sql:
Update the sql_mode column definition.
scripts/mysql_system_tables_fix.sql:
Update the sql_mode column definition.
sql/event_db_repository.cc:
Reset and restore SQL modes when storing and loading a
event from the data dictionary. Also throw out a error
if a store fails.
sql/mysqld.cc:
Add warning to avoid this problem in the future.
sql-common/my_user.c:
Truncate length if user name or host name does not fit
in the buffer.
sql/sp.cc:
SQL mode of the thread must not effect data dictionary operations.
The problem was that the RETURNS column in the mysql.proc was of
CHAR(64). That was not enough for storing long-named datatypes.
The fix is to change CHAR(64) to LONGBLOB, and to throw warnings
at the time a stored routine is created if some data is truncated
during writing into mysql.proc.
mysql-test/r/sp.result:
Update test result.
mysql-test/t/sp.test:
Add a test case for BUG#24923.
scripts/mysql_system_tables.sql:
Change the data type of column 'returns' from char(64) to longblob.
scripts/mysql_system_tables_fix.sql:
Change the data type of column 'returns' from char(64) to longblob.
sql/sp.cc:
Produce warnings if any data was truncated during writing
into mysql.proc.
sql/sp.h:
Add new error code.
sql/share/errmsg.txt:
Add new error message.
sql/sql_parse.cc:
Hande
- BUG#11986: Stored routines and triggers can fail if the code
has a non-ascii symbol
- BUG#16291: mysqldump corrupts string-constants with non-ascii-chars
- BUG#19443: INFORMATION_SCHEMA does not support charsets properly
- BUG#21249: Character set of SP-var can be ignored
- BUG#25212: Character set of string constant is ignored (stored routines)
- BUG#25221: Character set of string constant is ignored (triggers)
There were a few general problems that caused these bugs:
1. Character set information of the original (definition) query for views,
triggers, stored routines and events was lost.
2. mysqldump output query in client character set, which can be
inappropriate to encode definition-query.
3. INFORMATION_SCHEMA used strings with mixed encodings to display object
definition;
1. No query-definition-character set.
In order to compile query into execution code, some extra data (such as
environment variables or the database character set) is used. The problem
here was that this context was not preserved. So, on the next load it can
differ from the original one, thus the result will be different.
The context contains the following data:
- client character set;
- connection collation (character set and collation);
- collation of the owner database;
The fix is to store this context and use it each time we parse (compile)
and execute the object (stored routine, trigger, ...).
2. Wrong mysqldump-output.
The original query can contain several encodings (by means of character set
introducers). The problem here was that we tried to convert original query
to the mysqldump-client character set.
Moreover, we stored queries in different character sets for different
objects (views, for one, used UTF8, triggers used original character set).
The solution is
- to store definition queries in the original character set;
- to change SHOW CREATE statement to output definition query in the
binary character set (i.e. without any conversion);
- introduce SHOW CREATE TRIGGER statement;
- to dump special statements to switch the context to the original one
before dumping and restore it afterwards.
Note, in order to preserve the database collation at the creation time,
additional ALTER DATABASE might be used (to temporary switch the database
collation back to the original value). In this case, ALTER DATABASE
privilege will be required. This is a backward-incompatible change.
3. INFORMATION_SCHEMA showed non-UTF8 strings
The fix is to generate UTF8-query during the parsing, store it in the object
and show it in the INFORMATION_SCHEMA.
Basically, the idea is to create a copy of the original query convert it to
UTF8. Character set introducers are removed and all text literals are
converted to UTF8.
This UTF8 query is intended to provide user-readable output. It must not be
used to recreate the object. Specialized SHOW CREATE statements should be
used for this.
The reason for this limitation is the following: the original query can
contain symbols from several character sets (by means of character set
introducers).
Example:
- original query:
CREATE VIEW v1 AS SELECT _cp1251 'Hello' AS c1;
- UTF8 query (for INFORMATION_SCHEMA):
CREATE VIEW v1 AS SELECT 'Hello' AS c1;
client/mysqldump.c:
Set original character set and collation before dumping definition query.
include/my_sys.h:
Move out-parameter to the end of list.
mysql-test/lib/mtr_report.pl:
Ignore server-warnings during the test case.
mysql-test/r/create.result:
Update result file.
mysql-test/r/ctype_cp932_binlog_stm.result:
Update result file.
mysql-test/r/events.result:
Update result file.
mysql-test/r/events_bugs.result:
Update result file.
mysql-test/r/events_grant.result:
Update result file.
mysql-test/r/func_in.result:
Update result file.
mysql-test/r/gis.result:
Update result file.
mysql-test/r/grant.result:
Update result file.
mysql-test/r/information_schema.result:
Update result file.
mysql-test/r/information_schema_db.result:
Update result file.
mysql-test/r/lowercase_view.result:
Update result file.
mysql-test/r/mysqldump.result:
Update result file.
mysql-test/r/ndb_sp.result:
Update result file.
mysql-test/r/ps.result:
Update result file.
mysql-test/r/rpl_replicate_do.result:
Update result file.
mysql-test/r/rpl_sp.result:
Update result file.
mysql-test/r/rpl_trigger.result:
Update result file.
mysql-test/r/rpl_view.result:
Update result file.
mysql-test/r/show_check.result:
Update result file.
mysql-test/r/skip_grants.result:
Update result file.
mysql-test/r/sp-destruct.result:
Update result file.
mysql-test/r/sp-error.result:
Update result file.
mysql-test/r/sp-security.result:
Update result file.
mysql-test/r/sp.result:
Update result file.
mysql-test/r/sql_mode.result:
Update result file.
mysql-test/r/system_mysql_db.result:
Update result file.
mysql-test/r/temp_table.result:
Update result file.
mysql-test/r/trigger-compat.result:
Update result file.
mysql-test/r/trigger-grant.result:
Update result file.
mysql-test/r/trigger.result:
Update result file.
mysql-test/r/view.result:
Update result file.
mysql-test/r/view_grant.result:
Update result file.
mysql-test/t/events.test:
Update test case (new columns added).
mysql-test/t/information_schema.test:
Update test case (new columns added).
mysql-test/t/show_check.test:
Test case for SHOW CREATE TRIGGER in prepared statements and
stored routines.
mysql-test/t/sp-destruct.test:
Update test case (new columns added).
mysql-test/t/sp.test:
Update test case (new columns added).
mysql-test/t/view.test:
Update test.
mysys/charset.c:
Move out-parameter to the end of list.
scripts/mysql_system_tables.sql:
Add new columns to mysql.proc and mysql.event.
scripts/mysql_system_tables_fix.sql:
Add new columns to mysql.proc and mysql.event.
sql/event_data_objects.cc:
Support new attributes for events.
sql/event_data_objects.h:
Support new attributes for events.
sql/event_db_repository.cc:
Support new attributes for events.
sql/event_db_repository.h:
Support new attributes for events.
sql/events.cc:
Add new columns to SHOW CREATE event resultset.
sql/mysql_priv.h:
1. Introduce Object_creation_ctx;
2. Introduce SHOW CREATE TRIGGER;
3. Introduce auxilary functions.
sql/sp.cc:
Add support for new store routines attributes.
sql/sp_head.cc:
Add support for new store routines attributes.
sql/sp_head.h:
Add support for new store routines attributes.
sql/sql_lex.cc:
Generate UTF8-body on parsing/lexing.
sql/sql_lex.h:
1. Generate UTF8-body on parsing/lexing.
2. Introduce SHOW CREATE TRIGGER.
sql/sql_parse.cc:
Introduce SHOW CREATE TRIGGER.
sql/sql_partition.cc:
Update parse_sql().
sql/sql_prepare.cc:
Update parse_sql().
sql/sql_show.cc:
Support new attributes for views
sql/sql_trigger.cc:
Support new attributes for views
sql/sql_trigger.h:
Support new attributes for views
sql/sql_view.cc:
Support new attributes for views
sql/sql_yacc.yy:
1. Add SHOW CREATE TRIGGER statement.
2. Generate UTF8-body for views, stored routines, triggers and events.
sql/table.cc:
Introduce Object_creation_ctx.
sql/table.h:
Introduce Object_creation_ctx.
sql/share/errmsg.txt:
Add new errors.
mysql-test/include/ddl_i18n.check_events.inc:
Aux file for test suite.
mysql-test/include/ddl_i18n.check_sp.inc:
Aux file for test suite.
mysql-test/include/ddl_i18n.check_triggers.inc:
Aux file for test suite.
mysql-test/include/ddl_i18n.check_views.inc:
Aux file for test suite.
mysql-test/include/have_cp1251.inc:
Aux file for test suite.
mysql-test/include/have_cp866.inc:
Aux file for test suite.
mysql-test/include/have_koi8r.inc:
Aux file for test suite.
mysql-test/include/have_utf8.inc:
Aux file for test suite.
mysql-test/r/ddl_i18n_koi8r.result:
Result file.
mysql-test/r/ddl_i18n_utf8.result:
Result file.
mysql-test/r/have_cp1251.require:
Aux file for test suite.
mysql-test/r/have_cp866.require:
Aux file for test suite.
mysql-test/r/have_koi8r.require:
Aux file for test suite.
mysql-test/r/have_utf8.require:
Aux file for test suite.
mysql-test/t/ddl_i18n_koi8r.test:
Complete koi8r test case for the CS patch.
mysql-test/t/ddl_i18n_utf8.test:
Complete utf8 test case for the CS patch.
- Add test for upgrading from 5.1.17 - it's a beta but anyway
good to have a check oif upgrading new system tables for 5.1
- Always put the "originator" column after "comment" to get correct
order of columns in "events" table
scripts/mysql_system_tables_fix.sql:
Make sure the "originator" column ands up after "comment" to get
correct order of the columns in event table
mysql-test/t/system_mysql_db_fix50117-master.opt:
New BitKeeper file ``mysql-test/t/system_mysql_db_fix50117-master.opt''
mysql-test/t/system_mysql_db_fix50117.test:
New BitKeeper file ``mysql-test/t/system_mysql_db_fix50117.test''
into pilot.blaudden:/home/msvensson/mysql/mysql-5.1-maint
scripts/mysql_system_tables_fix.sql:
Auto merged
sql/sql_plugin.cc:
Auto merged
sql/sql_udf.cc:
Auto merged
Add "two liner" to mysqld --bootstrap that allows
wo write scripts that can be run both by mysql and mysqld --bootstrap
Remove duplicate create of MySQL system tables
mysql-test/r/mysql_upgrade.result:
Update mysql_upgrade.result for new tables in 5.1
scripts/mysql_system_tables.sql:
Use "delimiter ;;" to make it possible to run the script
both with "mysql" and "mysqld --bootstrap"
scripts/mysql_system_tables_fix.sql:
Remove duplicate stored procedure for creating slow_log
and general_log.
Remove duplicate CREATE of ndb_binlog_index.
Those are already defined in mysql_system_tables.sql
sql/sql_parse.cc:
Make "mysqld --bootstrap skip lines startig with "delimiter"
thus making it possible to write sql scripts containing
stored procedures that can be executed both with "mysql" and
"mysqld --bootstrap"
This patch changes test to remove Windows-specific limitations and potential
rounding errors in the calculation of a UDF.
Also corrects a minor merge conflict.
mysql-test/include/rpl_udf.inc:
WL#3629 - Replication of Invocation and Invoked Features
This patch changes test to remove Windows-specific results by replacing the
library name in the SELECT from mysql.func to "UDF_LIB" to allow for the
differences in platform (.so vs .dll).
The patch also changes the function body of myfuncsql_double to a calculation
that does not result in potential rounding errors from the test data.
mysql-test/r/rpl_udf.result:
WL#3629 - Replication of Invocation and Invoked Features
This patch changes the result file for the test to match the new expected
values for the SELECT from mysql.func and the return of myfuncsql_double.
scripts/mysql_system_tables_fix.sql:
WL#3629 - Replication of Invocation and Invoked Features
This patch corrects a merge error encountered in a previous merge. The
column originator should be listed before time_zone in mysql.event.
into mysql_cab_desk.:C:/source/c++/mysql-5.1-new-rpl
mysql-test/t/events.test:
Auto merged
sql/event_queue.cc:
Auto merged
sql/events.cc:
Auto merged
sql/lex.h:
Auto merged
sql/slave.cc:
Auto merged
sql/sql_parse.cc:
Auto merged
sql/sql_show.cc:
Auto merged
sql/sql_yacc.yy:
Auto merged
BitKeeper/deleted/.del-init_db.sql~a77d572c39d5a1f8:
WL#3629 : Replication of Invocation and Invoked Features
Manual merge prior to pushing patches.
BitKeeper/deleted/.del-mysql_create_system_tables.sh:
WL#3629 : Replication of Invocation and Invoked Features
Manual merge prior to pushing patches.
mysql-test/r/events.result:
WL#3629 : Replication of Invocation and Invoked Features
Manual merge prior to pushing patches.
mysql-test/r/events_grant.result:
WL#3629 : Replication of Invocation and Invoked Features
Manual merge prior to pushing patches.
mysql-test/r/events_restart_phase1.result:
WL#3629 : Replication of Invocation and Invoked Features
Manual merge prior to pushing patches.
mysql-test/r/system_mysql_db.result:
WL#3629 : Replication of Invocation and Invoked Features
Manual merge prior to pushing patches.
mysql-test/t/events_restart_phase1.test:
WL#3629 : Replication of Invocation and Invoked Features
Manual merge prior to pushing patches.
scripts/mysql_system_tables.sql:
WL#3629 : Replication of Invocation and Invoked Features
Manual merge prior to pushing patches.
scripts/mysql_system_tables_fix.sql:
WL#3629 : Replication of Invocation and Invoked Features
Manual merge prior to pushing patches.
sql/event_data_objects.cc:
WL#3629 : Replication of Invocation and Invoked Features
Manual merge prior to pushing patches.
sql/event_data_objects.h:
WL#3629 : Replication of Invocation and Invoked Features
Manual merge prior to pushing patches.
sql/event_db_repository.cc:
WL#3629 : Replication of Invocation and Invoked Features
Manual merge prior to pushing patches.
sql/event_db_repository.h:
WL#3629 : Replication of Invocation and Invoked Features
Manual merge prior to pushing patches.
sql/sql_udf.cc:
WL#3629 : Replication of Invocation and Invoked Features
Manual merge prior to pushing patches.
into mysql_cab_desk.:C:/source/c++/mysql-5.1_WL_3629
BitKeeper/deleted/.del-init_db.sql~a77d572c39d5a1f8:
Auto merged
BitKeeper/deleted/.del-mysql_create_system_tables.sh:
Auto merged
scripts/mysql_system_tables_fix.sql:
Auto merged
sql/event_data_objects.cc:
Auto merged
sql/slave.cc:
Auto merged
sql/sql_parse.cc:
Auto merged
sql/sql_show.cc:
Auto merged
sql/sql_yacc.yy:
Auto merged
sql/event_data_objects.h:
Manual merge.
sql/event_queue.cc:
Manual merge.
sql/events.cc:
Manual merge.
scripts/mysql_system_tables.sql:
Add time_zone to the list of mysql.event columns.
scripts/mysql_system_tables_fix.sql:
Update after a bad merge: now mysql_system_tables_fix contains
only alter definitions, no CREATE definitions (single definition
source approach that was implemented by Magnus).
into bodhi.local:/opt/local/work/mysql-5.1-runtime
include/my_global.h:
Auto merged
mysql-test/mysql-test-run.pl:
Auto merged
mysql-test/r/events_scheduling.result:
Auto merged
BitKeeper/deleted/.del-init_db.sql~a77d572c39d5a1f8:
Auto merged
BitKeeper/deleted/.del-mysql_create_system_tables.sh:
Auto merged
mysql-test/r/query_cache.result:
Auto merged
mysql-test/r/view.result:
Auto merged
mysql-test/t/events_scheduling.test:
Auto merged
mysql-test/t/grant_cache.test:
Auto merged
mysql-test/t/query_cache.test:
Auto merged
mysql-test/t/view.test:
Auto merged
scripts/mysql_system_tables_fix.sql:
Auto merged
sql/event_db_repository.cc:
Auto merged
sql/event_queue.cc:
Auto merged
sql/field.cc:
Auto merged
sql/handler.cc:
Auto merged
sql/handler.h:
Auto merged
sql/item.cc:
Auto merged
sql/item.h:
Auto merged
sql/item_func.cc:
Auto merged
sql/item_subselect.cc:
Auto merged
sql/log_event.cc:
Auto merged
sql/mysql_priv.h:
Auto merged
sql/mysqld.cc:
Auto merged
sql/set_var.cc:
Auto merged
sql/sp.cc:
Auto merged
sql/sp_head.cc:
Auto merged
sql/sp_head.h:
Auto merged
sql/sql_base.cc:
Auto merged
sql/sql_class.cc:
Auto merged
sql/sql_class.h:
Auto merged
sql/sql_help.cc:
Auto merged
sql/sql_lex.cc:
Auto merged
sql/sql_lex.h:
Auto merged
sql/sql_parse.cc:
Auto merged
sql/sql_prepare.cc:
Auto merged
sql/sql_select.cc:
Auto merged
sql/sql_show.cc:
Auto merged
sql/sql_table.cc:
Auto merged
sql/sql_yacc.yy:
Auto merged
sql/table.cc:
Auto merged
sql/share/errmsg.txt:
Auto merged
sql/tztime.cc:
Auto merged
storage/innobase/handler/ha_innodb.cc:
Auto merged
storage/myisam/ha_myisam.cc:
Auto merged
storage/myisam/ha_myisam.h:
Auto merged
mysql-test/r/skip_grants.result:
Manualmerge.
mysql-test/r/sp.result:
Manualmerge.
mysql-test/t/skip_grants.test:
Manualmerge.
mysql-test/t/sp.test:
Manualmerge.
sql/event_data_objects.cc:
Manualmerge.
- Fix error message to say that "mysql_upgrade" should be run when
a particular error message is found to be missing
- Dont's set default value on blob's - it will not be used anyway.
scripts/mysql_system_tables_fix.sql:
Don't set a DEFAULT value on blob - depending on sql_mode it
will either be dicarded or throw an error message. But never used.
sql/sql_plugin.cc:
Update error message to indicate that "mysql_upgrade" should
be used to correct the problem
sql/sql_udf.cc:
Update error message to indicate that "mysql_upgrade" should
be used to correct the problem
into pilot.blaudden:/home/msvensson/mysql/mysql-5.1-new-maint
mysql-test/mysql-test-run.pl:
Auto merged
scripts/Makefile.am:
Auto merged
scripts/mysql_install_db.sh:
Auto merged
scripts/mysql_system_tables_fix.sql:
Auto merged
scripts/mysql_system_tables.sql:
Manual merge
- Split out initial data in mysql_system_tables.sql to it's own file
- Use file from mysql_install_db and mysql-test-run
scripts/mysql_system_tables_fix.sql:
Rename: scripts/mysql_fix_privilege_tables.sql.in -> scripts/mysql_system_tables_fix.sql
mysql-test/mysql-test-run.pl:
- Add mysql_system_tables_data.sql as part of the bootstrap
- Remove the addition of pid to end of bootstrap.sql, now
to file used for bootstrap will be $opt_vardir/tmp/bootstrap.sql
- Improve error message descibing how to find cause of a
failed bootstrap
scripts/Makefile.am:
- Rename mysql_fix_privileg_tables.sql.in to mysql_system_tables_fix.sql
- Build mysql_fix_privilege_tables from mysql_system_tables.sql and
mysql_system_tables_fix.sql
- Add mysql_system_tables_fix.sql to EXTRA_DIST
scripts/mysql_install_db.sh:
- Use mysql_system_tables_data.sql file when bootstrapping
mysql, it will contain initial data for MysQL system tables
scripts/mysql_system_tables.sql:
Move initial data for system tables to it's own file
scripts/mysql_system_tables_data.sql:
Move initial data for system tables to it's own file
2007-02-28 14:26:58 +01:00
Renamed from scripts/mysql_fix_privilege_tables.sql.in (Browse further)