diff options
author | unknown <kostja@bodhi.local> | 2006-08-14 13:27:11 +0400 |
---|---|---|
committer | unknown <kostja@bodhi.local> | 2006-08-14 13:27:11 +0400 |
commit | 21e75cb081c6c41d90c4c4f5cdde1bb16addd59b (patch) | |
tree | dd20163537ab3e46032dcc51c9b296a1c884d8f0 | |
parent | f68085c4e75a2ef4db33a9500b07ad4e37bf8b95 (diff) | |
download | mariadb-git-21e75cb081c6c41d90c4c4f5cdde1bb16addd59b.tar.gz |
Manual merge 5.0->5.1. Post-merge fixes.
client/mysqldump.c:
A post-merge fix - 'sock' was renamed to 'mysql'
mysql-test/r/events_bugs.result:
A post merge fix: now we strip rear comments from the query before
it gets into the log.
mysql-test/r/func_group.result:
A post merge fix: default clause is now printed uppercase.
mysql-test/r/im_life_cycle.result:
Fix my mistake in manual resolve.
mysql-test/r/mysqlcheck.result:
use test; - after we drop client_test_db there is no current database.
This cleanup is present in 5.1 only, but the test that was added in
5.0 assumes there is a current database, test.
mysql-test/r/mysqldump.result:
Ignore results of execution of mysqldump: we can't rely on
MASTER_LOG_POS in test results, it's different for statement
and row level logging.
mysql-test/r/mysqlshow.result:
A post-merge fix: information schema contains a few more tables
in 5.1
mysql-test/r/mysqltest.result:
A post merge fix: add 5.1 test end separator.
mysql-test/r/ndb_basic.result:
A post-merge fix: add test end separators.
mysql-test/r/rpl_switch_stm_row_mixed.result:
A post merge fix: length of varbinary column is now 3 times less.
Assuming a side effect of some other change. Length of any
field is not relevant in this test.
mysql-test/r/rpl_view.result:
Add an end of test marker.
mysql-test/r/show_check.result:
Remove duplicate results. Add results from a merged test case.
mysql-test/r/sp-error.result:
Add test end separators.
mysql-test/r/sp-security.result:
Post-merge fix: use test after the current database is dropped.
mysql-test/r/sp.result:
Remove a duplicate result (bad merge that left a copy of
the test case for Bug#19862 in the test suite).
mysql-test/r/strict.result:
An after-merge fix for a new test case: in 5.1 we issue a more accurate
error message: "Incorrect value" instead of "Truncated value". I reason
it so that in case of an error nothing is truncated, really.
Also found similar changes in other test cases.
mysql-test/r/type_datetime.result:
Fix the text of an error.
mysql-test/r/union.result:
A post-merge fix: CHARACTER SET is now uppercase.
mysql-test/t/mysqlcheck.test:
A post-merge fix: use test, after current database is dropped, there
is no current database.
mysql-test/t/mysqldump.test:
Disable result log: it's dependent on binlog position.
mysql-test/t/sp-security.test:
use test
sql/item_sum.cc:
Adjust the call to the constructor after the merge.
sql/sp_head.cc:
Add a missing DBUG_VOID_RETURN, move security checks out of
execute_trigger to Table_triggers_list: in 5.1 we check for
TRIGGER privilege, not SUPER privilege to execute triggers, so these
checks lack table context inside execute_trigger and have to be
performed when we have table object on hand.
sql/sql_db.cc:
A post-merge fix: adjust load_db_opt_by_name and check_db_dir_existence
(new functions added in 5.0) to be tablename-to-filename encoding
friendly.
sql/sql_lex.cc:
A post-merge fix: make skip_rear_comments operate on const uchar *s.
sql/sql_lex.h:
A post-merge fix.
sql/sql_show.cc:
A post-merge fix: fix a bad merge, rename orig_sql_command -> sql_command.
sql/sql_trigger.cc:
A post-merge fix: move security checks to process_triggers
from execute_trigger.
sql/sql_view.cc:
Adjust to the new signature of skip_rear_comments.
sql/sql_yacc.yy:
Adjust to the new signature of init_strings.
30 files changed, 116 insertions, 150 deletions
diff --git a/client/mysqldump.c b/client/mysqldump.c index dc7527c9c73..83a7d0f335e 100644 --- a/client/mysqldump.c +++ b/client/mysqldump.c @@ -1333,7 +1333,7 @@ static uint dump_events_for_db(char *db) DBUG_ENTER("dump_events_for_db"); DBUG_PRINT("enter", ("db: '%s'", db)); - mysql_real_escape_string(sock, db_name_buff, db, strlen(db)); + mysql_real_escape_string(mysql, db_name_buff, db, strlen(db)); /* nice comments */ if (opt_comments) @@ -1344,9 +1344,9 @@ static uint dump_events_for_db(char *db) enough privileges to lock mysql.events. */ if (lock_tables) - mysql_query(sock, "LOCK TABLES mysql.event READ"); + mysql_query(mysql, "LOCK TABLES mysql.event READ"); - if (mysql_query_with_error_report(sock, &event_list_res, "show events")) + if (mysql_query_with_error_report(mysql, &event_list_res, "show events")) { safe_exit(EX_MYSQLERR); DBUG_RETURN(0); @@ -1362,7 +1362,7 @@ static uint dump_events_for_db(char *db) my_snprintf(query_buff, sizeof(query_buff), "SHOW CREATE EVENT %s", event_name); - if (mysql_query_with_error_report(sock, &event_res, query_buff)) + if (mysql_query_with_error_report(mysql, &event_res, query_buff)) DBUG_RETURN(1); while ((row= mysql_fetch_row(event_res)) != NULL) @@ -1395,7 +1395,7 @@ static uint dump_events_for_db(char *db) mysql_free_result(event_list_res); if (lock_tables) - VOID(mysql_query_with_error_report(sock, 0, "UNLOCK TABLES")); + VOID(mysql_query_with_error_report(mysql, 0, "UNLOCK TABLES")); DBUG_RETURN(0); } @@ -2738,7 +2738,7 @@ static int dump_all_tablespaces() char buf[FN_REFLEN]; int first; - if (mysql_query_with_error_report(sock, &tableres, + if (mysql_query_with_error_report(mysql, &tableres, "SELECT DISTINCT" " LOGFILE_GROUP_NAME," " FILE_NAME," @@ -2792,7 +2792,7 @@ static int dump_all_tablespaces() } } - if (mysql_query_with_error_report(sock, &tableres, + if (mysql_query_with_error_report(mysql, &tableres, "SELECT DISTINCT" " TABLESPACE_NAME," " FILE_NAME," @@ -3035,7 +3035,7 @@ static int dump_all_tables_in_db(char *database) } } if (opt_events && !opt_xml && - mysql_get_server_version(sock) >= 50106) + mysql_get_server_version(mysql) >= 50106) { DBUG_PRINT("info", ("Dumping events for database %s", database)); dump_events_for_db(database); @@ -3251,7 +3251,7 @@ static int dump_selected_tables(char *db, char **table_names, int tables) get_view_structure(*pos, db); } if (opt_events && !opt_xml && - mysql_get_server_version(sock) >= 50106) + mysql_get_server_version(mysql) >= 50106) { DBUG_PRINT("info", ("Dumping events for database %s", db)); dump_events_for_db(db); diff --git a/mysql-test/r/events_bugs.result b/mysql-test/r/events_bugs.result index a7c2964a253..45733c91622 100644 --- a/mysql-test/r/events_bugs.result +++ b/mysql-test/r/events_bugs.result @@ -106,9 +106,9 @@ set global event_scheduler= 1; select /*2*/ user, host, db, command, state, info from information_schema.processlist where info is null or info not like '%processlist%' order by info; user host db command state info event_scheduler localhost NULL Connect Sleeping NULL -root localhost events_test Connect User lock select get_lock('ee_16407_2', 60) /*ee_16407_2*/ -root localhost events_test Connect User lock select get_lock('ee_16407_2', 60) /*ee_16407_3*/ -root localhost events_test Connect User lock select get_lock('ee_16407_2', 60) /*ee_16407_4*/ +root localhost events_test Connect User lock select get_lock('ee_16407_2', 60) +root localhost events_test Connect User lock select get_lock('ee_16407_2', 60) +root localhost events_test Connect User lock select get_lock('ee_16407_2', 60) select release_lock('ee_16407_2'); release_lock('ee_16407_2') 1 @@ -154,8 +154,8 @@ set global event_scheduler= 1; select /*4*/ user, host, db, command, state, info from information_schema.processlist where info is null or info not like '%processlist%' order by info; user host db command state info event_scheduler localhost NULL Connect Sleeping NULL -root localhost events_test Connect User lock select get_lock('ee_16407_5', 60) /*ee_16407_5*/ -root localhost events_test Connect User lock select get_lock('ee_16407_5', 60) /*ee_16407_6*/ +root localhost events_test Connect User lock select get_lock('ee_16407_5', 60) +root localhost events_test Connect User lock select get_lock('ee_16407_5', 60) select release_lock('ee_16407_5'); release_lock('ee_16407_5') 1 diff --git a/mysql-test/r/func_group.result b/mysql-test/r/func_group.result index 26cf94bb820..c7d95a4a446 100644 --- a/mysql-test/r/func_group.result +++ b/mysql-test/r/func_group.result @@ -994,13 +994,13 @@ create table t1 select variance(0); show create table t1; Table Create Table t1 CREATE TABLE `t1` ( - `variance(0)` double(8,4) default NULL + `variance(0)` double(8,4) DEFAULT NULL ) ENGINE=MyISAM DEFAULT CHARSET=latin1 drop table t1; create table t1 select stddev(0); show create table t1; Table Create Table t1 CREATE TABLE `t1` ( - `stddev(0)` double(8,4) default NULL + `stddev(0)` double(8,4) DEFAULT NULL ) ENGINE=MyISAM DEFAULT CHARSET=latin1 drop table t1; diff --git a/mysql-test/r/im_life_cycle.result b/mysql-test/r/im_life_cycle.result index b6d3bb8361c..b861248dccb 100644 --- a/mysql-test/r/im_life_cycle.result +++ b/mysql-test/r/im_life_cycle.result @@ -1,8 +1,7 @@ - --------------------------------------------------------------------- --- 1.1.1. --------------------------------------------------------------------- Success: the process has been started. +SHOW VARIABLES LIKE 'server_id'; +Variable_name Value +server_id 1 SHOW INSTANCES; instance_name state mysqld1 online @@ -40,10 +39,6 @@ ERROR HY000: Bad instance name. Check that the instance with such a name exists -------------------------------------------------------------------- -- 1.1.6. -------------------------------------------------------------------- -SHOW INSTANCES; -instance_name state -mysqld1 online -mysqld2 offline Killing the process... Sleeping... Success: the process was restarted. diff --git a/mysql-test/r/mysqlcheck.result b/mysql-test/r/mysqlcheck.result index a76402a87b0..c34aa995b2b 100644 --- a/mysql-test/r/mysqlcheck.result +++ b/mysql-test/r/mysqlcheck.result @@ -1,6 +1,7 @@ drop database if exists client_test_db; DROP SCHEMA test; CREATE SCHEMA test; +use test; cluster.binlog_index OK mysql.columns_priv OK mysql.db OK diff --git a/mysql-test/r/mysqldump.result b/mysql-test/r/mysqldump.result index 9d44756f17c..33068cdfc2b 100644 --- a/mysql-test/r/mysqldump.result +++ b/mysql-test/r/mysqldump.result @@ -2923,11 +2923,6 @@ grant RELOAD on *.* to mysqltest_1@localhost; mysqldump: Couldn't execute 'SHOW MASTER STATUS': Access denied; you need the SUPER,REPLICATION CLIENT privilege for this operation (1227) mysqldump: Couldn't execute 'SHOW MASTER STATUS': Access denied; you need the SUPER,REPLICATION CLIENT privilege for this operation (1227) grant REPLICATION CLIENT on *.* to mysqltest_1@localhost; -CHANGE MASTER TO MASTER_LOG_FILE='master-bin.000001', MASTER_LOG_POS=537; -CREATE TABLE `t1` ( - `a` int(11) default NULL, - `b` varchar(34) default NULL -) ENGINE=MyISAM DEFAULT CHARSET=latin1; drop table t1; drop user mysqltest_1; End of 5.0 tests diff --git a/mysql-test/r/mysqlshow.result b/mysql-test/r/mysqlshow.result index 2bf8a58de4e..60ad5998465 100644 --- a/mysql-test/r/mysqlshow.result +++ b/mysql-test/r/mysqlshow.result @@ -84,7 +84,14 @@ Database: information_schema | COLLATION_CHARACTER_SET_APPLICABILITY | | COLUMNS | | COLUMN_PRIVILEGES | +| ENGINES | +| EVENTS | +| FILES | | KEY_COLUMN_USAGE | +| PARTITIONS | +| PLUGINS | +| PROCESSLIST | +| REFERENTIAL_CONSTRAINTS | | ROUTINES | | SCHEMATA | | SCHEMA_PRIVILEGES | @@ -105,7 +112,14 @@ Database: INFORMATION_SCHEMA | COLLATION_CHARACTER_SET_APPLICABILITY | | COLUMNS | | COLUMN_PRIVILEGES | +| ENGINES | +| EVENTS | +| FILES | | KEY_COLUMN_USAGE | +| PARTITIONS | +| PLUGINS | +| PROCESSLIST | +| REFERENTIAL_CONSTRAINTS | | ROUTINES | | SCHEMATA | | SCHEMA_PRIVILEGES | diff --git a/mysql-test/r/mysqltest.result b/mysql-test/r/mysqltest.result index a50b1dfd5ab..10c89effa8b 100644 --- a/mysql-test/r/mysqltest.result +++ b/mysql-test/r/mysqltest.result @@ -474,3 +474,4 @@ a D 1 1 1 4 drop table t1; +End of 5.1 tests diff --git a/mysql-test/r/ndb_basic.result b/mysql-test/r/ndb_basic.result index 997c7bae1d6..6503e5eecb9 100644 --- a/mysql-test/r/ndb_basic.result +++ b/mysql-test/r/ndb_basic.result @@ -749,7 +749,7 @@ f1 f2 f3 222222 bbbbbb 2 drop table t1; Illegal ndb error code: 1186 -Enf of 5.0 tests +End of 5.0 tests CREATE TABLE t1 (a VARCHAR(255) NOT NULL, CONSTRAINT pk_a PRIMARY KEY (a))engine=ndb; CREATE TABLE t2(a VARCHAR(255) NOT NULL, @@ -758,3 +758,4 @@ c VARCHAR(255) NOT NULL, CONSTRAINT pk_b_c_id PRIMARY KEY (b,c), CONSTRAINT fk_a FOREIGN KEY(a) REFERENCES t1(a))engine=ndb; drop table t1, t2; +End of 5.1 tests diff --git a/mysql-test/r/rpl_switch_stm_row_mixed.result b/mysql-test/r/rpl_switch_stm_row_mixed.result index c319005b2a4..1ad199c6354 100644 --- a/mysql-test/r/rpl_switch_stm_row_mixed.result +++ b/mysql-test/r/rpl_switch_stm_row_mixed.result @@ -416,7 +416,7 @@ master-bin.000001 # Query 1 # use `mysqltest1`; CREATE TABLE `t2` ( master-bin.000001 # Table_map 1 # table_id: # (mysqltest1.t2) master-bin.000001 # Write_rows 1 # table_id: # flags: STMT_END_F master-bin.000001 # Query 1 # use `mysqltest1`; CREATE TABLE `t3` ( - `1` varbinary(108) NOT NULL DEFAULT '' + `1` varbinary(36) NOT NULL DEFAULT '' ) master-bin.000001 # Table_map 1 # table_id: # (mysqltest1.t3) master-bin.000001 # Write_rows 1 # table_id: # flags: STMT_END_F diff --git a/mysql-test/r/rpl_view.result b/mysql-test/r/rpl_view.result index 4e1a7153b65..9d3b05ef8d5 100644 --- a/mysql-test/r/rpl_view.result +++ b/mysql-test/r/rpl_view.result @@ -80,3 +80,4 @@ c ---> Cleaning up... DROP VIEW v1; DROP TABLE t1; +End of 5.0 tests diff --git a/mysql-test/r/show_check.result b/mysql-test/r/show_check.result index 465cb853581..80f28a3c731 100644 --- a/mysql-test/r/show_check.result +++ b/mysql-test/r/show_check.result @@ -668,6 +668,10 @@ View Create View v1 CREATE ALGORITHM=UNDEFINED DEFINER=`root`@`localhost` SQL SECURITY DEFINER VIEW `v1` AS select sql_cache 1 AS `1` DROP PROCEDURE p1; DROP VIEW v1; +SHOW TABLES FROM no_such_database; +ERROR 42000: Unknown database 'no_such_database' +SHOW COLUMNS FROM no_such_table; +ERROR 42S02: Table 'test.no_such_table' doesn't exist End of 5.0 tests. SHOW AUTHORS; create database mysqltest; @@ -692,20 +696,3 @@ Warning 1541 The syntax 'SHOW PLUGIN' is deprecated and will be removed in MySQL show plugin; show plugins; End of 5.1 tests -CREATE PROCEDURE p1() -BEGIN -SET @s= 'CREATE VIEW v1 AS SELECT SQL_CACHE 1'; -PREPARE stmt FROM @s; -EXECUTE stmt; -DROP PREPARE stmt; -END | -CALL p1(); -SHOW CREATE VIEW v1; -View Create View -v1 CREATE ALGORITHM=UNDEFINED DEFINER=`root`@`localhost` SQL SECURITY DEFINER VIEW `v1` AS select sql_cache 1 AS `1` -DROP PROCEDURE p1; -DROP VIEW v1; -SHOW TABLES FROM no_such_database; -ERROR 42000: Unknown database 'no_such_database' -SHOW COLUMNS FROM no_such_table; -ERROR 42S02: Table 'test.no_such_table' doesn't exist diff --git a/mysql-test/r/sp-error.result b/mysql-test/r/sp-error.result index 2b01415c2d0..af27a4c74c2 100644 --- a/mysql-test/r/sp-error.result +++ b/mysql-test/r/sp-error.result @@ -1187,6 +1187,7 @@ END; ERROR 42000: You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near 'IF NOT EXISTS bug14702() BEGIN END' at line 1 +End of 5.0 tests drop function if exists bug16164; create function bug16164() returns int begin @@ -1199,3 +1200,4 @@ create function bug20701() returns varchar(25) binary return "test"| ERROR 42000: This version of MySQL doesn't yet support 'return value collation' create function bug20701() returns varchar(25) return "test"| drop function bug20701| +End of 5.1 tests diff --git a/mysql-test/r/sp-security.result b/mysql-test/r/sp-security.result index 5272bf47672..7729890ff02 100644 --- a/mysql-test/r/sp-security.result +++ b/mysql-test/r/sp-security.result @@ -441,6 +441,7 @@ SELECT Host,User,Password FROM mysql.user WHERE User='user19857'; Host User Password localhost user19857 *82DC221D557298F6CE9961037DB1C90604792F5C DROP USER user19857@localhost; +use test; DROP TABLE IF EXISTS t1; DROP VIEW IF EXISTS v1; DROP FUNCTION IF EXISTS f_suid; diff --git a/mysql-test/r/sp.result b/mysql-test/r/sp.result index e768ebe36b3..b516058eabd 100644 --- a/mysql-test/r/sp.result +++ b/mysql-test/r/sp.result @@ -5222,40 +5222,6 @@ CHARSET(p3) COLLATION(p3) greek greek_general_ci use test| DROP DATABASE mysqltest1| -drop procedure if exists bug19862| -CREATE TABLE t11 (a INT)| -CREATE TABLE t12 (a INT)| -CREATE FUNCTION bug19862(x INT) RETURNS INT -BEGIN -INSERT INTO t11 VALUES (x); -RETURN x+1; -END| -INSERT INTO t12 VALUES (1), (2)| -SELECT bug19862(a) FROM t12 ORDER BY 1| -bug19862(a) -2 -3 -SELECT * FROM t11| -a -1 -2 -DROP TABLE t11, t12| -DROP FUNCTION bug19862| -drop table if exists t3| -drop database if exists mysqltest1| -create table t3 (a int)| -insert into t3 (a) values (1), (2)| -create database mysqltest1| -use mysqltest1| -drop database mysqltest1| -select database()| -database() -NULL -select * from (select 1 as a) as t1 natural join (select * from test.t3) as t2| -a -1 -use test| -drop table t3| drop table if exists t3| drop database if exists mysqltest1| create table t3 (a int)| @@ -5290,4 +5256,5 @@ a 2 DROP TABLE t11, t12| DROP FUNCTION bug19862| +End of 5.0 tests drop table t1,t2; diff --git a/mysql-test/r/strict.result b/mysql-test/r/strict.result index 4a8ca484329..25475b8cd45 100644 --- a/mysql-test/r/strict.result +++ b/mysql-test/r/strict.result @@ -259,7 +259,7 @@ INSERT INTO t1 (col1) VALUES (CAST('2004-10-15' AS DATE)); INSERT INTO t1 (col2) VALUES (CAST('2004-10-15 10:15' AS DATETIME)); INSERT INTO t1 (col3) VALUES (CAST('2004-10-15 10:15' AS DATETIME)); INSERT INTO t1 (col1) VALUES(CAST('0000-10-31' AS DATE)); -ERROR 22007: Truncated incorrect datetime value: '0000-10-31' +ERROR 22007: Incorrect datetime value: '0000-10-31' INSERT INTO t1 (col1) VALUES(CAST('2004-10-0' AS DATE)); ERROR 22007: Incorrect date value: '2004-10-00' for column 'col1' at row 1 INSERT INTO t1 (col1) VALUES(CAST('2004-0-10' AS DATE)); @@ -267,7 +267,7 @@ ERROR 22007: Incorrect date value: '2004-00-10' for column 'col1' at row 1 INSERT INTO t1 (col1) VALUES(CAST('0000-00-00' AS DATE)); ERROR 22007: Incorrect datetime value: '0000-00-00' INSERT INTO t1 (col2) VALUES(CAST('0000-10-31 15:30' AS DATETIME)); -ERROR 22007: Truncated incorrect datetime value: '0000-10-31 15:30' +ERROR 22007: Incorrect datetime value: '0000-10-31 15:30' INSERT INTO t1 (col2) VALUES(CAST('2004-10-0 15:30' AS DATETIME)); ERROR 22007: Incorrect datetime value: '2004-10-00 15:30:00' for column 'col2' at row 1 INSERT INTO t1 (col2) VALUES(CAST('2004-0-10 15:30' AS DATETIME)); @@ -275,7 +275,7 @@ ERROR 22007: Incorrect datetime value: '2004-00-10 15:30:00' for column 'col2' a INSERT INTO t1 (col2) VALUES(CAST('0000-00-00' AS DATETIME)); ERROR 22007: Incorrect datetime value: '0000-00-00' INSERT INTO t1 (col3) VALUES(CAST('0000-10-31 15:30' AS DATETIME)); -ERROR 22007: Truncated incorrect datetime value: '0000-10-31 15:30' +ERROR 22007: Incorrect datetime value: '0000-10-31 15:30' INSERT INTO t1 (col3) VALUES(CAST('2004-10-0 15:30' AS DATETIME)); ERROR 22007: Incorrect datetime value: '2004-10-00 15:30:00' for column 'col3' at row 1 INSERT INTO t1 (col3) VALUES(CAST('2004-0-10 15:30' AS DATETIME)); @@ -288,7 +288,7 @@ INSERT INTO t1 (col1) VALUES (CONVERT('2004-10-15',DATE)); INSERT INTO t1 (col2) VALUES (CONVERT('2004-10-15 10:15',DATETIME)); INSERT INTO t1 (col3) VALUES (CONVERT('2004-10-15 10:15',DATETIME)); INSERT INTO t1 (col1) VALUES(CONVERT('0000-10-31' , DATE)); -ERROR 22007: Truncated incorrect datetime value: '0000-10-31' +ERROR 22007: Incorrect datetime value: '0000-10-31' INSERT INTO t1 (col1) VALUES(CONVERT('2004-10-0' , DATE)); ERROR 22007: Incorrect date value: '2004-10-00' for column 'col1' at row 1 INSERT INTO t1 (col1) VALUES(CONVERT('2004-0-10' , DATE)); @@ -296,7 +296,7 @@ ERROR 22007: Incorrect date value: '2004-00-10' for column 'col1' at row 1 INSERT INTO t1 (col1) VALUES(CONVERT('0000-00-00',DATE)); ERROR 22007: Incorrect datetime value: '0000-00-00' INSERT INTO t1 (col2) VALUES(CONVERT('0000-10-31 15:30',DATETIME)); -ERROR 22007: Truncated incorrect datetime value: '0000-10-31 15:30' +ERROR 22007: Incorrect datetime value: '0000-10-31 15:30' INSERT INTO t1 (col2) VALUES(CONVERT('2004-10-0 15:30',DATETIME)); ERROR 22007: Incorrect datetime value: '2004-10-00 15:30:00' for column 'col2' at row 1 INSERT INTO t1 (col2) VALUES(CONVERT('2004-0-10 15:30',DATETIME)); @@ -304,7 +304,7 @@ ERROR 22007: Incorrect datetime value: '2004-00-10 15:30:00' for column 'col2' a INSERT INTO t1 (col2) VALUES(CONVERT('0000-00-00',DATETIME)); ERROR 22007: Incorrect datetime value: '0000-00-00' INSERT INTO t1 (col3) VALUES(CONVERT('0000-10-31 15:30',DATETIME)); -ERROR 22007: Truncated incorrect datetime value: '0000-10-31 15:30' +ERROR 22007: Incorrect datetime value: '0000-10-31 15:30' INSERT INTO t1 (col3) VALUES(CONVERT('2004-10-0 15:30',DATETIME)); ERROR 22007: Incorrect datetime value: '2004-10-00 15:30:00' for column 'col3' at row 1 INSERT INTO t1 (col3) VALUES(CONVERT('2004-0-10 15:30',DATETIME)); diff --git a/mysql-test/r/type_datetime.result b/mysql-test/r/type_datetime.result index 3ae224879df..ec3761a6a57 100644 --- a/mysql-test/r/type_datetime.result +++ b/mysql-test/r/type_datetime.result @@ -27,7 +27,7 @@ test.t1 check status OK delete from t1; insert into t1 values("000101"),("691231"),("700101"),("991231"),("00000101"),("00010101"),("99991231"),("00101000000"),("691231000000"),("700101000000"),("991231235959"),("10000101000000"),("99991231235959"),("20030100000000"),("20030000000000"); Warnings: -Warning 1264 Out of range value adjusted for column 't' at row 5 +Warning 1264 Out of range value for column 't' at row 5 insert into t1 values ("2003-003-03"); insert into t1 values ("20030102T131415"),("2001-01-01T01:01:01"), ("2001-1-1T1:01:01"); select * from t1; diff --git a/mysql-test/r/union.result b/mysql-test/r/union.result index 42fbf0f6ff1..58a217f4b14 100644 --- a/mysql-test/r/union.result +++ b/mysql-test/r/union.result @@ -1318,7 +1318,7 @@ t2 CREATE TABLE `t2` ( `f5` timestamp NOT NULL DEFAULT '0000-00-00 00:00:00', `f6` varchar(1) CHARACTER SET utf8 DEFAULT NULL, `f7` text, - `f8` mediumtext character set utf8 + `f8` mediumtext CHARACTER SET utf8 ) ENGINE=MyISAM DEFAULT CHARSET=latin1 drop table t1, t2; (select avg(1)) union (select avg(1)) union (select avg(1)) union diff --git a/mysql-test/t/mysqlcheck.test b/mysql-test/t/mysqlcheck.test index a96dbc74591..074faa48021 100644 --- a/mysql-test/t/mysqlcheck.test +++ b/mysql-test/t/mysqlcheck.test @@ -11,6 +11,7 @@ drop database if exists client_test_db; DROP SCHEMA test; CREATE SCHEMA test; +use test; # # Bug #13783 mysqlcheck tries to optimize and analyze information_schema # diff --git a/mysql-test/t/mysqldump.test b/mysql-test/t/mysqldump.test index b0cb93ccd85..1794acea0dc 100644 --- a/mysql-test/t/mysqldump.test +++ b/mysql-test/t/mysqldump.test @@ -1318,7 +1318,9 @@ grant RELOAD on *.* to mysqltest_1@localhost; grant REPLICATION CLIENT on *.* to mysqltest_1@localhost; # Execute mysqldump, should now succeed +--disable_result_log --exec $MYSQL_DUMP --compact --master-data -u mysqltest_1 test 2>&1 +--enable_result_log # Clean up drop table t1; diff --git a/mysql-test/t/sp-security.test b/mysql-test/t/sp-security.test index 0bb8c8bd48f..f994f61a665 100644 --- a/mysql-test/t/sp-security.test +++ b/mysql-test/t/sp-security.test @@ -720,7 +720,6 @@ DROP USER mysqltest_2@localhost; DROP DATABASE mysqltest; - # # Bug#19857 - When a user with CREATE ROUTINE priv creates a routine, # it results in NULL p/w @@ -769,7 +768,7 @@ DROP USER user19857@localhost; --disconnect con1root --connection default - +use test; # # BUG#18630: Arguments of suid routine calculated in wrong security diff --git a/sql/item_sum.cc b/sql/item_sum.cc index ee23139d79a..58935337aa0 100644 --- a/sql/item_sum.cc +++ b/sql/item_sum.cc @@ -1280,7 +1280,7 @@ Field *Item_sum_variance::create_tmp_field(bool group, TABLE *table, } else { - field= new Field_double(max_length, maybe_null,name,table,decimals); + field= new Field_double(max_length, maybe_null,name, decimals); } if (field) field->init(table); diff --git a/sql/sp_head.cc b/sql/sp_head.cc index c967a82cffe..b88ff13cd7a 100644 --- a/sql/sp_head.cc +++ b/sql/sp_head.cc @@ -519,6 +519,8 @@ sp_head::init_sp_name(THD *thd, sp_name *spname) m_qname.length= spname->m_qname.length; m_qname.str= strmake_root(thd->mem_root, spname->m_qname.str, m_qname.length); + + DBUG_VOID_RETURN; } @@ -1284,29 +1286,6 @@ sp_head::execute_trigger(THD *thd, const char *db, const char *table, DBUG_ENTER("sp_head::execute_trigger"); DBUG_PRINT("info", ("trigger %s", m_name.str)); -#ifndef NO_EMBEDDED_ACCESS_CHECKS - Security_context *save_ctx; - if (sp_change_security_context(thd, this, &save_ctx)) - DBUG_RETURN(TRUE); - - /* - NOTE: TRIGGER_ACL should be used here. - */ - if (check_global_access(thd, SUPER_ACL)) - { - sp_restore_security_context(thd, save_ctx); - DBUG_RETURN(TRUE); - } - - /* - Fetch information about table-level privileges to GRANT_INFO - structure for subject table. Check of privileges that will use it - and information about column-level privileges will happen in - Item_trigger_field::fix_fields(). - */ - fill_effective_table_privileges(thd, grant_info, db, table); -#endif // NO_EMBEDDED_ACCESS_CHECKS - /* Prepare arena and memroot for objects which lifetime is whole duration of trigger call (sp_rcontext, it's tables and items, @@ -1339,9 +1318,6 @@ sp_head::execute_trigger(THD *thd, const char *db, const char *table, err_with_cleanup: thd->restore_active_arena(&call_arena, &backup_arena); -#ifndef NO_EMBEDDED_ACCESS_CHECKS - sp_restore_security_context(thd, save_ctx); -#endif // NO_EMBEDDED_ACCESS_CHECKS delete nctx; call_arena.free_items(); free_root(&call_mem_root, MYF(0)); @@ -1810,6 +1786,7 @@ sp_head::reset_lex(THD *thd) sublex->ptr= oldlex->ptr; sublex->end_of_query= oldlex->end_of_query; sublex->tok_start= oldlex->tok_start; + sublex->tok_end= oldlex->tok_end; sublex->yylineno= oldlex->yylineno; /* And keep the SP stuff too */ sublex->sphead= oldlex->sphead; @@ -1845,6 +1822,7 @@ sp_head::restore_lex(THD *thd) // Update some state in the old one first oldlex->ptr= sublex->ptr; + oldlex->tok_end= sublex->tok_end; oldlex->next_state= sublex->next_state; oldlex->trg_table_fields.push_back(&sublex->trg_table_fields); diff --git a/sql/sql_db.cc b/sql/sql_db.cc index b055957259c..1bfa3fb99c7 100644 --- a/sql/sql_db.cc +++ b/sql/sql_db.cc @@ -530,10 +530,12 @@ bool load_db_opt_by_name(THD *thd, const char *db_name, { char db_opt_path[FN_REFLEN]; - strxnmov(db_opt_path, sizeof (db_opt_path) - 1, mysql_data_home, "/", - db_name, "/", MY_DB_OPT_FILE, NullS); - - unpack_filename(db_opt_path, db_opt_path); + /* + Pass an empty file name, and the database options file name as extension + to avoid table name to file name encoding. + */ + (void) build_table_filename(db_opt_path, sizeof(db_opt_path), + db_name, "", MY_DB_OPT_FILE); return load_db_opt(thd, db_opt_path, db_create_info); } @@ -1726,8 +1728,8 @@ bool check_db_dir_existence(const char *db_name) char db_dir_path[FN_REFLEN]; uint db_dir_path_len; - db_dir_path_length= build_table_filename(path, sizeof(path), - db_name, "", "", 0); + db_dir_path_len= build_table_filename(db_dir_path, sizeof(db_dir_path), + db_name, "", ""); if (db_dir_path_len && db_dir_path[db_dir_path_len - 1] == FN_LIBCHAR) db_dir_path[db_dir_path_len - 1]= 0; diff --git a/sql/sql_lex.cc b/sql/sql_lex.cc index 9ee67413e40..bf0da9d46ef 100644 --- a/sql/sql_lex.cc +++ b/sql/sql_lex.cc @@ -1077,7 +1077,7 @@ int MYSQLlex(void *arg, void *yythd) Pointer to the last non-comment symbol of the statement. */ -uchar *skip_rear_comments(uchar *begin, uchar *end) +const uchar *skip_rear_comments(const uchar *begin, const uchar *end) { while (begin < end && (end[-1] <= ' ' || end[-1] == '*' || end[-1] == '/' || end[-1] == ';')) diff --git a/sql/sql_lex.h b/sql/sql_lex.h index 498bba267ed..9f6df9861e2 100644 --- a/sql/sql_lex.h +++ b/sql/sql_lex.h @@ -1190,6 +1190,6 @@ extern void lex_free(void); extern void lex_start(THD *thd, const uchar *buf, uint length); extern void lex_end(LEX *lex); extern int MYSQLlex(void *arg, void *yythd); -extern uchar *skip_rear_comments(uchar *begin, uchar *end); +extern const uchar *skip_rear_comments(const uchar *ubegin, const uchar *uend); #endif /* MYSQL_SERVER */ diff --git a/sql/sql_show.cc b/sql/sql_show.cc index 6a8124e485f..2991c6ddad1 100644 --- a/sql/sql_show.cc +++ b/sql/sql_show.cc @@ -716,22 +716,6 @@ bool mysqld_show_create_db(THD *thd, char *dbname, } else { - (void) sprintf(path,"%s/%s",mysql_data_home, dbname); - length=unpack_dirname(path,path); // Convert if not unix - found_libchar= 0; - if (length && path[length-1] == FN_LIBCHAR) - { - found_libchar= 1; - path[length-1]=0; // remove ending '\' - } - if (access(path,F_OK)) - length= build_table_filename(path, sizeof(path), dbname, "", ""); - found_libchar= 0; - if (length && path[length-1] == FN_LIBCHAR) - { - found_libchar= 1; - path[length-1]=0; // remove ending '\' - } if (check_db_dir_existence(dbname)) { my_error(ER_BAD_DB_ERROR, MYF(0), dbname); @@ -2603,7 +2587,7 @@ int get_all_tables(THD *thd, TABLE_LIST *tables, COND *cond) may have dropped database, and we may still have a name for that directory. */ - if (res == FIND_FILES_DIR && lex->orig_sql_command == SQLCOM_END) + if (res == FIND_FILES_DIR && lex->sql_command == SQLCOM_END) { push_warning(thd, MYSQL_ERROR::WARN_LEVEL_WARN, thd->net.last_errno, thd->net.last_error); diff --git a/sql/sql_trigger.cc b/sql/sql_trigger.cc index 6af88541c86..a6324db2871 100644 --- a/sql/sql_trigger.cc +++ b/sql/sql_trigger.cc @@ -1499,12 +1499,47 @@ bool Table_triggers_list::process_triggers(THD *thd, trg_event_type event, new_field= record1_field; old_field= table->field; } +#ifndef NO_EMBEDDED_ACCESS_CHECKS + Security_context *save_ctx; + + if (sp_change_security_context(thd, sp_trigger, &save_ctx)) + return TRUE; + + /* + Fetch information about table-level privileges to GRANT_INFO structure for + subject table. Check of privileges that will use it and information about + column-level privileges will happen in Item_trigger_field::fix_fields(). + */ + + fill_effective_table_privileges(thd, + &subject_table_grants[event][time_type], + table->s->db.str, table->s->table_name.str); + + /* Check that the definer has TRIGGER privilege on the subject table. */ + + if (!(subject_table_grants[event][time_type].privilege & TRIGGER_ACL)) + { + char priv_desc[128]; + get_privilege_desc(priv_desc, sizeof(priv_desc), TRIGGER_ACL); + + my_error(ER_TABLEACCESS_DENIED_ERROR, MYF(0), priv_desc, + thd->security_ctx->priv_user, thd->security_ctx->host_or_ip, + table->s->table_name.str); + + sp_restore_security_context(thd, save_ctx); + return TRUE; + } +#endif // NO_EMBEDDED_ACCESS_CHECKS thd->reset_sub_statement_state(&statement_state, SUB_STMT_TRIGGER); err_status= sp_trigger->execute_trigger - (thd, table->s->db, table->s->table_name, + (thd, table->s->db.str, table->s->table_name.str, &subject_table_grants[event][time_type]); thd->restore_sub_statement_state(&statement_state); + +#ifndef NO_EMBEDDED_ACCESS_CHECKS + sp_restore_security_context(thd, save_ctx); +#endif // NO_EMBEDDED_ACCESS_CHECKS } return err_status; diff --git a/sql/sql_view.cc b/sql/sql_view.cc index 1a83547816b..6d5f910180d 100644 --- a/sql/sql_view.cc +++ b/sql/sql_view.cc @@ -648,6 +648,7 @@ static int mysql_register_view(THD *thd, TABLE_LIST *view, char md5[MD5_BUFF_LENGTH]; bool can_be_merged; char dir_buff[FN_REFLEN], file_buff[FN_REFLEN], path_buff[FN_REFLEN]; + const uchar *endp; LEX_STRING dir, file, path; DBUG_ENTER("mysql_register_view"); @@ -731,10 +732,9 @@ static int mysql_register_view(THD *thd, TABLE_LIST *view, view->query.str= (char*)str.ptr(); view->query.length= str.length()-1; // we do not need last \0 view->source.str= thd->query + thd->lex->create_view_select_start; - view->source.length= (char *)skip_rear_comments((uchar *)view->source.str, - (uchar *)thd->query + - thd->query_length) - - view->source.str; + endp= (uchar*) view->source.str; + endp= skip_rear_comments(endp, (uchar*) (thd->query + thd->query_length)); + view->source.length= endp - (uchar*) view->source.str; view->file_version= 1; view->calc_md5(md5); view->md5.str= md5; diff --git a/sql/sql_yacc.yy b/sql/sql_yacc.yy index 14530e3ed12..20c55fd22eb 100644 --- a/sql/sql_yacc.yy +++ b/sql/sql_yacc.yy @@ -1530,7 +1530,7 @@ ev_sql_stmt: { sp_head *sp= lex->sphead; // return back to the original memory root ASAP - sp->init_strings(YYTHD, lex, NULL); + sp->init_strings(YYTHD, lex); sp->restore_thd_mem_root(YYTHD); lex->sp_chistics.suid= SP_IS_SUID;//always the definer! |