Commit 405f82d3 authored by unknown's avatar unknown

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.
parent 1685f748
This diff is collapsed.
......@@ -905,12 +905,12 @@ extern CHARSET_INFO *get_charset_by_name(const char *cs_name, myf flags);
extern CHARSET_INFO *get_charset_by_csname(const char *cs_name,
uint cs_flags, myf my_flags);
extern bool resolve_charset(CHARSET_INFO **cs,
const char *cs_name,
CHARSET_INFO *default_cs);
extern bool resolve_collation(CHARSET_INFO **cl,
const char *cl_name,
CHARSET_INFO *default_cl);
extern bool resolve_charset(const char *cs_name,
CHARSET_INFO *default_cs,
CHARSET_INFO **cs);
extern bool resolve_collation(const char *cl_name,
CHARSET_INFO *default_cl,
CHARSET_INFO **cl);
extern void free_charsets(void);
extern char *get_charsets_dir(char *buf);
......
# - Check SHOW CREATE statement;
--echo
--echo
SHOW CREATE EVENT ev1|
--echo
SHOW CREATE EVENT ev2|
--echo
SHOW CREATE EVENT mysqltest2.ev3|
--echo
SHOW CREATE EVENT mysqltest2.ev3|
# - Check SHOW statement;
--echo
--echo
SHOW EVENTS LIKE 'ev1'|
--echo
SHOW EVENTS LIKE 'ev2'|
--echo
SHOW EVENTS LIKE 'ev3'|
--echo
SHOW EVENTS LIKE 'ev4'|
# - Check INFORMATION_SCHEMA;
--echo
--echo
--replace_column 17 CREATED 18 LAST_ALTERED
SELECT * FROM INFORMATION_SCHEMA.EVENTS WHERE event_name = 'ev1'|
--echo
--replace_column 17 CREATED 18 LAST_ALTERED
SELECT * FROM INFORMATION_SCHEMA.EVENTS WHERE event_name = 'ev2'|
--echo
--replace_column 17 CREATED 18 LAST_ALTERED
SELECT * FROM INFORMATION_SCHEMA.EVENTS WHERE event_name = 'ev3'|
--echo
--replace_column 17 CREATED 18 LAST_ALTERED
SELECT * FROM INFORMATION_SCHEMA.EVENTS WHERE event_name = 'ev4'|
# - Check SHOW CREATE statement;
--echo
--echo
SHOW CREATE PROCEDURE p1|
--echo
SHOW CREATE PROCEDURE p2|
--echo
SHOW CREATE PROCEDURE mysqltest2.p3|
--echo
SHOW CREATE PROCEDURE mysqltest2.p4|
# - Check SHOW statement;
--echo
--echo
--replace_column 5 MODIFIED 6 CREATED
SHOW PROCEDURE STATUS LIKE 'p1'|
--echo
--replace_column 5 MODIFIED 6 CREATED
SHOW PROCEDURE STATUS LIKE 'p2'|
--echo
--replace_column 5 MODIFIED 6 CREATED
SHOW PROCEDURE STATUS LIKE 'p3'|
--echo
--replace_column 5 MODIFIED 6 CREATED
SHOW PROCEDURE STATUS LIKE 'p4'|
# - Check INFORMATION_SCHEMA;
--echo
--echo
--replace_column 16 CREATED 17 ALTERED
SELECT * FROM INFORMATION_SCHEMA.ROUTINES WHERE routine_name = 'p1'|
--echo
--replace_column 16 CREATED 17 ALTERED
SELECT * FROM INFORMATION_SCHEMA.ROUTINES WHERE routine_name = 'p2'|
--echo
--replace_column 16 CREATED 17 ALTERED
SELECT * FROM INFORMATION_SCHEMA.ROUTINES WHERE routine_name = 'p3'|
--echo
--replace_column 16 CREATED 17 ALTERED
SELECT * FROM INFORMATION_SCHEMA.ROUTINES WHERE routine_name = 'p4'|
# - Initialize the used variables (actual values don't matter);
--echo
--echo
SET @a = '1'|
SET @b = '2'|
# - Execute the routines;
--echo
--echo
CALL p1(@a, @b)|
SELECT COLLATION(@a) AS ca, COLLATION(@b) cb|
--echo
CALL p2(@a, @b)|
SELECT COLLATION(@a) AS ca, COLLATION(@b) cb|
--echo
CALL mysqltest2.p3(@a, @b)|
SELECT COLLATION(@a) AS ca, COLLATION(@b) cb|
--echo
CALL mysqltest2.p4(@a, @b)|
SELECT COLLATION(@a) AS ca, COLLATION(@b) cb|
# - Check SHOW CREATE statement;
--echo
--echo
SHOW CREATE TRIGGER trg1|
--echo
SHOW CREATE TRIGGER trg2|
--echo
SHOW CREATE TRIGGER mysqltest2.trg3|
--echo
SHOW CREATE TRIGGER mysqltest2.trg4|
# - Check SHOW statement;
--echo
--echo
SHOW TRIGGERS|
--echo
use mysqltest2|
--echo
SHOW TRIGGERS|
use mysqltest1|
# - Check INFORMATION_SCHEMA;
--echo
--echo
--replace_column 17 CREATED
SELECT * FROM INFORMATION_SCHEMA.TRIGGERS WHERE trigger_name = 'trg1'|
--echo
--replace_column 17 CREATED
SELECT * FROM INFORMATION_SCHEMA.TRIGGERS WHERE trigger_name = 'trg2'|
--echo
--replace_column 17 CREATED
SELECT * FROM INFORMATION_SCHEMA.TRIGGERS WHERE trigger_name = 'trg3'|
--echo
--replace_column 17 CREATED
SELECT * FROM INFORMATION_SCHEMA.TRIGGERS WHERE trigger_name = 'trg4'|
# - Initialize the used variables (actual values don't matter);
--echo
--echo
SET @a1 = '1'|
SET @a2 = '1'|
SET @a3 = '1'|
SET @b1 = '2'|
SET @b2 = '2'|
SET @b3 = '2'|
# - Execute the triggers;
--echo
--echo
INSERT INTO t1 VALUES(1)|
--echo
--echo ---> Log:
SELECT msg FROM log|
--echo
SELECT
COLLATION(@a1) AS ca1,
COLLATION(@a2) AS ca2,
COLLATION(@a3) AS ca3,
COLLATION(@b1) AS cb1,
COLLATION(@b2) AS cb2,
COLLATION(@b3) AS cb3|
--echo
DELETE FROM log|
--echo
--echo
INSERT INTO mysqltest2.t1 VALUES(1)|
--echo
--echo ---> Log:
SELECT msg FROM mysqltest2.log|
--echo
SELECT
COLLATION(@a1) AS ca1,
COLLATION(@a2) AS ca2,
COLLATION(@a3) AS ca3,
COLLATION(@b1) AS cb1,
COLLATION(@b2) AS cb2,
COLLATION(@b3) AS cb3|
--echo
DELETE FROM mysqltest2.log|
# - Check SHOW CREATE statement;
--echo
--echo
SHOW CREATE VIEW v1|
--echo
SHOW CREATE VIEW v2|
# - Check INFORMATION_SCHEMA;
--echo
--echo
SELECT * FROM INFORMATION_SCHEMA.VIEWS WHERE table_name = 'v1'|
--echo
SELECT * FROM INFORMATION_SCHEMA.VIEWS WHERE table_name = 'v2'|
# - Execute the views;
--echo
--echo
SELECT COLLATION(c1), COLLATION(c2) FROM v1|
--echo
SELECT COLLATION(c1) FROM v2|
--require r/have_cp1251.require
--disable_query_log
SHOW COLLATION LIKE 'cp1251_general_ci';
--enable_query_log
--require r/have_cp866.require
--disable_query_log
SHOW COLLATION LIKE 'cp866_general_ci';
--enable_query_log
--require r/have_koi8r.require
--disable_query_log
SHOW COLLATION LIKE 'koi8r_general_ci';
--enable_query_log
--require r/have_utf8.require
--disable_query_log
SHOW COLLATION LIKE 'utf8_general_ci';
--enable_query_log
......@@ -364,7 +364,12 @@ sub mtr_report_stats ($) {
# Bug #28436: Incorrect position in SHOW BINLOG EVENTS causes
# server coredump
/\QError in Log_event::read_log_event(): 'Sanity check failed', data_len: 258, event_type: 49\E/ or
/Statement is not safe to log in statement format/
/Statement is not safe to log in statement format/ or
# Test case for Bug#14233 produces the following warnings:
/Stored routine 'test'.'bug14233_1': invalid value in column mysql.proc/ or
/Stored routine 'test'.'bug14233_2': invalid value in column mysql.proc/ or
/Stored routine 'test'.'bug14233_3': invalid value in column mysql.proc/
)
{
next; # Skip these lines
......
......@@ -980,8 +980,8 @@ Table Create Table
KEY `имя_индекса_в_кодировке_утф8_длиной_больше_чем_48` (`имя_поля_в_кодировке_утф8_длиной_больше_чем_45`)
) ENGINE=MyISAM DEFAULT CHARSET=latin1
show create view имя_вью_кодировке_утф8_длиной_больше_чем_42;
View Create View
имя_вью_кодировке_утф8_длиной_больше_чем_42 CREATE ALGORITHM=UNDEFINED DEFINER=`root`@`localhost` SQL SECURITY DEFINER VIEW `имя_вью_кодировке_утф8_длиной_больше_чем_42` AS select `имя_таблицы_в_кодировке_утф8_длиной_больше_чем_48`.`имя_поля_в_кодировке_утф8_длиной_больше_чем_45` AS `имя_поля_в_кодировке_утф8_длиной_больше_чем_45` from `имя_таблицы_в_кодировке_утф8_длиной_больше_чем_48`
View Create View character_set_client collation_connection
имя_вью_кодировке_утф8_длиной_больше_чем_42 CREATE ALGORITHM=UNDEFINED DEFINER=`root`@`localhost` SQL SECURITY DEFINER VIEW `имя_вью_кодировке_утф8_длиной_больше_чем_42` AS select `имя_таблицы_в_кодировке_утф8_длиной_больше_чем_48`.`имя_поля_в_кодировке_утф8_длиной_больше_чем_45` AS `имя_поля_в_кодировке_утф8_длиной_больше_чем_45` from `имя_таблицы_в_кодировке_утф8_длиной_больше_чем_48` utf8 utf8_general_ci
create event имя_события_в_кодировке_утф8_длиной_больше_чем_48 on schedule every 2 year do select 1;
select EVENT_NAME from information_schema.events
where event_schema='test';
......
......@@ -40,9 +40,9 @@ IN ind DECIMAL(10,2))
BEGIN
INSERT INTO t4 VALUES (ins1, ins2, ind);
END
master-bin.000001 783 Query 1 1002 use `test`; INSERT INTO t4 VALUES ( NAME_CONST('ins1',_latin1 0x466F6F2773206120426172), NAME_CONST('ins2',_cp932 0xED40ED41ED42), NAME_CONST('ind',47.93))
master-bin.000001 1002 Query 1 1091 use `test`; DROP PROCEDURE bug18293
master-bin.000001 1091 Query 1 1170 use `test`; DROP TABLE t4
master-bin.000001 783 Query 1 999 use `test`; INSERT INTO t4 VALUES ( NAME_CONST('ins1',_latin1 0x466F6F2773206120426172), NAME_CONST('ins2',_cp932 0xED40ED41ED42), NAME_CONST('ind',47.93))
master-bin.000001 999 Query 1 1085 use `test`; DROP PROCEDURE bug18293
master-bin.000001 1085 Query 1 1161 use `test`; DROP TABLE t4
End of 5.0 tests
SHOW BINLOG EVENTS FROM 364;
ERROR HY000: Error when executing command SHOW BINLOG EVENTS: Wrong offset or I/O error
......
This source diff could not be displayed because it is too large. You can view the blob instead.
This source diff could not be displayed because it is too large. You can view the blob instead.
This diff is collapsed.
This diff is collapsed.
......@@ -2,8 +2,8 @@ CREATE DATABASE IF NOT EXISTS events_test;
use events_test;
CREATE EVENT one_event ON SCHEDULE EVERY 10 SECOND DO SELECT 123;
SHOW EVENTS;
Db Name Definer Time zone Type Execute at Interval value Interval field Starts Ends Status Originator
events_test one_event root@localhost SYSTEM RECURRING NULL 10 # # NULL ENABLED 1
Db Name Definer Time zone Type Execute at Interval value Interval field Starts Ends Status Originator character_set_client collation_connection Database Collation
events_test one_event root@localhost SYSTEM RECURRING NULL 10 # # NULL ENABLED 1 latin1 latin1_swedish_ci latin1_swedish_ci
SELECT EVENT_CATALOG, EVENT_SCHEMA, EVENT_NAME, DEFINER, EVENT_BODY, EVENT_DEFINITION, EVENT_TYPE, EXECUTE_AT, INTERVAL_VALUE, INTERVAL_FIELD, STATUS,ON_COMPLETION, EVENT_COMMENT FROM INFORMATION_SCHEMA.EVENTS ORDER BY EVENT_SCHEMA, EVENT_NAME;
EVENT_CATALOG EVENT_SCHEMA EVENT_NAME DEFINER EVENT_BODY EVENT_DEFINITION EVENT_TYPE EXECUTE_AT INTERVAL_VALUE INTERVAL_FIELD STATUS ON_COMPLETION EVENT_COMMENT
NULL events_test one_event root@localhost SQL SELECT 123 RECURRING NULL 10 SECOND ENABLED NOT PRESERVE
......@@ -29,8 +29,8 @@ ERROR 42000: Access denied for user 'ev_test'@'localhost' to database 'events_te
USE events_test;
"We should see one event";
SHOW EVENTS;
Db Name Definer Time zone Type Execute at Interval value Interval field Starts Ends Status Originator
events_test one_event root@localhost SYSTEM RECURRING NULL 10 # # NULL ENABLED 1
Db Name Definer Time zone Type Execute at Interval value Interval field Starts Ends Status Originator character_set_client collation_connection Database Collation
events_test one_event root@localhost SYSTEM RECURRING NULL 10 # # NULL ENABLED 1 latin1 latin1_swedish_ci latin1_swedish_ci
SELECT CONCAT("Let's create some new events from the name of ", USER());
CONCAT("Let's create some new events from the name of ", USER())
Let's create some new events from the name of ev_test@localhost
......@@ -40,18 +40,18 @@ CREATE EVENT two_event ON SCHEDULE EVERY 20 SECOND ON COMPLETION NOT PRESERVE CO
CREATE EVENT three_event ON SCHEDULE EVERY 20 SECOND ON COMPLETION PRESERVE COMMENT "three event" DO SELECT 123;
"Now we should see 3 events:";
SHOW EVENTS;
Db Name Definer Time zone Type Execute at Interval value Interval field Starts Ends Status Originator
events_test one_event root@localhost SYSTEM RECURRING NULL 10 # # NULL ENABLED 1
events_test three_event ev_test@localhost SYSTEM RECURRING NULL 20 # # NULL ENABLED 1
events_test two_event ev_test@localhost SYSTEM RECURRING NULL 20 # # NULL ENABLED 1
Db Name Definer Time zone Type Execute at Interval value Interval field Starts Ends Status Originator character_set_client collation_connection Database Collation
events_test one_event root@localhost SYSTEM RECURRING NULL 10 # # NULL ENABLED 1 latin1 latin1_swedish_ci latin1_swedish_ci
events_test three_event ev_test@localhost SYSTEM RECURRING NULL 20 # # NULL ENABLED 1 latin1 latin1_swedish_ci latin1_swedish_ci
events_test two_event ev_test@localhost SYSTEM RECURRING NULL 20 # # NULL ENABLED 1 latin1 latin1_swedish_ci latin1_swedish_ci
"This should show us only 2 events:";
SHOW EVENTS LIKE 't%event';
Db Name Definer Time zone Type Execute at Interval value Interval field Starts Ends Status Originator
events_test three_event ev_test@localhost SYSTEM RECURRING NULL 20 # # NULL ENABLED 1
events_test two_event ev_test@localhost SYSTEM RECURRING NULL 20 # # NULL ENABLED 1
Db Name Definer Time zone Type Execute at Interval value Interval field Starts Ends Status Originator character_set_client collation_connection Database Collation
events_test three_event ev_test@localhost SYSTEM RECURRING NULL 20 # # NULL ENABLED 1 latin1 latin1_swedish_ci latin1_swedish_ci
events_test two_event ev_test@localhost SYSTEM RECURRING NULL 20 # # NULL ENABLED 1 latin1 latin1_swedish_ci latin1_swedish_ci
"This should show us no events:";
SHOW EVENTS FROM test LIKE '%';
Db Name Definer Time zone Type Execute at Interval value Interval field Starts Ends Status Originator
Db Name Definer Time zone Type Execute at Interval value Interval field Starts Ends Status Originator character_set_client collation_connection Database Collation
GRANT EVENT ON events_test2.* TO ev_test@localhost;
USE events_test2;
CREATE EVENT four_event ON SCHEDULE EVERY 20 SECOND DO SELECT 42;
......
......@@ -225,8 +225,8 @@ a
46
CREATE VIEW v1 AS SELECT * FROM t1 WHERE a NOT IN (45);
SHOW CREATE VIEW v1;
View Create View
v1 CREATE ALGORITHM=UNDEFINED DEFINER=`root`@`localhost` SQL SECURITY DEFINER VIEW `v1` AS select `t1`.`a` AS `a` from `t1` where (`t1`.`a` <> 45)
View Create View character_set_client collation_connection
v1 CREATE ALGORITHM=UNDEFINED DEFINER=`root`@`localhost` SQL SECURITY DEFINER VIEW `v1` AS select `t1`.`a` AS `a` from `t1` where (`t1`.`a` <> 45) latin1 latin1_swedish_ci
SELECT * FROM v1;
a
44
......
......@@ -745,10 +745,10 @@ drop table t1;
drop procedure if exists fn3;
create function fn3 () returns point deterministic return GeomFromText("point(1 1)");
show create function fn3;
Function sql_mode Create Function
Function sql_mode Create Function character_set_client collation_connection Database Collation
fn3 CREATE DEFINER=`root`@`localhost` FUNCTION `fn3`() RETURNS point
DETERMINISTIC
return GeomFromText("point(1 1)")
return GeomFromText("point(1 1)") latin1 latin1_swedish_ci latin1_swedish_ci
select astext(fn3());
astext(fn3())
POINT(1 1)
......
......@@ -907,11 +907,11 @@ ERROR 42000: SHOW VIEW command denied to user 'mysqltest_1'@'localhost' for tabl
SHOW CREATE TABLE mysqltest2.v_yn;
ERROR 42000: SHOW VIEW command denied to user 'mysqltest_1'@'localhost' for table 'v_yn'
SHOW CREATE TABLE mysqltest2.v_ny;
View Create View
v_ny CREATE ALGORITHM=UNDEFINED DEFINER=`root`@`localhost` SQL SECURITY DEFINER VIEW `mysqltest2`.`v_ny` AS select `mysqltest2`.`t_nn`.`c1` AS `c1` from `mysqltest2`.`t_nn`
View Create View character_set_client collation_connection
v_ny CREATE ALGORITHM=UNDEFINED DEFINER=`root`@`localhost` SQL SECURITY DEFINER VIEW `mysqltest2`.`v_ny` AS select `mysqltest2`.`t_nn`.`c1` AS `c1` from `mysqltest2`.`t_nn` latin1 latin1_swedish_ci
SHOW CREATE VIEW mysqltest2.v_ny;
View Create View
v_ny CREATE ALGORITHM=UNDEFINED DEFINER=`root`@`localhost` SQL SECURITY DEFINER VIEW `mysqltest2`.`v_ny` AS select `mysqltest2`.`t_nn`.`c1` AS `c1` from `mysqltest2`.`t_nn`
View Create View character_set_client collation_connection
v_ny CREATE ALGORITHM=UNDEFINED DEFINER=`root`@`localhost` SQL SECURITY DEFINER VIEW `mysqltest2`.`v_ny` AS select `mysqltest2`.`t_nn`.`c1` AS `c1` from `mysqltest2`.`t_nn` latin1 latin1_swedish_ci
SHOW CREATE TABLE mysqltest3.t_nn;
ERROR 42000: SELECT command denied to user 'mysqltest_1'@'localhost' for table 't_nn'
SHOW CREATE VIEW mysqltest3.t_nn;
......@@ -928,17 +928,17 @@ t_nn CREATE TABLE `t_nn` (
SHOW CREATE VIEW mysqltest2.t_nn;
ERROR HY000: 'mysqltest2.t_nn' is not VIEW
SHOW CREATE VIEW mysqltest2.v_yy;
View Create View
v_yy CREATE ALGORITHM=UNDEFINED DEFINER=`root`@`localhost` SQL SECURITY DEFINER VIEW `mysqltest2`.`v_yy` AS select `mysqltest2`.`t_nn`.`c1` AS `c1` from `mysqltest2`.`t_nn` where (`mysqltest2`.`t_nn`.`c1` = 55)
View Create View character_set_client collation_connection
v_yy CREATE ALGORITHM=UNDEFINED DEFINER=`root`@`localhost` SQL SECURITY DEFINER VIEW `mysqltest2`.`v_yy` AS select `mysqltest2`.`t_nn`.`c1` AS `c1` from `mysqltest2`.`t_nn` where (`mysqltest2`.`t_nn`.`c1` = 55) latin1 latin1_swedish_ci
SHOW CREATE TABLE mysqltest2.v_yy;
View Create View
v_yy CREATE ALGORITHM=UNDEFINED DEFINER=`root`@`localhost` SQL SECURITY DEFINER VIEW `mysqltest2`.`v_yy` AS select `mysqltest2`.`t_nn`.`c1` AS `c1` from `mysqltest2`.`t_nn` where (`mysqltest2`.`t_nn`.`c1` = 55)
View Create View character_set_client collation_connection
v_yy CREATE ALGORITHM=UNDEFINED DEFINER=`root`@`localhost` SQL SECURITY DEFINER VIEW `mysqltest2`.`v_yy` AS select `mysqltest2`.`t_nn`.`c1` AS `c1` from `mysqltest2`.`t_nn` where (`mysqltest2`.`t_nn`.`c1` = 55) latin1 latin1_swedish_ci
SHOW CREATE TABLE mysqltest2.v_nn;
View Create View
v_nn CREATE ALGORITHM=UNDEFINED DEFINER=`root`@`localhost` SQL SECURITY DEFINER VIEW `v_nn` AS select `t_nn`.`c1` AS `c1` from `t_nn`
View Create View character_set_client collation_connection
v_nn CREATE ALGORITHM=UNDEFINED DEFINER=`root`@`localhost` SQL SECURITY DEFINER VIEW `v_nn` AS select `t_nn`.`c1` AS `c1` from `t_nn` latin1 latin1_swedish_ci
SHOW CREATE VIEW mysqltest2.v_nn;
View Create View
v_nn CREATE ALGORITHM=UNDEFINED DEFINER=`root`@`localhost` SQL SECURITY DEFINER VIEW `v_nn` AS select `t_nn`.`c1` AS `c1` from `t_nn`
View Create View character_set_client collation_connection
v_nn CREATE ALGORITHM=UNDEFINED DEFINER=`root`@`localhost` SQL SECURITY DEFINER VIEW `v_nn` AS select `t_nn`.`c1` AS `c1` from `t_nn` latin1 latin1_swedish_ci
SHOW CREATE TABLE mysqltest2.t_nn;
Table Create Table
t_nn CREATE TABLE `t_nn` (
......
Collation Charset Id Default Compiled Sortlen
cp1251_general_ci cp1251 51 Yes 0
Collation Charset Id Default Compiled Sortlen
cp866_general_ci cp866 36 Yes 0
Collation Charset Id Default Compiled Sortlen
koi8r_general_ci koi8r 7 Yes 0
Collation Charset Id Default Compiled Sortlen
utf8_general_ci utf8 33 Yes Yes 1
This diff is collapsed.
......@@ -132,11 +132,11 @@ show fields from testdb_1.v6;
Field Type Null Key Default Extra
f1 char(4) YES NULL
show create view testdb_1.v6;
View Create View
v6 CREATE ALGORITHM=UNDEFINED DEFINER=`root`@`localhost` SQL SECURITY DEFINER VIEW `v6` AS select `t1`.`f1` AS `f1` from `t1`
View Create View character_set_client collation_connection
v6 CREATE ALGORITHM=UNDEFINED DEFINER=`root`@`localhost` SQL SECURITY DEFINER VIEW `v6` AS select `t1`.`f1` AS `f1` from `t1` latin1 latin1_swedish_ci
show create view testdb_1.v7;
View Create View
v7 CREATE ALGORITHM=UNDEFINED DEFINER=`no_such_user`@`no_such_host` SQL SECURITY DEFINER VIEW `v7` AS select `testdb_1`.`t2`.`f1` AS `f1` from `t2`
View Create View character_set_client collation_connection
v7 CREATE ALGORITHM=UNDEFINED DEFINER=`no_such_user`@`no_such_host` SQL SECURITY DEFINER VIEW `v7` AS select `testdb_1`.`t2`.`f1` AS `f1` from `t2` latin1 latin1_swedish_ci
Warnings:
Warning 1356 View 'testdb_1.v7' references invalid table(s) or column(s) or function(s) or definer/invoker of view lack rights to use them
show fields from testdb_1.v7;
......@@ -153,22 +153,22 @@ show fields from testdb_1.v5;
Field Type Null Key Default Extra
f1 char(4) YES NULL
show create view testdb_1.v5;
View Create View
v5 CREATE ALGORITHM=UNDEFINED DEFINER=`testdb_1`@`localhost` SQL SECURITY DEFINER VIEW `testdb_1`.`v5` AS select `testdb_1`.`t1`.`f1` AS `f1` from `testdb_1`.`t1`
View Create View character_set_client collation_connection
v5 CREATE ALGORITHM=UNDEFINED DEFINER=`testdb_1`@`localhost` SQL SECURITY DEFINER VIEW `testdb_1`.`v5` AS select `testdb_1`.`t1`.`f1` AS `f1` from `testdb_1`.`t1` latin1 latin1_swedish_ci
show fields from testdb_1.v6;
Field Type Null Key Default Extra
f1 char(4) YES NULL
show create view testdb_1.v6;
View Create View
v6 CREATE ALGORITHM=UNDEFINED DEFINER=`root`@`localhost` SQL SECURITY DEFINER VIEW `testdb_1`.`v6` AS select `testdb_1`.`t1`.`f1` AS `f1` from `testdb_1`.`t1`
View Create View character_set_client collation_connection
v6 CREATE ALGORITHM=UNDEFINED DEFINER=`root`@`localhost` SQL SECURITY DEFINER VIEW `testdb_1`.`v6` AS select `testdb_1`.`t1`.`f1` AS `f1` from `testdb_1`.`t1` latin1 latin1_swedish_ci
show fields from testdb_1.v7;
Field Type Null Key Default Extra
f1 null YES NULL
Warnings:
Note 1449 There is no 'no_such_user'@'no_such_host' registered
show create view testdb_1.v7;
View Create View
v7 CREATE ALGORITHM=UNDEFINED DEFINER=`no_such_user`@`no_such_host` SQL SECURITY DEFINER VIEW `v7` AS select `testdb_1`.`t2`.`f1` AS `f1` from `t2`
View Create View character_set_client collation_connection
v7 CREATE ALGORITHM=UNDEFINED DEFINER=`no_such_user`@`no_such_host` SQL SECURITY DEFINER VIEW `v7` AS select `testdb_1`.`t2`.`f1` AS `f1` from `t2` latin1 latin1_swedish_ci
Warnings:
Warning 1356 View 'testdb_1.v7' references invalid table(s) or column(s) or function(s) or definer/invoker of view lack rights to use them
revoke insert(f1) on v3 from testdb_2@localhost;
......@@ -200,8 +200,8 @@ show fields from testdb_1.v1;
Field Type Null Key Default Extra
f1 char(4) YES NULL
show create view v2;
View Create View
v2 CREATE ALGORITHM=UNDEFINED DEFINER=`testdb_2`@`localhost` SQL SECURITY DEFINER VIEW `test`.`v2` AS select `v1`.`f1` AS `f1` from `testdb_1`.`v1`
View Create View character_set_client collation_connection
v2 CREATE ALGORITHM=UNDEFINED DEFINER=`testdb_2`@`localhost` SQL SECURITY DEFINER VIEW `test`.`v2` AS select `v1`.`f1` AS `f1` from `testdb_1`.`v1` latin1 latin1_swedish_ci
show create view testdb_1.v1;
ERROR 42000: SHOW VIEW command denied to user 'testdb_2'@'localhost' for table 'v1'
select table_name from information_schema.columns a
......@@ -211,7 +211,7 @@ v2
select view_definition from information_schema.views a
where a.table_name = 'v2';
view_definition
/* ALGORITHM=UNDEFINED */ select `v1`.`f1` AS `f1` from `testdb_1`.`v1`
select f1 from testdb_1.v1
select view_definition from information_schema.views a
where a.table_name = 'testdb_1.v1';
view_definition
......
......@@ -6,8 +6,8 @@ use MySQLTest;
create table TaB (Field int);
create view ViE as select * from TAb;
show create table VIe;
View Create View
vie CREATE ALGORITHM=UNDEFINED DEFINER=`root`@`localhost` SQL SECURITY DEFINER VIEW `vie` AS select `tab`.`Field` AS `Field` from `tab`
View Create View character_set_client collation_connection
vie CREATE ALGORITHM=UNDEFINED DEFINER=`root`@`localhost` SQL SECURITY DEFINER VIEW `vie` AS select `tab`.`Field` AS `Field` from `tab` latin1 latin1_swedish_ci
drop database MySQLTest;
use test;
create table t1Aa (col1 int);
......@@ -118,8 +118,8 @@ drop table t1Aa,t2Aa;
create table t1Aa (col1 int);
create view v1Aa as select col1 from t1Aa as AaA;
show create view v1AA;
View Create View
v1aa CREATE ALGORITHM=UNDEFINED DEFINER=`root`@`localhost` SQL SECURITY DEFINER VIEW `v1aa` AS select `aaa`.`col1` AS `col1` from `t1aa` `AaA`
View Create View character_set_client collation_connection
v1aa CREATE ALGORITHM=UNDEFINED DEFINER=`root`@`localhost` SQL SECURITY DEFINER VIEW `v1aa` AS select `aaa`.`col1` AS `col1` from `t1aa` `AaA` latin1 latin1_swedish_ci
drop view v1AA;
select Aaa.col1 from t1Aa as AaA;
col1
......@@ -127,7 +127,7 @@ create view v1Aa as select Aaa.col1 from t1Aa as AaA;
drop view v1AA;
create view v1Aa as select AaA.col1 from t1Aa as AaA;
show create view v1AA;
View Create View
v1aa CREATE ALGORITHM=UNDEFINED DEFINER=`root`@`localhost` SQL SECURITY DEFINER VIEW `v1aa` AS select `aaa`.`col1` AS `col1` from `t1aa` `AaA`
View Create View character_set_client collation_connection
v1aa CREATE ALGORITHM=UNDEFINED DEFINER=`root`@`localhost` SQL SECURITY DEFINER VIEW `v1aa` AS select `aaa`.`col1` AS `col1` from `t1aa` `AaA` latin1 latin1_swedish_ci
drop view v1AA;
drop table t1Aa;
This diff is collapsed.
......@@ -31,12 +31,12 @@ select @test_var;
10
alter procedure test_proc1 comment 'new comment';
show create procedure test_proc1;
Procedure sql_mode Create Procedure
Procedure sql_mode Create Procedure Client_cs Connection_cl Database_cl
test_proc1 CREATE DEFINER=`root`@`localhost` PROCEDURE `test_proc1`(in var_in int)
COMMENT 'new comment'
begin
select * from t1 where a = var_in;
end
end latin1 latin1_swedish_ci latin1_swedish_ci
drop procedure test_proc1;
drop procedure test_proc2;
drop procedure test_proc3;
......
This diff is collapsed.
......@@ -87,27 +87,27 @@ Tables_in_test
t1
t2
show triggers;
Trigger Event Table Statement Timing Created sql_mode Definer
trg1 INSERT t1 set new.b=2 BEFORE NULL root@localhost
trg2 INSERT t2 set new.b=2 BEFORE NULL root@localhost
Trigger Event Table Statement Timing Created sql_mode Definer character_set_client collation_connection Database Collation
trg1 INSERT t1 set new.b=2 BEFORE NULL root@localhost latin1 latin1_swedish_ci latin1_swedish_ci
trg2 INSERT t2 set new.b=2 BEFORE NULL root@localhost latin1 latin1_swedish_ci latin1_swedish_ci
*** slave ***
show tables;
Tables_in_test
t1
show triggers;
Trigger Event Table Statement Timing Created sql_mode Definer
trg1 INSERT t1 set new.b=2 BEFORE NULL root@localhost
Trigger Event Table Statement Timing Created sql_mode Definer character_set_client collation_connection Database Collation
trg1 INSERT t1 set new.b=2 BEFORE NULL root@localhost latin1 latin1_swedish_ci latin1_swedish_ci
*** master ***
drop trigger trg1;
drop trigger trg2;
show triggers;
Trigger Event Table Statement Timing Created sql_mode Definer
Trigger Event Table Statement Timing Created sql_mode Definer character_set_client collation_connection Database Collation
*** slave ***
show tables;
Tables_in_test
t1
show triggers;
Trigger Event Table Statement Timing Created sql_mode Definer
Trigger Event Table Statement Timing Created sql_mode Definer character_set_client collation_connection Database Collation
*** master ***
drop table t1;
drop table t2;
......@@ -17,21 +17,31 @@ insert into t1 values (b);
insert into t1 values (unix_timestamp());
end|
select * from mysql.proc where name='foo' and db='mysqltest1';
db name type specific_name language sql_data_access is_deterministic security_type param_list returns body definer created modified sql_mode comment
db name type specific_name language sql_data_access is_deterministic security_type param_list returns body definer created modified sql_mode comment character_set_client collation_connection db_collation body_utf8
mysqltest1 foo PROCEDURE foo SQL CONTAINS_SQL NO DEFINER begin
declare b int;
set b = 8;
insert into t1 values (b);
insert into t1 values (unix_timestamp());
end root@localhost # #
end root@localhost # # latin1 latin1_swedish_ci latin1_swedish_ci begin
declare b int;
set b = 8;
insert into t1 values (b);
insert into t1 values (unix_timestamp());
end
select * from mysql.proc where name='foo' and db='mysqltest1';
db name type specific_name language sql_data_access is_deterministic security_type param_list returns body definer created modified sql_mode comment
db name type specific_name language sql_data_access is_deterministic security_type param_list returns body definer created modified sql_mode comment character_set_client collation_connection db_collation body_utf8
mysqltest1 foo PROCEDURE foo SQL CONTAINS_SQL NO DEFINER begin
declare b int;
set b = 8;
insert into t1 values (b);
insert into t1 values (unix_timestamp());
end root@localhost # #
end root@localhost # # latin1 latin1_swedish_ci latin1_swedish_ci begin
declare b int;
set b = 8;
insert into t1 values (b);
insert into t1 values (unix_timestamp());
end
set timestamp=1000000000;
call foo();
select * from t1;
......@@ -115,15 +125,17 @@ select * from t2;
a
20
select * from mysql.proc where name="foo4" and db='mysqltest1';
db name type specific_name language sql_data_access is_deterministic security_type param_list returns body definer created modified sql_mode comment
db name type specific_name language sql_data_access is_deterministic security_type param_list returns body definer created modified sql_mode comment character_set_client collation_connection db_collation body_utf8
mysqltest1 foo4 PROCEDURE foo4 SQL CONTAINS_SQL YES DEFINER begin
insert into t2 values(20),(20);
end root@localhost # #
end root@localhost # # latin1 latin1_swedish_ci latin1_swedish_ci begin
insert into t2 values(20),(20);
end
drop procedure foo4;
select * from mysql.proc where name="foo4" and db='mysqltest1';
db name type specific_name language sql_data_access is_deterministic security_type param_list returns body definer created modified sql_mode comment
db name type specific_name language sql_data_access is_deterministic security_type param_list returns body definer created modified sql_mode comment character_set_client collation_connection db_collation body_utf8
select * from mysql.proc where name="foo4" and db='mysqltest1';
db name type specific_name language sql_data_access is_deterministic security_type param_list returns body definer created modified sql_mode comment
db name type specific_name language sql_data_access is_deterministic security_type param_list returns body definer created modified sql_mode comment character_set_client collation_connection db_collation body_utf8
drop procedure foo;
drop procedure foo2;
drop procedure foo3;
......@@ -202,16 +214,22 @@ select fn3();
fn3()
0
select * from mysql.proc where db='mysqltest1';
db name type specific_name language sql_data_access is_deterministic security_type param_list returns body definer created modified sql_mode comment
db name type specific_name language sql_data_access is_deterministic security_type param_list returns body definer created modified sql_mode comment character_set_client collation_connection db_collation body_utf8
mysqltest1 fn1 FUNCTION fn1 SQL NO_SQL NO DEFINER int(11) begin
return unix_timestamp();
end root@localhost # #
end root@localhost # # latin1 latin1_swedish_ci latin1_swedish_ci begin
return unix_timestamp();
end
mysqltest1 fn2 FUNCTION fn2 SQL NO_SQL NO DEFINER int(11) begin
return unix_timestamp();
end zedjzlcsjhd@localhost # #
end zedjzlcsjhd@localhost # # latin1 latin1_swedish_ci latin1_swedish_ci begin
return unix_timestamp();
end
mysqltest1 fn3 FUNCTION fn3 SQL READS_SQL_DATA NO DEFINER int(11) begin
return 0;
end root@localhost # #
end root@localhost # # latin1 latin1_swedish_ci latin1_swedish_ci begin
return 0;
end
select * from t1;
a
1000000000
......@@ -220,16 +238,22 @@ select * from t1;
a
1000000000
select * from mysql.proc where db='mysqltest1';
db name type specific_name language sql_data_access is_deterministic security_type param_list returns body definer created modified sql_mode comment
db name type specific_name language sql_data_access is_deterministic security_type param_list returns body definer created modified sql_mode comment character_set_client collation_connection db_collation body_utf8
mysqltest1 fn1 FUNCTION fn1 SQL NO_SQL NO DEFINER int(11) begin
return unix_timestamp();
end root@localhost # #
end root@localhost # # latin1 latin1_swedish_ci latin1_swedish_ci begin
return unix_timestamp();
end
mysqltest1 fn2 FUNCTION fn2 SQL NO_SQL NO DEFINER int(11) begin
return unix_timestamp();
end zedjzlcsjhd@localhost # #
end zedjzlcsjhd@localhost # # latin1 latin1_swedish_ci latin1_swedish_ci begin
return unix_timestamp();
end
mysqltest1 fn3 FUNCTION fn3 SQL READS_SQL_DATA NO DEFINER int(11) begin
return 0;
end root@localhost # #
end root@localhost # # latin1 latin1_swedish_ci latin1_swedish_ci begin
return 0;
end
delete from t2;
alter table t2 add unique (a);
drop function fn1;
......@@ -337,26 +361,26 @@ DROP FUNCTION IF EXISTS f1;
---> Checking on master...
SHOW CREATE PROCEDURE p1;
Procedure sql_mode Create Procedure
Procedure sql_mode Create Procedure character_set_client collation_connection Database Collation
p1 CREATE DEFINER=`root`@`localhost` PROCEDURE `p1`()
SET @a = 1
SET @a = 1 latin1 latin1_swedish_ci latin1_swedish_ci
SHOW CREATE FUNCTION f1;
Function sql_mode Create Function
Function sql_mode Create Function character_set_client collation_connection Database Collation
f1 CREATE DEFINER=`root`@`localhost` FUNCTION `f1`() RETURNS int(11)
RETURN 0
RETURN 0 latin1 latin1_swedish_ci latin1_swedish_ci
---> Synchronizing slave with master...
---> connection: master
---> Checking on slave...
SHOW CREATE PROCEDURE p1;
Procedure sql_mode Create Procedure
Procedure sql_mode Create Procedure character_set_client collation_connection Database Collation
p1 CREATE DEFINER=`root`@`localhost` PROCEDURE `p1`()
SET @a = 1
SET @a = 1 latin1 latin1_swedish_ci latin1_swedish_ci
SHOW CREATE FUNCTION f1;
Function sql_mode Create Function
Function sql_mode Create Function character_set_client collation_connection Database Collation
f1 CREATE DEFINER=`root`@`localhost` FUNCTION `f1`() RETURNS int(11)
RETURN 0
RETURN 0 latin1 latin1_swedish_ci latin1_swedish_ci
---> connection: master
......
......@@ -868,8 +868,8 @@ Tables_in_test (t_)
t1
t2
SHOW TRIGGERS;
Trigger Event Table Statement Timing Created sql_mode Definer
trg1 INSERT t1 INSERT INTO t2 VALUES(CURRENT_USER()) AFTER NULL
Trigger Event Table Statement Timing Created sql_mode Definer character_set_client collation_connection Database Collation
trg1 INSERT t1 INSERT INTO t2 VALUES(CURRENT_USER()) AFTER NULL latin1 latin1_swedish_ci latin1_swedish_ci
SELECT * FROM t1;
c
1
......@@ -895,7 +895,7 @@ RESET SLAVE;
SHOW TABLES LIKE 't_';
Tables_in_test (t_)
SHOW TRIGGERS;
Trigger Event Table Statement Timing Created sql_mode Definer
Trigger Event Table Statement Timing Created sql_mode Definer character_set_client collation_connection Database Collation
RESET MASTER;
START SLAVE;
......
......@@ -88,8 +88,8 @@ Field Type Null Key Default Extra
a int(11) YES NULL
b decimal(32,0) YES NULL
show create table v1;
View Create View
v1 CREATE ALGORITHM=UNDEFINED DEFINER=`root`@`localhost` SQL SECURITY DEFINER VIEW `v1` AS select `t1`.`a` AS `a`,sum(`t1`.`b`) AS `b` from `t1` group by `t1`.`a`
View Create View character_set_client collation_connection
v1 CREATE ALGORITHM=UNDEFINED DEFINER=`root`@`localhost` SQL SECURITY DEFINER VIEW `v1` AS select `t1`.`a` AS `a`,sum(`t1`.`b`) AS `b` from `t1` group by `t1`.`a` latin1 latin1_swedish_ci
select * from v1;
a b
1 6
......
This diff is collapsed.
......@@ -35,16 +35,16 @@ SELECT 3;
CREATE DEFINER=a@'' FUNCTION f3() RETURNS INT
RETURN 3;
SHOW CREATE VIEW v3;
View Create View
v3 CREATE ALGORITHM=UNDEFINED DEFINER=`a`@`` SQL SECURITY DEFINER VIEW `v3` AS select `t1`.`c` AS `c` from `t1`
View Create View character_set_client collation_connection
v3 CREATE ALGORITHM=UNDEFINED DEFINER=`a`@`` SQL SECURITY DEFINER VIEW `v3` AS select `t1`.`c` AS `c` from `t1` latin1 latin1_swedish_ci
SHOW CREATE PROCEDURE p3;
Procedure sql_mode Create Procedure
Procedure sql_mode Create Procedure character_set_client collation_connection Database Collation
p3 CREATE DEFINER=`a`@`` PROCEDURE `p3`()
SELECT 3
SELECT 3 latin1 latin1_swedish_ci latin1_swedish_ci
SHOW CREATE FUNCTION f3;
Function sql_mode Create Function
Function sql_mode Create Function character_set_client collation_connection Database Collation
f3 CREATE DEFINER=`a`@`` FUNCTION `f3`() RETURNS int(11)
RETURN 3
RETURN 3 latin1 latin1_swedish_ci latin1_swedish_ci
DROP TRIGGER t1_bi;
DROP TRIGGER ti_ai;
DROP TRIGGER ti_bu;
......
......@@ -37,26 +37,33 @@ insert into mysql.proc
(
db, name, type, specific_name, language, sql_data_access, is_deterministic,
security_type, param_list, returns, body, definer, created, modified,
sql_mode, comment
sql_mode, comment, character_set_client, collation_connection, db_collation,
body_utf8
)
values
(
'test', 'bug14233_1', 'FUNCTION', 'bug14233_1', 'SQL', 'READS_SQL_DATA', 'NO',
'DEFINER', '', 'int(10)',
'select count(*) from mysql.user',
'root@localhost', NOW() , '0000-00-00 00:00:00', '', ''
'root@localhost', NOW() , '0000-00-00 00:00:00', '', '',
'', '', '',
'select count(*) from mysql.user'
),
(
'test', 'bug14233_2', 'FUNCTION', 'bug14233_2', 'SQL', 'READS_SQL_DATA', 'NO',
'DEFINER', '', 'int(10)',
'begin declare x int; select count(*) into x from mysql.user; end',
'root@localhost', NOW() , '0000-00-00 00:00:00', '', ''
'root@localhost', NOW() , '0000-00-00 00:00:00', '', '',
'', '', '',
'begin declare x int; select count(*) into x from mysql.user; end'
),
(
'test', 'bug14233_3', 'PROCEDURE', 'bug14233_3', 'SQL', 'READS_SQL_DATA','NO',
'DEFINER', '', '',
'alksj wpsj sa ^#!@ ',
'root@localhost', NOW() , '0000-00-00 00:00:00', '', ''
'root@localhost', NOW() , '0000-00-00 00:00:00', '', '',
'', '', '',
'alksj wpsj sa ^#!@ '
);
select bug14233_1();
ERROR HY000: Failed to load routine test.bug14233_1. The table mysql.proc is missing, corrupt, or contains bad data (internal code -6)
......@@ -78,6 +85,6 @@ drop function bug14233_1;
drop function bug14233_2;
drop procedure bug14233_3;
show procedure status;
Db Name Type Definer Modified Created Security_type Comment
Db Name Type Definer Modified Created Security_type Comment character_set_client collation_connection Database Collation
show function status;
Db Name Type Definer Modified Created Security_type Comment
Db Name Type Definer Modified Created Security_type Comment character_set_client collation_connection Database Collation
......@@ -682,8 +682,8 @@ create procedure bug17015_012345678901234567890123456789012345678901234567890123
begin
end|
show procedure status like 'bug17015%'|
Db Name Type Definer Modified Created Security_type Comment
test bug17015_0123456789012345678901234567890123456789012345678901234 PROCEDURE root@localhost 0000-00-00 00:00:00 0000-00-00 00:00:00 DEFINER
Db Name Type Definer Modified Created Security_type Comment character_set_client collation_connection Database Collation
test bug17015_0123456789012345678901234567890123456789012345678901234 PROCEDURE root@localhost 0000-00-00 00:00:00 0000-00-00 00:00:00 DEFINER latin1 latin1_swedish_ci latin1_swedish_ci
drop procedure bug17015_0123456789012345678901234567890123456789012345678901234|
drop procedure if exists bug10969|
create procedure bug10969()
......@@ -1087,8 +1087,8 @@ create procedure p2() select version();
ERROR 3D000: No database selected
use mysqltest2;
show procedure status;
Db Name Type Definer Modified Created Security_type Comment
mysqltest2 p1 PROCEDURE root@localhost 0000-00-00 00:00:00 0000-00-00 00:00:00 DEFINER
Db Name Type Definer Modified Created Security_type Comment character_set_client collation_connection Database Collation
mysqltest2 p1 PROCEDURE root@localhost 0000-00-00 00:00:00 0000-00-00 00:00:00 DEFINER latin1 latin1_swedish_ci latin1_swedish_ci
drop database mysqltest2;
use test;
DROP FUNCTION IF EXISTS bug13012|
......@@ -1177,8 +1177,8 @@ call ` bug15658`();
1
1
show procedure status;
Db Name Type Definer Modified Created Security_type Comment
test bug15658 PROCEDURE root@localhost 0000-00-00 00:00:00 0000-00-00 00:00:00 DEFINER
Db Name Type Definer Modified Created Security_type Comment character_set_client collation_connection Database Collation
test bug15658 PROCEDURE root@localhost 0000-00-00 00:00:00 0000-00-00 00:00:00 DEFINER latin1 latin1_swedish_ci latin1_swedish_ci
drop procedure ` bug15658`;
drop function if exists bug14270;
drop table if exists t1;
......
......@@ -12,8 +12,8 @@ insert into t1 values('test', 0);
create procedure stamp(i int)
insert into db1_secret.t1 values (user(), i);
show procedure status like 'stamp';
Db Name Type Definer Modified Created Security_type Comment
db1_secret stamp PROCEDURE root@localhost 0000-00-00 00:00:00 0000-00-00 00:00:00 DEFINER
Db Name Type Definer Modified Created Security_type Comment character_set_client collation_connection Database Collation
db1_secret stamp PROCEDURE root@localhost 0000-00-00 00:00:00 0000-00-00 00:00:00 DEFINER latin1 latin1_swedish_ci latin1_swedish_ci
create function db() returns varchar(64)
begin
declare v varchar(64);
......@@ -21,8 +21,8 @@ select u into v from t1 limit 1;
return v;
end|
show function status like 'db';
Db Name Type Definer Modified Created Security_type Comment
db1_secret db FUNCTION root@localhost 0000-00-00 00:00:00 0000-00-00 00:00:00 DEFINER
Db Name Type Definer Modified Created Security_type Comment character_set_client collation_connection Database Collation
db1_secret db FUNCTION root@localhost 0000-00-00 00:00:00 0000-00-00 00:00:00 DEFINER latin1 latin1_swedish_ci latin1_swedish_ci
call stamp(1);
select * from t1;
u i
......@@ -71,12 +71,12 @@ user1@localhost 2
anon@localhost 3
alter procedure stamp sql security invoker;
show procedure status like 'stamp';
Db Name Type Definer Modified Created Security_type Comment
db1_secret stamp PROCEDURE root@localhost 0000-00-00 00:00:00 0000-00-00 00:00:00 INVOKER
Db Name Type Definer Modified Created Security_type Comment character_set_client collation_connection Database Collation
db1_secret stamp PROCEDURE root@localhost 0000-00-00 00:00:00 0000-00-00 00:00:00 INVOKER latin1 latin1_swedish_ci latin1_swedish_ci
alter function db sql security invoker;
show function status like 'db';
Db Name Type Definer Modified Created Security_type Comment
db1_secret db FUNCTION root@localhost 0000-00-00 00:00:00 0000-00-00 00:00:00 INVOKER
Db Name Type Definer Modified Created Security_type Comment character_set_client collation_connection Database Collation
db1_secret db FUNCTION root@localhost 0000-00-00 00:00:00 0000-00-00 00:00:00 INVOKER latin1 latin1_swedish_ci latin1_swedish_ci
call stamp(4);
select * from t1;
u i
......@@ -365,21 +365,21 @@ Note 1449 There is no 'a @ b @ c'@'localhost' registered
---> connection: con1root
use mysqltest;
SHOW CREATE PROCEDURE wl2897_p1;
Procedure sql_mode Create Procedure
Procedure sql_mode Create Procedure character_set_client collation_connection Database Collation
wl2897_p1 CREATE DEFINER=`mysqltest_2`@`localhost` PROCEDURE `wl2897_p1`()
SELECT 1
SELECT 1 latin1 latin1_swedish_ci latin1_swedish_ci
SHOW CREATE PROCEDURE wl2897_p3;
Procedure sql_mode Create Procedure
Procedure sql_mode Create Procedure character_set_client collation_connection Database Collation
wl2897_p3 CREATE DEFINER=`a @ b @ c`@`localhost` PROCEDURE `wl2897_p3`()
SELECT 3
SELECT 3 latin1 latin1_swedish_ci latin1_swedish_ci
SHOW CREATE FUNCTION wl2897_f1;
Function sql_mode Create Function
Function sql_mode Create Function character_set_client collation_connection Database Collation
wl2897_f1 CREATE DEFINER=`mysqltest_2`@`localhost` FUNCTION `wl2897_f1`() RETURNS int(11)
RETURN 1
RETURN 1 latin1 latin1_swedish_ci latin1_swedish_ci
SHOW CREATE FUNCTION wl2897_f3;
Function sql_mode Create Function
Function sql_mode Create Function character_set_client collation_connection Database Collation
wl2897_f3 CREATE DEFINER=`a @ b @ c`@`localhost` FUNCTION `wl2897_f3`() RETURNS int(11)
RETURN 3
RETURN 3 latin1 latin1_swedish_ci latin1_swedish_ci
DROP USER mysqltest_1@localhost;
DROP USER mysqltest_2@localhost;
DROP DATABASE mysqltest;
......@@ -443,14 +443,14 @@ SET a=1;
SELECT a;
END //
SHOW CREATE PROCEDURE test.sp19857;
Procedure sql_mode Create Procedure
Procedure sql_mode Create Procedure character_set_client collation_connection Database Collation
sp19857 CREATE DEFINER=`user19857`@`localhost` PROCEDURE `sp19857`()
DETERMINISTIC
BEGIN
DECLARE a INT;
SET a=1;
SELECT a;
END
END latin1 latin1_swedish_ci latin1_swedish_ci
DROP PROCEDURE IF EXISTS test.sp19857;
---> connection: root
......
This diff is collapsed.
......@@ -426,37 +426,37 @@ a\b a\'b a"\b a"\'b
SET @@SQL_MODE='';
create function `foo` () returns int return 5;
show create function `foo`;
Function sql_mode Create Function
Function sql_mode Create Function character_set_client collation_connection Database Collation
foo CREATE DEFINER=`root`@`localhost` FUNCTION `foo`() RETURNS int(11)
return 5
return 5 latin1 latin1_swedish_ci latin1_swedish_ci
SET @@SQL_MODE='ANSI_QUOTES';
show create function `foo`;
Function sql_mode Create Function
Function sql_mode Create Function character_set_client collation_connection Database Collation
foo CREATE DEFINER=`root`@`localhost` FUNCTION `foo`() RETURNS int(11)
return 5
return 5 latin1 latin1_swedish_ci latin1_swedish_ci
drop function `foo`;
create function `foo` () returns int return 5;
show create function `foo`;
Function sql_mode Create Function
Function sql_mode Create Function character_set_client collation_connection Database Collation
foo ANSI_QUOTES CREATE DEFINER="root"@"localhost" FUNCTION "foo"() RETURNS int(11)
return 5
return 5 latin1 latin1_swedish_ci latin1_swedish_ci
SET @@SQL_MODE='';
show create function `foo`;
Function sql_mode Create Function
Function sql_mode Create Function character_set_client collation_connection Database Collation
foo ANSI_QUOTES CREATE DEFINER="root"@"localhost" FUNCTION "foo"() RETURNS int(11)
return 5
return 5 latin1 latin1_swedish_ci latin1_swedish_ci
drop function `foo`;
SET @@SQL_MODE='';
create table t1 (a int);
create table t2 (a int);
create view v1 as select a from t1;
show create view v1;
View Create View
v1 CREATE ALGORITHM=UNDEFINED DEFINER=`root`@`localhost` SQL SECURITY DEFINER VIEW `v1` AS select `t1`.`a` AS `a` from `t1`
View Create View character_set_client collation_connection
v1 CREATE ALGORITHM=UNDEFINED DEFINER=`root`@`localhost` SQL SECURITY DEFINER VIEW `v1` AS select `t1`.`a` AS `a` from `t1` latin1 latin1_swedish_ci
SET @@SQL_MODE='ANSI_QUOTES';
show create view v1;
View Create View
v1 CREATE ALGORITHM=UNDEFINED DEFINER="root"@"localhost" SQL SECURITY DEFINER VIEW "v1" AS select "t1"."a" AS "a" from "t1"
View Create View character_set_client collation_connection
v1 CREATE ALGORITHM=UNDEFINED DEFINER="root"@"localhost" SQL SECURITY DEFINER VIEW "v1" AS select "t1"."a" AS "a" from "t1" latin1 latin1_swedish_ci
create view v2 as select a from t2 where a in (select a from v1);
drop view v2, v1;
drop table t1, t2;
......
......@@ -203,6 +203,10 @@ proc CREATE TABLE `proc` (
`modified` timestamp NOT NULL DEFAULT '0000-00-00 00:00:00',
`sql_mode` set('REAL_AS_FLOAT','PIPES_AS_CONCAT','ANSI_QUOTES','IGNORE_SPACE','NOT_USED','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','HIGH_NOT_PRECEDENCE') NOT NULL DEFAULT '',
`comment` char(64) CHARACTER SET utf8 COLLATE utf8_bin NOT NULL DEFAULT '',
`character_set_client` char(32) CHARACTER SET utf8 COLLATE utf8_bin DEFAULT NULL,
`collation_connection` char(32) CHARACTER SET utf8 COLLATE utf8_bin DEFAULT NULL,
`db_collation` char(32) CHARACTER SET utf8 COLLATE utf8_bin DEFAULT NULL,
`body_utf8` longblob,
PRIMARY KEY (`db`,`name`,`type`)
) ENGINE=MyISAM DEFAULT CHARSET=utf8 COMMENT='Stored Procedures'
show create table event;
......@@ -226,6 +230,10 @@ event CREATE TABLE `event` (
`comment` char(64) CHARACTER SET utf8 COLLATE utf8_bin NOT NULL DEFAULT '',
`originator` int(10) NOT NULL,
`time_zone` char(64) CHARACTER SET latin1 NOT NULL DEFAULT 'SYSTEM',
`character_set_client` char(32) CHARACTER SET utf8 COLLATE utf8_bin DEFAULT NULL,
`collation_connection` char(32) CHARACTER SET utf8 COLLATE utf8_bin DEFAULT NULL,
`db_collation` char(32) CHARACTER SET utf8 COLLATE utf8_bin DEFAULT NULL,
`body_utf8` longblob,
PRIMARY KEY (`db`,`name`)
) ENGINE=MyISAM DEFAULT CHARSET=utf8 COMMENT='Events'
show create table general_log;
......
......@@ -111,8 +111,8 @@ v1 CREATE TEMPORARY TABLE `v1` (
`A` varchar(19) NOT NULL DEFAULT ''
) ENGINE=MyISAM DEFAULT CHARSET=latin1
show create view v1;
View Create View
v1 CREATE ALGORITHM=UNDEFINED DEFINER=`root`@`localhost` SQL SECURITY DEFINER VIEW `v1` AS select _latin1'This is view' AS `A`
View Create View character_set_client collation_connection
v1 CREATE ALGORITHM=UNDEFINED DEFINER=`root`@`localhost` SQL SECURITY DEFINER VIEW `v1` AS select _latin1'This is view' AS `A` latin1 latin1_swedish_ci
drop view v1;
select * from v1;
A
......
......@@ -32,9 +32,9 @@ Warnings:
Warning 1454 No definer attribute for trigger 'mysqltest_db1'.'wl2818_trg1'. The trigger will be activated under the authorization of the invoker, which may have insufficient privileges. Please recreate the trigger.
SELECT * FROM INFORMATION_SCHEMA.TRIGGERS ORDER BY trigger_name;
TRIGGER_CATALOG TRIGGER_SCHEMA TRIGGER_NAME EVENT_MANIPULATION EVENT_OBJECT_CATALOG EVENT_OBJECT_SCHEMA EVENT_OBJECT_TABLE ACTION_ORDER ACTION_CONDITION ACTION_STATEMENT ACTION_ORIENTATION ACTION_TIMING ACTION_REFERENCE_OLD_TABLE ACTION_REFERENCE_NEW_TABLE ACTION_REFERENCE_OLD_ROW ACTION_REFERENCE_NEW_ROW CREATED SQL_MODE DEFINER
NULL mysqltest_db1 wl2818_trg1 INSERT NULL mysqltest_db1 t1 0 NULL INSERT INTO t2 VALUES(CURRENT_USER()) ROW BEFORE NULL NULL OLD NEW NULL
NULL mysqltest_db1 wl2818_trg2 INSERT NULL mysqltest_db1 t1 0 NULL INSERT INTO t2 VALUES(CURRENT_USER()) ROW AFTER NULL NULL OLD NEW NULL mysqltest_dfn@localhost
TRIGGER_CATALOG TRIGGER_SCHEMA TRIGGER_NAME EVENT_MANIPULATION EVENT_OBJECT_CATALOG EVENT_OBJECT_SCHEMA EVENT_OBJECT_TABLE ACTION_ORDER ACTION_CONDITION ACTION_STATEMENT ACTION_ORIENTATION ACTION_TIMING ACTION_REFERENCE_OLD_TABLE ACTION_REFERENCE_NEW_TABLE ACTION_REFERENCE_OLD_ROW ACTION_REFERENCE_NEW_ROW CREATED SQL_MODE DEFINER CHARACTER_SET_CLIENT COLLATION_CONNECTION DATABASE_COLLATION
NULL mysqltest_db1 wl2818_trg1 INSERT NULL mysqltest_db1 t1 0 NULL INSERT INTO t2 VALUES(CURRENT_USER()) ROW BEFORE NULL NULL OLD NEW NULL latin1 latin1_swedish_ci latin1_swedish_ci
NULL mysqltest_db1 wl2818_trg2 INSERT NULL mysqltest_db1 t1 0 NULL INSERT INTO t2 VALUES(CURRENT_USER()) ROW AFTER NULL NULL OLD NEW NULL mysqltest_dfn@localhost latin1 latin1_swedish_ci latin1_swedish_ci
DROP TRIGGER wl2818_trg1;
Warnings:
Warning 1454 No definer attribute for trigger 'mysqltest_db1'.'wl2818_trg1'. The trigger will be activated under the authorization of the invoker, which may have insufficient privileges. Please recreate the trigger.
......
......@@ -137,9 +137,9 @@ Note 1449 There is no 'mysqltest_nonexs'@'localhost' registered
INSERT INTO t1 VALUES(6);
ERROR HY000: There is no 'mysqltest_nonexs'@'localhost' registered
SHOW TRIGGERS;
Trigger Event Table Statement Timing Created sql_mode Definer
trg1 INSERT t1 SET @new_sum = 0 BEFORE NULL mysqltest_inv@localhost
trg2 INSERT t1 SET @new_sum = 0 AFTER NULL mysqltest_nonexs@localhost
Trigger Event Table Statement Timing Created sql_mode Definer character_set_client collation_connection Database Collation
trg1 INSERT t1 SET @new_sum = 0 BEFORE NULL mysqltest_inv@localhost latin1 latin1_swedish_ci latin1_swedish_ci
trg2 INSERT t1 SET @new_sum = 0 AFTER NULL mysqltest_nonexs@localhost latin1 latin1_swedish_ci latin1_swedish_ci
DROP TRIGGER trg1;
DROP TRIGGER trg2;
CREATE TRIGGER trg1 BEFORE INSERT ON t1
......@@ -169,12 +169,12 @@ Warnings:
Warning 1454 No definer attribute for trigger 'mysqltest_db1'.'trg1'. The trigger will be activated under the authorization of the invoker, which may have insufficient privileges. Please recreate the trigger.
SELECT * FROM INFORMATION_SCHEMA.TRIGGERS ORDER BY trigger_name;
TRIGGER_CATALOG TRIGGER_SCHEMA TRIGGER_NAME EVENT_MANIPULATION EVENT_OBJECT_CATALOG EVENT_OBJECT_SCHEMA EVENT_OBJECT_TABLE ACTION_ORDER ACTION_CONDITION ACTION_STATEMENT ACTION_ORIENTATION ACTION_TIMING ACTION_REFERENCE_OLD_TABLE ACTION_REFERENCE_NEW_TABLE ACTION_REFERENCE_OLD_ROW ACTION_REFERENCE_NEW_ROW CREATED SQL_MODE DEFINER
NULL mysqltest_db1 trg1 INSERT NULL mysqltest_db1 t1 0 NULL SET @a = 1 ROW BEFORE NULL NULL OLD NEW NULL
NULL mysqltest_db1 trg2 INSERT NULL mysqltest_db1 t1 0 NULL SET @a = 2 ROW AFTER NULL NULL OLD NEW NULL @
NULL mysqltest_db1 trg3 UPDATE NULL mysqltest_db1 t1 0 NULL SET @a = 3 ROW BEFORE NULL NULL OLD NEW NULL @abc@def@@
NULL mysqltest_db1 trg4 UPDATE NULL mysqltest_db1 t1 0 NULL SET @a = 4 ROW AFTER NULL NULL OLD NEW NULL @hostname
NULL mysqltest_db1 trg5 DELETE NULL mysqltest_db1 t1 0 NULL SET @a = 5 ROW BEFORE NULL NULL OLD NEW NULL @abcdef@@@hostname
TRIGGER_CATALOG TRIGGER_SCHEMA TRIGGER_NAME EVENT_MANIPULATION EVENT_OBJECT_CATALOG EVENT_OBJECT_SCHEMA EVENT_OBJECT_TABLE ACTION_ORDER ACTION_CONDITION ACTION_STATEMENT ACTION_ORIENTATION ACTION_TIMING ACTION_REFERENCE_OLD_TABLE ACTION_REFERENCE_NEW_TABLE ACTION_REFERENCE_OLD_ROW ACTION_REFERENCE_NEW_ROW CREATED SQL_MODE DEFINER CHARACTER_SET_CLIENT COLLATION_CONNECTION DATABASE_COLLATION
NULL mysqltest_db1 trg1 INSERT NULL mysqltest_db1 t1 0 NULL SET @a = 1 ROW BEFORE NULL NULL OLD NEW NULL latin1 latin1_swedish_ci latin1_swedish_ci
NULL mysqltest_db1 trg2 INSERT NULL mysqltest_db1 t1 0 NULL SET @a = 2 ROW AFTER NULL NULL OLD NEW NULL @ latin1 latin1_swedish_ci latin1_swedish_ci
NULL mysqltest_db1 trg3 UPDATE NULL mysqltest_db1 t1 0 NULL SET @a = 3 ROW BEFORE NULL NULL OLD NEW NULL @abc@def@@ latin1 latin1_swedish_ci latin1_swedish_ci
NULL mysqltest_db1 trg4 UPDATE NULL mysqltest_db1 t1 0 NULL SET @a = 4 ROW AFTER NULL NULL OLD NEW NULL @hostname latin1 latin1_swedish_ci latin1_swedish_ci
NULL mysqltest_db1 trg5 DELETE NULL mysqltest_db1 t1 0 NULL SET @a = 5 ROW BEFORE NULL NULL OLD NEW NULL @abcdef@@@hostname latin1 latin1_swedish_ci latin1_swedish_ci
---> connection: default
DROP USER mysqltest_dfn@localhost;
......
......@@ -600,9 +600,9 @@ select @a;
@a
10
show triggers;
Trigger Event Table Statement Timing Created sql_mode Definer
t1_bi INSERT t1 set new."t1 column" = 5 BEFORE # REAL_AS_FLOAT,PIPES_AS_CONCAT,ANSI_QUOTES,IGNORE_SPACE,ANSI root@localhost
t1_af INSERT t1 set @a=10 AFTER # root@localhost
Trigger Event Table Statement Timing Created sql_mode Definer character_set_client collation_connection Database Collation
t1_bi INSERT t1 set new."t1 column" = 5 BEFORE # REAL_AS_FLOAT,PIPES_AS_CONCAT,ANSI_QUOTES,IGNORE_SPACE,ANSI root@localhost latin1 latin1_swedish_ci latin1_swedish_ci
t1_af INSERT t1 set @a=10 AFTER # root@localhost latin1 latin1_swedish_ci latin1_swedish_ci
drop table t1;
set sql_mode="traditional";
create table t1 (a date);
......@@ -622,8 +622,8 @@ t1 CREATE TABLE `t1` (
`a` date DEFAULT NULL
) ENGINE=MyISAM DEFAULT CHARSET=latin1
show triggers;
Trigger Event Table Statement Timing Created sql_mode Definer
t1_bi INSERT t1 set new.a = '2004-01-00' BEFORE # root@localhost
Trigger Event Table Statement Timing Created sql_mode Definer character_set_client collation_connection Database Collation
t1_bi INSERT t1 set new.a = '2004-01-00' BEFORE # root@localhost latin1 latin1_swedish_ci latin1_swedish_ci
drop table t1;
create table t1 (id int);
create trigger t1_ai after insert on t1 for each row reset query cache;
......
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
......@@ -185,7 +185,30 @@ set names cp1251;
create event 21 on schedule every '50:23:59:95' day_second COMMENT ' 1251 ' do select 1;
--replace_regex /STARTS '[^']+'/STARTS '#'/
SHOW CREATE EVENT 21;
insert into mysql.event (db, name, body, definer, interval_value, interval_field, originator) values (database(), "root22", "select 1", user(), 100, "SECOND_MICROSECOND", 1);
insert into mysql.event (
db,
name,
body,
definer,
interval_value,
interval_field,
originator,
character_set_client,
collation_connection,
db_collation,
body_utf8)
values (
database(),
"root22",
"select 1",
user(),
100,
"SECOND_MICROSECOND",
1,
'utf8',
'utf8_general_ci',
'utf8_general_ci',
'select 1');
--error ER_NOT_SUPPORTED_YET
show create event root22;
--error ER_NOT_SUPPORTED_YET
......
......@@ -825,7 +825,7 @@ drop table t1;
use mysql;
INSERT INTO `proc` VALUES ('test','','PROCEDURE','','SQL','CONTAINS_SQL',
'NO','DEFINER','','','BEGIN\r\n \r\nEND','root@%','2006-03-02 18:40:03',
'2006-03-02 18:40:03','','');
'2006-03-02 18:40:03','','','utf8','utf8_general_ci','utf8_general_ci','n/a');
select routine_name from information_schema.routines;
delete from proc where name='';
use test;
......
......@@ -599,4 +599,55 @@ set names latin1;
--error ER_NO_SUCH_TABLE,ER_FILE_NOT_FOUND
show columns from `#mysql50#????????`;
#
# SHOW CREATE TRIGGER test.
#
# Prepare.
--disable_warnings
DROP TABLE IF EXISTS t1;
DROP PROCEDURE IF EXISTS p1;
--enable_warnings
CREATE TABLE t1(c1 INT);
CREATE TRIGGER t1_bi BEFORE INSERT ON t1 FOR EACH ROW SET @a = 1;
# Test.
SHOW CREATE TRIGGER t1_bi;
CREATE PROCEDURE p1() SHOW CREATE TRIGGER t1_bi;
CALL p1();
CALL p1();
CALL p1();
CALL p1();
CALL p1();
CALL p1();
CALL p1();
CALL p1();
CALL p1();
CALL p1();
PREPARE stmt1 FROM 'SHOW CREATE TRIGGER t1_bi';
EXECUTE stmt1;
EXECUTE stmt1;
EXECUTE stmt1;
EXECUTE stmt1;
EXECUTE stmt1;
EXECUTE stmt1;
EXECUTE stmt1;
EXECUTE stmt1;
EXECUTE stmt1;
EXECUTE stmt1;
# Cleanup.
DROP TABLE t1;
DROP PROCEDURE p1;
DEALLOCATE PREPARE stmt1;
--echo End of 5.1 tests
......@@ -94,26 +94,33 @@ insert into mysql.proc
(
db, name, type, specific_name, language, sql_data_access, is_deterministic,
security_type, param_list, returns, body, definer, created, modified,
sql_mode, comment
sql_mode, comment, character_set_client, collation_connection, db_collation,
body_utf8
)
values
(
'test', 'bug14233_1', 'FUNCTION', 'bug14233_1', 'SQL', 'READS_SQL_DATA', 'NO',
'DEFINER', '', 'int(10)',
'select count(*) from mysql.user',
'root@localhost', NOW() , '0000-00-00 00:00:00', '', ''
'root@localhost', NOW() , '0000-00-00 00:00:00', '', '',
'', '', '',
'select count(*) from mysql.user'
),
(
'test', 'bug14233_2', 'FUNCTION', 'bug14233_2', 'SQL', 'READS_SQL_DATA', 'NO',
'DEFINER', '', 'int(10)',
'begin declare x int; select count(*) into x from mysql.user; end',
'root@localhost', NOW() , '0000-00-00 00:00:00', '', ''
'root@localhost', NOW() , '0000-00-00 00:00:00', '', '',
'', '', '',
'begin declare x int; select count(*) into x from mysql.user; end'
),
(
'test', 'bug14233_3', 'PROCEDURE', 'bug14233_3', 'SQL', 'READS_SQL_DATA','NO',
'DEFINER', '', '',
'alksj wpsj sa ^#!@ ',
'root@localhost', NOW() , '0000-00-00 00:00:00', '', ''
'root@localhost', NOW() , '0000-00-00 00:00:00', '', '',
'', '', '',
'alksj wpsj sa ^#!@ '
);
--error ER_SP_PROC_TABLE_CORRUPT
......
......@@ -6331,7 +6331,7 @@ set names utf8|
drop database if exists това_е_дълго_име_за_база_данни_нали|
--enable_warnings
create database това_е_дълго_име_за_база_данни_нали|
INSERT INTO mysql.proc VALUES ('това_е_дълго_име_за_база_данни_нали','това_е_процедура_с_доста_дълго_име_нали_и_още_по_дълго','PROCEDURE','това_е_процедура_с_доста_дълго_име_нали_и_още_по_дълго','SQL','CONTAINS_SQL','NO','DEFINER','','','bad_body','root@localhost',now(), now(),'','')|
INSERT INTO mysql.proc VALUES ('това_е_дълго_име_за_база_данни_нали','това_е_процедура_с_доста_дълго_име_нали_и_още_по_дълго','PROCEDURE','това_е_процедура_с_доста_дълго_име_нали_и_още_по_дълго','SQL','CONTAINS_SQL','NO','DEFINER','','','bad_body','root@localhost',now(), now(),'','', 'utf8', 'utf8_general_ci', 'utf8_general_ci', 'n/a')|
--error ER_SP_PROC_TABLE_CORRUPT
call това_е_дълго_име_за_база_данни_нали.това_е_процедура_с_доста_дълго_име_нали_и_още_по_дълго()|
drop database това_е_дълго_име_за_база_данни_нали|
......
......@@ -752,6 +752,11 @@ drop view v1;
#
# VIEWs with national characters
#
SET @old_cs_client = @@character_set_client;
SET @old_cs_results = @@character_set_results;
SET @old_cs_connection = @@character_set_connection;
set names utf8;
create table tü (cü char);
create view vü as select cü from tü;
......@@ -759,7 +764,10 @@ insert into vü values ('ü');
select * from vü;
drop view vü;
drop table tü;
set names latin1;
SET character_set_client = @old_cs_client;
SET character_set_results = @old_cs_results;
SET character_set_connection = @old_cs_connection;
#
# problem with used_tables() of outer reference resolved in VIEW
......
......@@ -595,17 +595,17 @@ CHARSET_INFO *get_charset_by_csname(const char *cs_name,
parameter and FALSE is returned. If there is no such character set,
"default_cs" is assigned to the "cs" and TRUE is returned.
@param[out] cs Variable to store character set.
@param[in] cs_name Character set name.
@param[in] default_cs Default character set.
@param[out] cs Variable to store character set.
@return FALSE if character set was resolved successfully; TRUE if there
is no character set with given name.
*/
bool resolve_charset(CHARSET_INFO **cs,
const char *cs_name,
CHARSET_INFO *default_cs)
bool resolve_charset(const char *cs_name,
CHARSET_INFO *default_cs,
CHARSET_INFO **cs)
{
*cs= get_charset_by_csname(cs_name, MY_CS_PRIMARY, MYF(0));
......@@ -635,9 +635,9 @@ bool resolve_charset(CHARSET_INFO **cs,
collation with given name.
*/
bool resolve_collation(CHARSET_INFO **cl,
const char *cl_name,
CHARSET_INFO *default_cl)
bool resolve_collation(const char *cl_name,
CHARSET_INFO *default_cl,
CHARSET_INFO **cl)
{
*cl= get_charset_by_name(cl_name, MYF(0));
......
......@@ -59,8 +59,7 @@ CREATE TABLE IF NOT EXISTS time_zone_transition_type ( Time_zone_id int unsign
CREATE TABLE IF NOT EXISTS time_zone_leap_second ( Transition_time bigint signed NOT NULL, Correction int signed NOT NULL, PRIMARY KEY TranTime (Transition_time) ) engine=MyISAM CHARACTER SET utf8 comment='Leap seconds information for time zones';
CREATE TABLE IF NOT EXISTS proc ( db char(64) collate utf8_bin DEFAULT '' NOT NULL, name char(64) DEFAULT '' NOT NULL, type enum('FUNCTION','PROCEDURE') NOT NULL, specific_name char(64) DEFAULT '' NOT NULL, language enum('SQL') DEFAULT 'SQL' NOT NULL, sql_data_access enum('CONTAINS_SQL', 'NO_SQL', 'READS_SQL_DATA', 'MODIFIES_SQL_DATA' ) DEFAULT 'CONTAINS_SQL' NOT NULL, is_deterministic enum('YES','NO') DEFAULT 'NO' NOT NULL, security_type enum('INVOKER','DEFINER') DEFAULT 'DEFINER' NOT NULL, param_list blob NOT NULL, returns char(64) DEFAULT '' NOT NULL, body longblob NOT NULL, definer char(77) collate utf8_bin DEFAULT '' NOT NULL, created timestamp, modified timestamp, sql_mode set( 'REAL_AS_FLOAT', 'PIPES_AS_CONCAT', 'ANSI_QUOTES', 'IGNORE_SPACE', 'NOT_USED', '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', 'HIGH_NOT_PRECEDENCE' ) DEFAULT '' NOT NULL, comment char(64) collate utf8_bin DEFAULT '' NOT NULL, PRIMARY KEY (db,name,type) ) engine=MyISAM character set utf8 comment='Stored Procedures';
CREATE TABLE IF NOT EXISTS proc (db char(64) collate utf8_bin DEFAULT '' NOT NULL, name char(64) DEFAULT '' NOT NULL, type enum('FUNCTION','PROCEDURE') NOT NULL, specific_name char(64) DEFAULT '' NOT NULL, language enum('SQL') DEFAULT 'SQL' NOT NULL, sql_data_access enum( 'CONTAINS_SQL', 'NO_SQL', 'READS_SQL_DATA', 'MODIFIES_SQL_DATA') DEFAULT 'CONTAINS_SQL' NOT NULL, is_deterministic enum('YES','NO') DEFAULT 'NO' NOT NULL, security_type enum('INVOKER','DEFINER') DEFAULT 'DEFINER' NOT NULL, param_list blob NOT NULL, returns char(64) DEFAULT '' NOT NULL, body longblob NOT NULL, definer char(77) collate utf8_bin DEFAULT '' NOT NULL, created timestamp, modified timestamp, sql_mode set( 'REAL_AS_FLOAT', 'PIPES_AS_CONCAT', 'ANSI_QUOTES', 'IGNORE_SPACE', 'NOT_USED', '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', 'HIGH_NOT_PRECEDENCE') DEFAULT '' NOT NULL, comment char(64) collate utf8_bin DEFAULT '' NOT NULL, character_set_client char(32) collate utf8_bin, collation_connection char(32) collate utf8_bin, db_collation char(32) collate utf8_bin, body_utf8 longblob, PRIMARY KEY (db,name,type)) engine=MyISAM character set utf8 comment='Stored Procedures';
CREATE TABLE IF NOT EXISTS procs_priv ( Host char(60) binary DEFAULT '' NOT NULL, Db char(64) binary DEFAULT '' NOT NULL, User char(16) binary DEFAULT '' NOT NULL, Routine_name char(64) binary DEFAULT '' NOT NULL, Routine_type enum('FUNCTION','PROCEDURE') NOT NULL, Grantor char(77) DEFAULT '' NOT NULL, Proc_priv set('Execute','Alter Routine','Grant') COLLATE utf8_general_ci DEFAULT '' NOT NULL, Timestamp timestamp(14), PRIMARY KEY (Host,Db,User,Routine_name,Routine_type), KEY Grantor (Grantor) ) engine=MyISAM CHARACTER SET utf8 COLLATE utf8_bin comment='Procedure privileges';
......@@ -75,7 +74,7 @@ CALL create_slow_log_table();;
DROP PROCEDURE create_slow_log_table;;
delimiter ;
CREATE TABLE IF NOT EXISTS event ( db char(64) CHARACTER SET utf8 COLLATE utf8_bin NOT NULL default '', name char(64) CHARACTER SET utf8 NOT NULL default '', body longblob NOT NULL, definer char(77) CHARACTER SET utf8 COLLATE utf8_bin NOT NULL default '', execute_at DATETIME default NULL, interval_value int(11) default NULL, interval_field ENUM('YEAR','QUARTER','MONTH','DAY','HOUR','MINUTE','WEEK','SECOND','MICROSECOND','YEAR_MONTH','DAY_HOUR','DAY_MINUTE','DAY_SECOND','HOUR_MINUTE','HOUR_SECOND','MINUTE_SECOND','DAY_MICROSECOND','HOUR_MICROSECOND','MINUTE_MICROSECOND','SECOND_MICROSECOND') default NULL, created TIMESTAMP NOT NULL, modified TIMESTAMP NOT NULL, last_executed DATETIME default NULL, starts DATETIME default NULL, ends DATETIME default NULL, status ENUM('ENABLED','DISABLED','SLAVESIDE_DISABLED') NOT NULL default 'ENABLED', on_completion ENUM('DROP','PRESERVE') NOT NULL default 'DROP', sql_mode set('REAL_AS_FLOAT','PIPES_AS_CONCAT','ANSI_QUOTES','IGNORE_SPACE','NOT_USED','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','HIGH_NOT_PRECEDENCE') DEFAULT '' NOT NULL, comment char(64) CHARACTER SET utf8 COLLATE utf8_bin NOT NULL default '', originator int(10) NOT NULL, time_zone char(64) CHARACTER SET latin1 NOT NULL DEFAULT 'SYSTEM', PRIMARY KEY (db, name) ) ENGINE=MyISAM DEFAULT CHARSET=utf8 COMMENT 'Events';
CREATE TABLE IF NOT EXISTS event ( db char(64) CHARACTER SET utf8 COLLATE utf8_bin NOT NULL default '', name char(64) CHARACTER SET utf8 NOT NULL default '', body longblob NOT NULL, definer char(77) CHARACTER SET utf8 COLLATE utf8_bin NOT NULL default '', execute_at DATETIME default NULL, interval_value int(11) default NULL, interval_field ENUM('YEAR','QUARTER','MONTH','DAY','HOUR','MINUTE','WEEK','SECOND','MICROSECOND','YEAR_MONTH','DAY_HOUR','DAY_MINUTE','DAY_SECOND','HOUR_MINUTE','HOUR_SECOND','MINUTE_SECOND','DAY_MICROSECOND','HOUR_MICROSECOND','MINUTE_MICROSECOND','SECOND_MICROSECOND') default NULL, created TIMESTAMP NOT NULL, modified TIMESTAMP NOT NULL, last_executed DATETIME default NULL, starts DATETIME default NULL, ends DATETIME default NULL, status ENUM('ENABLED','DISABLED','SLAVESIDE_DISABLED') NOT NULL default 'ENABLED', on_completion ENUM('DROP','PRESERVE') NOT NULL default 'DROP', sql_mode set('REAL_AS_FLOAT','PIPES_AS_CONCAT','ANSI_QUOTES','IGNORE_SPACE','NOT_USED','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','HIGH_NOT_PRECEDENCE') DEFAULT '' NOT NULL, comment char(64) CHARACTER SET utf8 COLLATE utf8_bin NOT NULL default '', originator int(10) NOT NULL, time_zone char(64) CHARACTER SET latin1 NOT NULL DEFAULT 'SYSTEM', character_set_client char(32) collate utf8_bin, collation_connection char(32) collate utf8_bin, db_collation char(32) collate utf8_bin, body_utf8 longblob, PRIMARY KEY (db, name) ) ENGINE=MyISAM DEFAULT CHARSET=utf8 COMMENT 'Events';
CREATE TABLE IF NOT EXISTS ndb_binlog_index (Position BIGINT UNSIGNED NOT NULL, File VARCHAR(255) NOT NULL, epoch BIGINT UNSIGNED NOT NULL, inserts BIGINT UNSIGNED NOT NULL, updates BIGINT UNSIGNED NOT NULL, deletes BIGINT UNSIGNED NOT NULL, schemaops BIGINT UNSIGNED NOT NULL, PRIMARY KEY(epoch)) ENGINE=MYISAM;
......
......@@ -388,6 +388,29 @@ ALTER TABLE proc MODIFY db
MODIFY comment
char(64) collate utf8_bin DEFAULT '' NOT NULL;
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;
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;
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;
ALTER TABLE proc ADD body_utf8 longblob DEFAULT NULL
AFTER db_collation;
ALTER TABLE proc MODIFY body_utf8 longblob DEFAULT NULL;
#
# EVENT privilege
#
......@@ -446,6 +469,29 @@ ALTER TABLE event MODIFY COLUMN status ENUM('ENABLED','DISABLED','SLAVESIDE_DISA
ALTER TABLE event ADD COLUMN time_zone char(64) CHARACTER SET latin1
NOT NULL DEFAULT 'SYSTEM' AFTER originator;
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;
#
# TRIGGER privilege
#
......
......@@ -23,6 +23,126 @@
#define EVEX_MAX_INTERVAL_VALUE 1000000000L
/*************************************************************************/
/**
Event_creation_ctx -- creation context of events.
*/
class Event_creation_ctx :public Stored_program_creation_ctx,
public Sql_alloc
{
public:
static bool load_from_db(THD *thd,
MEM_ROOT *event_mem_root,
const char *db_name,
const char *event_name,
TABLE *event_tbl,
Stored_program_creation_ctx **ctx);
public:
virtual Stored_program_creation_ctx *clone(MEM_ROOT *mem_root)
{
return new (mem_root)
Event_creation_ctx(m_client_cs, m_connection_cl, m_db_cl);
}
protected:
virtual Object_creation_ctx *create_backup_ctx(THD *thd) const
{
/*
We can avoid usual backup/restore employed in stored programs since we
know that this is a top level statement and the worker thread is
allocated exclusively to execute this event.
*/
return NULL;
}
private:
Event_creation_ctx(CHARSET_INFO *client_cs,
CHARSET_INFO *connection_cl,
CHARSET_INFO *db_cl)
: Stored_program_creation_ctx(client_cs, connection_cl, db_cl)
{ }
};
/**************************************************************************
Event_creation_ctx implementation.
**************************************************************************/
bool
Event_creation_ctx::load_from_db(THD *thd,
MEM_ROOT *event_mem_root,
const char *db_name,
const char *event_name,
TABLE *event_tbl,
Stored_program_creation_ctx **ctx)
{
/* Load character set/collation attributes. */
CHARSET_INFO *client_cs;
CHARSET_INFO *connection_cl;
CHARSET_INFO *db_cl;
bool invalid_creation_ctx= FALSE;
if (load_charset(event_mem_root,
event_tbl->field[ET_FIELD_CHARACTER_SET_CLIENT],
thd->variables.character_set_client,
&client_cs))
{
sql_print_warning("Event '%s'.'%s': invalid value "
"in column mysql.event.character_set_client.",
(const char *) db_name,
(const char *) event_name);
invalid_creation_ctx= TRUE;
}
if (load_collation(event_mem_root,
event_tbl->field[ET_FIELD_COLLATION_CONNECTION],
thd->variables.collation_connection,
&connection_cl))
{
sql_print_warning("Event '%s'.'%s': invalid value "
"in column mysql.event.collation_connection.",
(const char *) db_name,
(const char *) event_name);
invalid_creation_ctx= TRUE;
}
if (load_collation(event_mem_root,
event_tbl->field[ET_FIELD_DB_COLLATION],
NULL,
&db_cl))
{
sql_print_warning("Event '%s'.'%s': invalid value "
"in column mysql.event.db_collation.",
(const char *) db_name,
(const char *) event_name);
invalid_creation_ctx= TRUE;
}
/*
If we failed to resolve the database collation, load the default one
from the disk.
*/
if (!db_cl)
db_cl= get_default_db_collation(thd, db_name);
/* Create the context. */
*ctx= new Event_creation_ctx(client_cs, connection_cl, db_cl);
return invalid_creation_ctx;
}
/*************************************************************************/
/*
Initiliazes dbname and name of an Event_queue_element_for_exec
object
......@@ -761,6 +881,7 @@ Event_timed::init()
/**
Load an event's body from a row from mysql.event.
@details This method is silent on errors and should behave like that.
Callers should handle throwing of error messages. The reason is that the
class should not know about how to deal with communication.
......@@ -797,6 +918,9 @@ Event_job_data::load_from_row(THD *thd, TABLE *table)
if (load_time_zone(thd, tz_name))
DBUG_RETURN(TRUE);
Event_creation_ctx::load_from_db(thd, &mem_root, dbname.str, name.str, table,
&creation_ctx);
ptr= strchr(definer.str, '@');
if (! ptr)
......@@ -979,9 +1103,20 @@ Event_timed::load_from_row(THD *thd, TABLE *table)
if (load_string_fields(table->field,
ET_FIELD_BODY, &body,
ET_FIELD_BODY_UTF8, &body_utf8,
ET_FIELD_COUNT))
DBUG_RETURN(TRUE);
if (Event_creation_ctx::load_from_db(thd, &mem_root, dbname.str, name.str,
table, &creation_ctx))
{
push_warning_printf(thd,
MYSQL_ERROR::WARN_LEVEL_WARN,
ER_EVENT_INVALID_CREATION_CTX,
ER(ER_EVENT_INVALID_CREATION_CTX),
(const char *) dbname.str,
(const char *) name.str);
}
ptr= strchr(definer.str, '@');
......@@ -1743,7 +1878,6 @@ Event_job_data::execute(THD *thd, bool drop)
#ifndef NO_EMBEDDED_ACCESS_CHECKS
Security_context event_sctx, *save_sctx= NULL;
#endif
CHARSET_INFO *charset_connection;
List<Item> empty_item_list;
bool ret= TRUE;
......@@ -1808,12 +1942,6 @@ Event_job_data::execute(THD *thd, bool drop)
this is a top level statement and the worker thread is
allocated exclusively to execute this event.
*/
charset_connection= get_charset_by_csname("utf8",
MY_CS_PRIMARY, MYF(MY_WME));
thd->variables.character_set_client= charset_connection;
thd->variables.character_set_results= charset_connection;
thd->variables.collation_connection= charset_connection;
thd->update_charset();
thd->variables.sql_mode= sql_mode;
thd->variables.time_zone= time_zone;
......@@ -1830,7 +1958,7 @@ Event_job_data::execute(THD *thd, bool drop)
Lex_input_stream lip(thd, thd->query, thd->query_length);
lex_start(thd);
if (parse_sql(thd, &lip))
if (parse_sql(thd, &lip, creation_ctx))
{
sql_print_error("Event Scheduler: "
"%serror during compilation of %s.%s",
......@@ -1850,6 +1978,7 @@ Event_job_data::execute(THD *thd, bool drop)
sphead->m_flags|= sp_head::LOG_GENERAL_LOG;
sphead->set_info(0, 0, &thd->lex->sp_chistics, sql_mode);
sphead->set_creation_ctx(creation_ctx);
sphead->optimize();
ret= sphead->execute_procedure(thd, &empty_item_list);
......
......@@ -20,8 +20,6 @@
#define EVEX_BAD_PARAMS -5
#define EVEX_MICROSECOND_UNSUP -6
class sp_head;
class Sql_alloc;
class Event_queue_element_for_exec
{
......@@ -151,6 +149,9 @@ class Event_timed : public Event_queue_element
ulong sql_mode;
class Stored_program_creation_ctx *creation_ctx;
LEX_STRING body_utf8;
Event_timed();
virtual ~Event_timed();
......@@ -174,6 +175,8 @@ class Event_job_data : public Event_basic
ulong sql_mode;
class Stored_program_creation_ctx *creation_ctx;
Event_job_data();
virtual bool
......
......@@ -123,6 +123,26 @@ const TABLE_FIELD_W_TYPE event_table_fields[ET_FIELD_COUNT] =
{ C_STRING_WITH_LEN("time_zone") },
{ C_STRING_WITH_LEN("char(64)") },
{ C_STRING_WITH_LEN("latin1") }
},
{
{ C_STRING_WITH_LEN("character_set_client") },
{ C_STRING_WITH_LEN("char(32)") },
{ C_STRING_WITH_LEN("utf8") }
},
{
{ C_STRING_WITH_LEN("collation_connection") },
{ C_STRING_WITH_LEN("char(32)") },
{ C_STRING_WITH_LEN("utf8") }
},
{
{ C_STRING_WITH_LEN("db_collation") },
{ C_STRING_WITH_LEN("char(32)") },
{ C_STRING_WITH_LEN("utf8") }
},
{
{ C_STRING_WITH_LEN("body_utf8") },
{ C_STRING_WITH_LEN("longblob") },
{ NULL, 0 }
}
};
......@@ -135,6 +155,7 @@ const TABLE_FIELD_W_TYPE event_table_fields[ET_FIELD_COUNT] =
@param thd THD
@param table The row to fill out
@param et Event's data
@param sp Event stored routine
@param is_update CREATE EVENT or ALTER EVENT
@retval FALSE success
......@@ -281,6 +302,33 @@ mysql_event_fill_row(THD *thd,
goto err_truncate;
}
fields[ET_FIELD_CHARACTER_SET_CLIENT]->set_notnull();
fields[ET_FIELD_CHARACTER_SET_CLIENT]->store(
thd->variables.character_set_client->csname,
strlen(thd->variables.character_set_client->csname),
system_charset_info);
fields[ET_FIELD_COLLATION_CONNECTION]->set_notnull();
fields[ET_FIELD_COLLATION_CONNECTION]->store(
thd->variables.collation_connection->name,
strlen(thd->variables.collation_connection->name),
system_charset_info);
{
CHARSET_INFO *db_cl= get_default_db_collation(thd, et->dbname.str);
fields[ET_FIELD_DB_COLLATION]->set_notnull();
fields[ET_FIELD_DB_COLLATION]->store(
db_cl->name, strlen(db_cl->name), system_charset_info);
}
if (et->body_changed)
{
fields[ET_FIELD_BODY_UTF8]->set_notnull();
fields[ET_FIELD_BODY_UTF8]->store(
sp->m_body_utf8.str, sp->m_body_utf8.length, system_charset_info);
}
DBUG_RETURN(FALSE);
err_truncate:
......
......@@ -42,6 +42,10 @@ enum enum_events_table_field
ET_FIELD_COMMENT,
ET_FIELD_ORIGINATOR,
ET_FIELD_TIME_ZONE,
ET_FIELD_CHARACTER_SET_CLIENT,
ET_FIELD_COLLATION_CONNECTION,
ET_FIELD_DB_COLLATION,
ET_FIELD_BODY_UTF8,
ET_FIELD_COUNT /* a cool trick to count the number of fields :) */
};
......@@ -53,6 +57,7 @@ events_table_index_read_for_db(THD *thd, TABLE *schema_table,
int
events_table_scan_all(THD *thd, TABLE *schema_table, TABLE *event_table);
class Event_basic;
class Event_parse_data;
......
......@@ -19,6 +19,7 @@
#include "event_db_repository.h"
#include "event_queue.h"
#include "event_scheduler.h"
#include "sp_head.h" // for Stored_program_creation_ctx
/*
TODO list :
......@@ -698,6 +699,15 @@ send_show_create_event(THD *thd, Event_timed *et, Protocol *protocol)
field_list.push_back(new Item_empty_string("Create Event",
show_str.length()));
field_list.push_back(
new Item_empty_string("character_set_client", MY_CS_NAME_SIZE));
field_list.push_back(
new Item_empty_string("collation_connection", MY_CS_NAME_SIZE));
field_list.push_back(
new Item_empty_string("Database Collation", MY_CS_NAME_SIZE));
if (protocol->send_fields(&field_list,
Protocol::SEND_NUM_ROWS | Protocol::SEND_EOF))
DBUG_RETURN(TRUE);
......@@ -707,7 +717,16 @@ send_show_create_event(THD *thd, Event_timed *et, Protocol *protocol)
protocol->store(et->name.str, et->name.length, system_charset_info);
protocol->store(sql_mode.str, sql_mode.length, system_charset_info);
protocol->store(tz_name->ptr(), tz_name->length(), system_charset_info);
protocol->store(show_str.c_ptr(), show_str.length(), system_charset_info);
protocol->store(show_str.c_ptr(), show_str.length(), &my_charset_bin);
protocol->store(et->creation_ctx->get_client_cs()->csname,
strlen(et->creation_ctx->get_client_cs()->csname),
system_charset_info);
protocol->store(et->creation_ctx->get_connection_cl()->name,
strlen(et->creation_ctx->get_connection_cl()->name),
system_charset_info);
protocol->store(et->creation_ctx->get_db_cl()->name,
strlen(et->creation_ctx->get_db_cl()->name),
system_charset_info);
if (protocol->write())
DBUG_RETURN(TRUE);
......
......@@ -150,6 +150,86 @@ extern MY_LOCALE *my_default_lc_time_names;
MY_LOCALE *my_locale_by_name(const char *name);
MY_LOCALE *my_locale_by_number(uint number);
/*************************************************************************/
/**
Object_creation_ctx -- interface for creation context of database objects
(views, stored routines, events, triggers). Creation context -- is a set
of attributes, that should be fixed at the creation time and then be used
each time the object is parsed or executed.
*/
class Object_creation_ctx
{
public:
Object_creation_ctx *set_n_backup(THD *thd);
void restore_env(THD *thd, Object_creation_ctx *backup_ctx);
protected:
virtual Object_creation_ctx *create_backup_ctx(THD *thd) = 0;
virtual void change_env(THD *thd) const = 0;
public:
virtual ~Object_creation_ctx()
{ }
};
/*************************************************************************/
/**
Default_object_creation_ctx -- default implementation of
Object_creation_ctx.
*/
class Default_object_creation_ctx : public Object_creation_ctx
{
public:
CHARSET_INFO *get_client_cs()
{
return m_client_cs;
}
CHARSET_INFO *get_connection_cl()
{
return m_connection_cl;
}
protected:
Default_object_creation_ctx(THD *thd);
Default_object_creation_ctx(CHARSET_INFO *client_cs,
CHARSET_INFO *connection_cl);
protected:
virtual Object_creation_ctx *create_backup_ctx(THD *thd);
virtual void change_env(THD *thd) const;
protected:
/**
client_cs stores the value of character_set_client session variable.
The only character set attribute is used.
Client character set is included into query context, because we save
query in the original character set, which is client character set. So,
in order to parse the query properly we have to switch client character
set on parsing.
*/
CHARSET_INFO *m_client_cs;
/**
connection_cl stores the value of collation_connection session
variable. Both character set and collation attributes are used.
Connection collation is included into query context, becase it defines
the character set and collation of text literals in internal
representation of query (item-objects).
*/
CHARSET_INFO *m_connection_cl;
};
/***************************************************************************
Configuration parameters
****************************************************************************/
......@@ -618,7 +698,9 @@ bool check_string_char_length(LEX_STRING *str, const char *err_msg,
uint max_char_length, CHARSET_INFO *cs,
bool no_error);
bool parse_sql(THD *thd, class Lex_input_stream *lip);
bool parse_sql(THD *thd,
class Lex_input_stream *lip,
class Object_creation_ctx *creation_ctx);
enum enum_mysql_completiontype {
ROLLBACK_RELEASE=-2, ROLLBACK=1, ROLLBACK_AND_CHAIN=7,
......@@ -2156,12 +2238,24 @@ bool schema_table_store_record(THD *thd, TABLE *table);
int item_create_init();
void item_create_cleanup();
bool show_create_trigger(THD *thd, const sp_name *trg_name);
inline void lex_string_set(LEX_STRING *lex_str, const char *c_str)
{
lex_str->str= (char *) c_str;
lex_str->length= strlen(c_str);
}
bool load_charset(MEM_ROOT *mem_root,
Field *field,
CHARSET_INFO *dflt_cs,
CHARSET_INFO **cs);
bool load_collation(MEM_ROOT *mem_root,
Field *field,
CHARSET_INFO *dflt_cl,
CHARSET_INFO **cl);
#endif /* MYSQL_SERVER */
#endif /* MYSQL_CLIENT */
......
......@@ -6076,3 +6076,24 @@ ER_SLAVE_MASTER_COM_FAILURE
eng "Master command %s failed: %s"
ER_BINLOG_LOGGING_IMPOSSIBLE
eng "Binary logging not possible. Message: %s"
ER_VIEW_NO_CREATION_CTX
eng "View `%-.64s`.`%-.64s` has no creation context"
ER_VIEW_INVALID_CREATION_CTX
eng "Creation context of view `%-.64s`.`%-.64s' is invalid"
ER_SR_INVALID_CREATION_CTX
eng "Creation context of stored routine `%-.64s`.`%-.64s` is invalid"
ER_TRG_CORRUPTED_FILE
eng "Corrupted TRG file for table `%-.64s`.`%-.64s`"
ER_TRG_NO_CREATION_CTX
eng "Triggers for table `%-.64s`.`%-.64s` have no creation context"
ER_TRG_INVALID_CREATION_CTX
eng "Trigger creation context of table `%-.64s`.`%-.64s` is invalid"
ER_EVENT_INVALID_CREATION_CTX
eng "Creation context of event `%-.64s`.`%-.64s` is invalid"
ER_TRG_CANT_OPEN_TABLE
eng "Cannot open table for trigger `%-.64s`.`%-.64s`"
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
......@@ -3728,7 +3728,7 @@ bool mysql_unpack_partition(THD *thd,
lex.part_info->part_state= part_state;
lex.part_info->part_state_len= part_state_len;
DBUG_PRINT("info", ("Parse: %s", part_buf));
if (parse_sql(thd, &lip))
if (parse_sql(thd, &lip, NULL))
{
thd->free_items();
goto end;
......
......@@ -1769,6 +1769,7 @@ static bool check_prepared_statement(Prepared_statement *stmt,
case SQLCOM_SHOW_CREATE_PROC:
case SQLCOM_SHOW_CREATE_FUNC:
case SQLCOM_SHOW_CREATE_EVENT:
case SQLCOM_SHOW_CREATE_TRIGGER:
case SQLCOM_SHOW_CREATE:
case SQLCOM_SHOW_PROC_CODE:
case SQLCOM_SHOW_FUNC_CODE:
......@@ -2876,7 +2877,7 @@ bool Prepared_statement::prepare(const char *packet, uint packet_len)
lip.stmt_prepare_mode= TRUE;
lex_start(thd);
error= parse_sql(thd, &lip) ||
error= parse_sql(thd, &lip, NULL) ||
thd->net.report_error ||
init_param_array(this);
......
This diff is collapsed.
This diff is collapsed.
......@@ -83,6 +83,14 @@ class Table_triggers_list: public Sql_alloc
List<LEX_STRING> definers_list;
/* Character set context, used for parsing and executing triggers. */
List<LEX_STRING> client_cs_names;
List<LEX_STRING> connection_cl_names;
List<LEX_STRING> db_cl_names;
/* End of character ser context. */
Table_triggers_list(TABLE *table_arg):
record1_field(0), trigger_table(table_arg)
{
......@@ -97,11 +105,26 @@ class Table_triggers_list: public Sql_alloc
bool process_triggers(THD *thd, trg_event_type event,
trg_action_time_type time_type,
bool old_row_is_record1);
bool get_trigger_info(THD *thd, trg_event_type event,
trg_action_time_type time_type,
LEX_STRING *trigger_name, LEX_STRING *trigger_stmt,
ulong *sql_mode,
LEX_STRING *definer);
LEX_STRING *definer,
LEX_STRING *client_cs_name,
LEX_STRING *connection_cl_name,
LEX_STRING *db_cl_name);
void get_trigger_info(THD *thd,
int trigger_idx,
LEX_STRING *trigger_name,
ulonglong *sql_mode,
LEX_STRING *sql_original_stmt,
LEX_STRING *client_cs_name,
LEX_STRING *connection_cl_name,
LEX_STRING *db_cl_name);
int find_trigger_by_name(const LEX_STRING *trigger_name);
static bool check_n_load(THD *thd, const char *db, const char *table_name,
TABLE *table, bool names_only);
......@@ -144,7 +167,7 @@ extern const LEX_STRING trg_action_time_type_names[];
extern const LEX_STRING trg_event_type_names[];
bool add_table_for_trigger(THD *thd,
sp_name *trg_name,
const sp_name *trg_name,
bool continue_if_not_exist,
TABLE_LIST **table);
......
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment