2014-02-17 11:00:51 +01:00
-- Copyright (C) 2003, 2013 Oracle and/or its affiliates.
2015-03-16 21:50:20 -04:00
-- Copyright (C) 2010, 2015 MariaDB Corporation.
2010-04-14 20:40:04 +04:00
--
-- This program is free software; you can redistribute it and/or modify
-- it under the terms of the GNU General Public License as published by
-- the Free Software Foundation; version 2 of the License.
--
-- This program is distributed in the hope that it will be useful,
-- but WITHOUT ANY WARRANTY; without even the implied warranty of
-- MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
-- GNU General Public License for more details.
--
-- You should have received a copy of the GNU General Public License
-- along with this program; if not, write to the Free Software
-- Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
2015-03-16 21:50:20 -04:00
# WARNING: Do not use this script to upgrade system tables older that v5.1.
# This part converts old privilege tables to privilege tables suitable
# for current version of MySQL/MariaDB server.
2003-08-27 22:30:50 +03:00
2007-02-26 14:48:41 +01:00
# You can safely ignore all 'Duplicate column' and 'Unknown column' errors
2006-11-21 22:32:58 +02:00
# because these just mean that your tables are already up to date.
# This script is safe to run even if your tables are already up to date!
2003-08-27 22:30:50 +03:00
2013-06-16 21:26:40 +03:00
# Warning message(s) produced for a statement can be printed by explicitly
# adding a 'SHOW WARNINGS' after the statement.
2007-01-02 09:42:13 -08:00
set sql_mode = ' ' ;
2005-04-18 22:01:18 +01:00
set storage_engine = MyISAM ;
2005-04-16 04:12:30 +03:00
2009-03-11 17:30:56 -03:00
#
# Modify log tables.
#
SET @ old_log_state = @ @ global . general_log ;
SET GLOBAL general_log = ' OFF ' ;
2010-02-26 09:22:48 -03:00
ALTER TABLE general_log
2013-06-16 21:26:40 +03:00
MODIFY event_time TIMESTAMP ( 6 ) NOT NULL DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP ,
2010-02-26 09:22:48 -03:00
MODIFY user_host MEDIUMTEXT NOT NULL ,
MODIFY thread_id INTEGER NOT NULL ,
MODIFY server_id INTEGER UNSIGNED NOT NULL ,
MODIFY command_type VARCHAR ( 64 ) NOT NULL ,
2013-06-16 21:26:40 +03:00
MODIFY argument MEDIUMTEXT NOT NULL ,
MODIFY thread_id BIGINT ( 21 ) UNSIGNED NOT NULL ;
2009-03-11 17:30:56 -03:00
SET GLOBAL general_log = @ old_log_state ;
SET @ old_log_state = @ @ global . slow_query_log ;
SET GLOBAL slow_query_log = ' OFF ' ;
2010-02-26 09:22:48 -03:00
ALTER TABLE slow_log
2013-06-16 21:26:40 +03:00
ADD COLUMN thread_id BIGINT ( 21 ) UNSIGNED NOT NULL AFTER sql_text ;
2014-11-30 21:13:41 -05:00
ALTER TABLE slow_log
ADD COLUMN rows_affected INTEGER NOT NULL AFTER thread_id ;
2013-06-16 21:26:40 +03:00
ALTER TABLE slow_log
MODIFY start_time TIMESTAMP ( 6 ) NOT NULL DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP ,
2010-02-26 09:22:48 -03:00
MODIFY user_host MEDIUMTEXT NOT NULL ,
2011-05-19 19:19:44 +02:00
MODIFY query_time TIME ( 6 ) NOT NULL ,
MODIFY lock_time TIME ( 6 ) NOT NULL ,
2010-02-26 09:22:48 -03:00
MODIFY rows_sent INTEGER NOT NULL ,
MODIFY rows_examined INTEGER NOT NULL ,
MODIFY db VARCHAR ( 512 ) NOT NULL ,
MODIFY last_insert_id INTEGER NOT NULL ,
MODIFY insert_id INTEGER NOT NULL ,
MODIFY server_id INTEGER UNSIGNED NOT NULL ,
2013-06-16 21:26:40 +03:00
MODIFY sql_text MEDIUMTEXT NOT NULL ,
MODIFY thread_id BIGINT ( 21 ) UNSIGNED NOT NULL ;
2009-03-11 17:30:56 -03:00
SET GLOBAL slow_query_log = @ old_log_state ;
2015-03-16 21:50:20 -04:00
#
# Modify plugin table.
#
2009-10-12 20:15:10 +02:00
ALTER TABLE plugin
MODIFY name varchar ( 64 ) COLLATE utf8_general_ci NOT NULL DEFAULT ' ' ,
MODIFY dl varchar ( 128 ) COLLATE utf8_general_ci NOT NULL DEFAULT ' ' ,
CONVERT TO CHARACTER SET utf8 COLLATE utf8_general_ci ;
2004-09-11 18:46:06 +03:00
#
2015-03-16 21:50:20 -04:00
# Add max_user_connections resource limit.
# This is signed in MariaDB so that if one sets it to -1 then the user
# cannot connect anymore.
2004-12-29 20:30:37 +03:00
#
2011-09-26 20:26:47 +03:00
ALTER TABLE user ADD max_user_connections int ( 11 ) DEFAULT ' 0 ' NOT NULL AFTER max_connections ;
ALTER TABLE user MODIFY max_user_connections int ( 11 ) DEFAULT ' 0 ' NOT NULL AFTER max_connections ;
2004-12-29 20:30:37 +03:00
2007-02-26 11:49:24 +01:00
#
# procs_priv
#
2015-03-19 09:47:20 -04:00
ALTER IGNORE TABLE procs_priv
MODIFY Routine_name char ( 64 )
COLLATE utf8_general_ci DEFAULT ' ' NOT NULL ;
2006-11-29 12:04:29 +01:00
ALTER TABLE procs_priv
2013-06-16 21:26:40 +03:00
MODIFY Timestamp timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP AFTER Proc_priv ;
2006-11-29 12:04:29 +01:00
2007-02-26 11:49:24 +01:00
#
# proc
#
2004-03-23 12:04:40 +01:00
2004-10-14 18:07:09 +02:00
# Correct the name fields to not binary, and expand sql_data_access
2015-03-19 09:47:20 -04:00
ALTER TABLE proc MODIFY returns longblob NOT NULL ,
MODIFY sql_mode
2005-03-08 17:40:43 -08:00
set ( ' REAL_AS_FLOAT ' ,
' PIPES_AS_CONCAT ' ,
' ANSI_QUOTES ' ,
' IGNORE_SPACE ' ,
2010-04-08 14:10:05 +02:00
' IGNORE_BAD_TABLE_OPTIONS ' ,
2005-03-08 17:40:43 -08:00
' 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 ' ,
' INVALID_DATES ' ,
' ERROR_FOR_DIVISION_BY_ZERO ' ,
' TRADITIONAL ' ,
' NO_AUTO_CREATE_USER ' ,
2008-02-07 08:47:39 -02:00
' HIGH_NOT_PRECEDENCE ' ,
' NO_ENGINE_SUBSTITUTION ' ,
' PAD_CHAR_TO_FULL_LENGTH '
2005-08-23 16:37:21 -07:00
) DEFAULT ' ' NOT NULL ,
2005-07-08 16:33:15 +02:00
DEFAULT CHARACTER SET utf8 ;
# Reset some fields after the conversion
2015-03-16 21:50:20 -04:00
ALTER TABLE proc MODIFY definer
char ( 141 ) collate utf8_bin DEFAULT ' ' NOT NULL ;
Patch for the following bugs:
- 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.
2007-06-28 21:34:54 +04:00
2015-03-19 09:47:20 -04:00
ALTER TABLE proc ADD character_set_client
char ( 32 ) collate utf8_bin DEFAULT NULL
AFTER comment ;
ALTER TABLE proc MODIFY character_set_client
char ( 32 ) collate utf8_bin DEFAULT NULL ;
2009-12-03 17:15:47 +01:00
SELECT CASE WHEN COUNT ( * ) > 0 THEN
CONCAT ( " WARNING: NULL values of the 'character_set_client' column ('mysql.proc' table) have been updated with a default value ( " , @ @ character_set_client , " ). Please verify if necessary. " )
ELSE NULL
END
AS value FROM proc WHERE character_set_client IS NULL ;
UPDATE proc SET character_set_client = @ @ character_set_client
WHERE character_set_client IS NULL ;
Patch for the following bugs:
- 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.
2007-06-28 21:34:54 +04:00
ALTER TABLE proc ADD collation_connection
char ( 32 ) collate utf8_bin DEFAULT NULL
AFTER character_set_client ;
ALTER TABLE proc MODIFY collation_connection
char ( 32 ) collate utf8_bin DEFAULT NULL ;
2009-12-03 17:15:47 +01:00
SELECT CASE WHEN COUNT ( * ) > 0 THEN
CONCAT ( " WARNING: NULL values of the 'collation_connection' column ('mysql.proc' table) have been updated with a default value ( " , @ @ collation_connection , " ). Please verify if necessary. " )
ELSE NULL
END
AS value FROM proc WHERE collation_connection IS NULL ;
UPDATE proc SET collation_connection = @ @ collation_connection
WHERE collation_connection IS NULL ;
Patch for the following bugs:
- 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.
2007-06-28 21:34:54 +04:00
ALTER TABLE proc ADD db_collation
char ( 32 ) collate utf8_bin DEFAULT NULL
AFTER collation_connection ;
ALTER TABLE proc MODIFY db_collation
char ( 32 ) collate utf8_bin DEFAULT NULL ;
2009-12-03 17:15:47 +01:00
SELECT CASE WHEN COUNT ( * ) > 0 THEN
CONCAT ( " WARNING: NULL values of the 'db_collation' column ('mysql.proc' table) have been updated with default values. Please verify if necessary. " )
ELSE NULL
END
AS value FROM proc WHERE db_collation IS NULL ;
UPDATE proc AS p SET db_collation =
( SELECT DEFAULT_COLLATION_NAME
FROM INFORMATION_SCHEMA . SCHEMATA
WHERE SCHEMA_NAME = p . db )
WHERE db_collation IS NULL ;
Patch for the following bugs:
- 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.
2007-06-28 21:34:54 +04:00
ALTER TABLE proc ADD body_utf8 longblob DEFAULT NULL
AFTER db_collation ;
ALTER TABLE proc MODIFY body_utf8 longblob DEFAULT NULL ;
2009-10-09 17:35:07 +02:00
# Change comment from char(64) to text
ALTER TABLE proc MODIFY comment
text collate utf8_bin NOT NULL ;
Patch for the following bugs:
- 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.
2007-06-28 21:34:54 +04:00
2007-03-21 19:20:44 +03:00
#
# EVENT table
#
2008-04-04 13:46:05 -03:00
# Update list of sql_mode values.
ALTER TABLE event MODIFY sql_mode
2006-01-31 16:01:27 +01:00
set ( ' REAL_AS_FLOAT ' ,
' PIPES_AS_CONCAT ' ,
' ANSI_QUOTES ' ,
' IGNORE_SPACE ' ,
2010-04-08 14:10:05 +02:00
' IGNORE_BAD_TABLE_OPTIONS ' ,
2006-01-31 16:01:27 +01:00
' 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 ' ,
' INVALID_DATES ' ,
' ERROR_FOR_DIVISION_BY_ZERO ' ,
' TRADITIONAL ' ,
' NO_AUTO_CREATE_USER ' ,
2008-02-07 08:47:39 -02:00
' HIGH_NOT_PRECEDENCE ' ,
' NO_ENGINE_SUBSTITUTION ' ,
' PAD_CHAR_TO_FULL_LENGTH '
2006-01-31 23:29:03 +01:00
) DEFAULT ' ' NOT NULL AFTER on_completion ;
2006-02-25 21:54:34 +02:00
2015-03-19 09:47:20 -04:00
ALTER TABLE event MODIFY COLUMN originator INT UNSIGNED NOT NULL ;
ALTER TABLE event ADD COLUMN originator INT UNSIGNED NOT NULL AFTER comment ;
ALTER TABLE event MODIFY COLUMN status ENUM ( ' ENABLED ' , ' DISABLED ' , ' SLAVESIDE_DISABLED ' ) NOT NULL default ' ENABLED ' ;
ALTER TABLE event ADD character_set_client
char ( 32 ) collate utf8_bin DEFAULT NULL
AFTER time_zone ;
ALTER TABLE event MODIFY character_set_client
char ( 32 ) collate utf8_bin DEFAULT NULL ;
ALTER TABLE event ADD collation_connection
char ( 32 ) collate utf8_bin DEFAULT NULL
AFTER character_set_client ;
ALTER TABLE event MODIFY collation_connection
char ( 32 ) collate utf8_bin DEFAULT NULL ;
ALTER TABLE event ADD db_collation
char ( 32 ) collate utf8_bin DEFAULT NULL
AFTER collation_connection ;
ALTER TABLE event MODIFY db_collation
char ( 32 ) collate utf8_bin DEFAULT NULL ;
ALTER TABLE event ADD body_utf8 longblob DEFAULT NULL
AFTER db_collation ;
ALTER TABLE event MODIFY body_utf8 longblob DEFAULT NULL ;
2009-10-10 00:01:10 +04:00
#
# user.Create_tablespace_priv
#
SET @ hadCreateTablespacePriv : = 0 ;
SELECT @ hadCreateTablespacePriv : = 1 FROM user WHERE Create_tablespace_priv LIKE ' % ' ;
ALTER TABLE user ADD Create_tablespace_priv enum ( ' N ' , ' Y ' ) COLLATE utf8_general_ci DEFAULT ' N ' NOT NULL AFTER Trigger_priv ;
ALTER TABLE user MODIFY Create_tablespace_priv enum ( ' N ' , ' Y ' ) COLLATE utf8_general_ci DEFAULT ' N ' NOT NULL AFTER Trigger_priv ;
UPDATE user SET Create_tablespace_priv = Super_priv WHERE @ hadCreateTablespacePriv = 0 ;
2011-03-18 16:16:17 +02:00
ALTER TABLE user ADD plugin char ( 64 ) DEFAULT ' ' , ADD authentication_string TEXT ;
2013-06-16 21:26:40 +03:00
ALTER TABLE user ADD password_expired ENUM ( ' N ' , ' Y ' ) COLLATE utf8_general_ci DEFAULT ' N ' NOT NULL ;
2013-11-13 22:58:10 +01:00
ALTER TABLE user ADD is_role enum ( ' N ' , ' Y ' ) COLLATE utf8_general_ci DEFAULT ' N ' NOT NULL ;
2014-05-30 17:54:13 +03:00
ALTER TABLE user ADD default_role char ( 80 ) binary DEFAULT ' ' NOT NULL ;
2014-10-07 11:37:36 +03:00
ALTER TABLE user ADD max_statement_time decimal ( 12 , 6 ) DEFAULT 0 NOT NULL ;
2013-07-04 16:36:43 +04:00
ALTER TABLE user MODIFY plugin char ( 64 ) CHARACTER SET latin1 DEFAULT ' ' NOT NULL , MODIFY authentication_string TEXT NOT NULL ;
2013-07-04 17:01:36 +04:00
-- Somewhere above, we ran ALTER TABLE user .... CONVERT TO CHARACTER SET utf8 COLLATE utf8_bin.
-- we want password_expired column to have collation utf8_general_ci.
ALTER TABLE user MODIFY password_expired ENUM ( ' N ' , ' Y ' ) COLLATE utf8_general_ci DEFAULT ' N ' NOT NULL ;
2013-11-13 22:58:10 +01:00
ALTER TABLE user MODIFY is_role enum ( ' N ' , ' Y ' ) COLLATE utf8_general_ci DEFAULT ' N ' NOT NULL ;
2010-08-09 11:32:50 +03:00
2010-11-19 16:35:04 +02:00
-- Need to pre-fill mysql.proxies_priv with access for root even when upgrading from
-- older versions
CREATE TEMPORARY TABLE tmp_proxies_priv LIKE proxies_priv ;
INSERT INTO tmp_proxies_priv VALUES ( ' localhost ' , ' root ' , ' ' , ' ' , TRUE , ' ' , now ( ) ) ;
INSERT INTO proxies_priv SELECT * FROM tmp_proxies_priv WHERE @ had_proxies_priv_table = 0 ;
DROP TABLE tmp_proxies_priv ;
2014-08-01 14:18:28 +05:30
-- Checking for any duplicate hostname and username combination are exists.
-- If exits we will throw error.
DROP PROCEDURE IF EXISTS mysql . count_duplicate_host_names ;
DELIMITER / /
CREATE PROCEDURE mysql . count_duplicate_host_names ( )
BEGIN
SET @ duplicate_hosts = ( SELECT count ( * ) FROM mysql . user GROUP BY user , lower ( host ) HAVING count ( * ) > 1 LIMIT 1 ) ;
IF @ duplicate_hosts > 1 THEN
SIGNAL SQLSTATE ' 45000 ' SET MESSAGE_TEXT = ' Multiple accounts exist for @user_name, @host_name that differ only in Host lettercase; remove all except one of them ' ;
END IF ;
END / /
DELIMITER ;
CALL mysql . count_duplicate_host_names ( ) ;
-- Get warnings (if any)
SHOW WARNINGS ;
DROP PROCEDURE mysql . count_duplicate_host_names ;
2013-10-31 23:02:44 +05:30
# Convering the host name to lower case for existing users
UPDATE user SET host = LOWER ( host ) WHERE LOWER ( host ) < > host ;
2010-08-09 11:32:50 +03:00
2014-08-05 14:39:00 +02:00
# update timestamp fields in the innodb stat tables
set @ str = " alter table mysql.innodb_index_stats modify last_update timestamp not null default current_timestamp on update current_timestamp " ;
set @ str = if ( @ have_innodb < > 0 , @ str , " set @dummy = 0 " ) ;
2014-11-03 21:45:06 +04:00
prepare stmt from @ str ;
execute stmt ;
set @ str = " alter table mysql.innodb_table_stats modify last_update timestamp not null default current_timestamp on update current_timestamp " ;
set @ str = if ( @ have_innodb < > 0 , @ str , " set @dummy = 0 " ) ;
2014-08-05 14:39:00 +02:00
prepare stmt from @ str ;
execute stmt ;
set @ str = replace ( @ str , " innodb_index_stats " , " innodb_table_stats " ) ;
prepare stmt from @ str ;
execute stmt ;
2014-08-05 14:37:05 +02:00
SET @ innodb_index_stats_fk = ( select count ( * ) from information_schema . referential_constraints where constraint_schema = ' mysql ' and table_name = ' innodb_index_stats ' and referenced_table_name = ' innodb_table_stats ' and constraint_name = ' innodb_index_stats_ibfk_1 ' ) ;
SET @ str = IF ( @ innodb_index_stats_fk > 0 and @ have_innodb > 0 , " ALTER TABLE mysql.innodb_index_stats DROP FOREIGN KEY `innodb_index_stats_ibfk_1` " , " SET @dummy = 0 " ) ;
PREPARE stmt FROM @ str ;
EXECUTE stmt ;
DROP PREPARE stmt ;
2013-11-03 16:31:52 +01:00
# MDEV-4332 longer user names
2013-11-13 22:58:10 +01:00
alter table user modify User char ( 80 ) binary not null default ' ' ;
alter table db modify User char ( 80 ) binary not null default ' ' ;
alter table tables_priv modify User char ( 80 ) binary not null default ' ' ;
alter table columns_priv modify User char ( 80 ) binary not null default ' ' ;
alter table procs_priv modify User char ( 80 ) binary not null default ' ' ;
alter table proc modify definer char ( 141 ) collate utf8_bin not null default ' ' ;
alter table event modify definer char ( 141 ) collate utf8_bin not null default ' ' ;
alter table proxies_priv modify User char ( 80 ) COLLATE utf8_bin not null default ' ' ;
alter table proxies_priv modify Proxied_user char ( 80 ) COLLATE utf8_bin not null default ' ' ;
alter table proxies_priv modify Grantor char ( 141 ) COLLATE utf8_bin not null default ' ' ;
alter table servers modify Username char ( 80 ) not null default ' ' ;
alter table procs_priv modify Grantor char ( 141 ) COLLATE utf8_bin not null default ' ' ;
alter table tables_priv modify Grantor char ( 141 ) COLLATE utf8_bin not null default ' ' ;
2010-08-09 11:32:50 +03:00
2015-03-16 21:50:20 -04:00
# Activate the new, possibly modified privilege tables.
2006-02-24 18:34:15 +02:00
# This should not be needed, but gives us some extra testing that the above
# changes was correct
flush privileges ;
2012-08-14 17:23:34 +03:00
2014-11-18 22:25:52 +01:00
--
-- Upgrade help tables
--
ALTER TABLE help_category MODIFY url TEXT NOT NULL ;
ALTER TABLE help_topic MODIFY url TEXT NOT NULL ;