diff --git a/mysql-test/r/analyze_stmt_slow_query_log.result b/mysql-test/r/analyze_stmt_slow_query_log.result index 2a924d7c658..41ab4feaf91 100644 --- a/mysql-test/r/analyze_stmt_slow_query_log.result +++ b/mysql-test/r/analyze_stmt_slow_query_log.result @@ -8,8 +8,6 @@ a 2 drop table t1; # explain: id select_type table type possible_keys key key_len ref rows r_rows filtered r_filtered Extra -# explain: 1 SIMPLE NULL NULL NULL NULL NULL NULL NULL NULL NULL NULL No tables used -# explain: id select_type table type possible_keys key key_len ref rows r_rows filtered r_filtered Extra # explain: 1 INSERT t1 ALL NULL NULL NULL NULL NULL NULL 100.00 100.00 NULL # explain: id select_type table type possible_keys key key_len ref rows r_rows filtered r_filtered Extra # explain: 1 SIMPLE t1 ALL NULL NULL NULL NULL 10 10 100.00 30.00 Using where diff --git a/mysql-test/r/func_misc.result b/mysql-test/r/func_misc.result index 5ae9ae1f0e8..7c01c8a0bde 100644 --- a/mysql-test/r/func_misc.result +++ b/mysql-test/r/func_misc.result @@ -1169,6 +1169,46 @@ INET6_NTOA(ip) HEX(ip) LENGTH(ip) DROP TABLE t1; DROP TABLE t2; +# +# MDEV-4018 : Microseconds in GET_LOCK() +# +# -> Switching to connection 'default' +select is_used_lock('test') = connection_id(); +is_used_lock('test') = connection_id() +NULL +# GET_LOCK returns 1 if it manages to acquire a lock +select get_lock('test', 0); +get_lock('test', 0) +1 +# -> Switching to connection 'con1' +select is_used_lock('test') = connection_id(); +is_used_lock('test') = connection_id() +0 +select get_lock('test', 0); +get_lock('test', 0) +0 +select get_lock('test', 1.0); +get_lock('test', 1.0) +0 +select get_lock('test', 1.5); +get_lock('test', 1.5) +0 +select get_lock('test', 0.1); +get_lock('test', 0.1) +0 +select get_lock('test', 0.000001); +get_lock('test', 0.000001) +0 +select get_lock('test', 0.0000000000000001); +get_lock('test', 0.0000000000000001) +0 +# -> Switching to connection 'default' +select is_used_lock('test') = connection_id(); +is_used_lock('test') = connection_id() +1 +select release_lock('test'); +release_lock('test') +1 # -- Done. diff --git a/mysql-test/r/gis.result b/mysql-test/r/gis.result index 70e52154082..baedf17152c 100644 --- a/mysql-test/r/gis.result +++ b/mysql-test/r/gis.result @@ -1326,6 +1326,18 @@ WHERE name = 'Route 5' AND aliases = 'Main Street'; IsEmpty(centerline) 0 +# Conformance Item T12 +SELECT IsSimple(shore) +FROM lakes +WHERE name = 'Blue Lake'; +IsSimple(shore) +1 +# Conformance Item T13 +SELECT AsText(ST_Boundary(boundary)) +FROM named_places +WHERE name = 'Goose Island'; +AsText(ST_Boundary(boundary)) +LINESTRING(67 13,67 18,59 18,59 13,67 13) # Conformance Item T14 SELECT AsText(Envelope(boundary)) FROM named_places @@ -1356,6 +1368,17 @@ FROM road_segments WHERE fid = 102; AsText(EndPoint(centerline)) POINT(44 31) +SELECT IsClosed(LineFromWKB(AsBinary(Boundary(boundary)),SRID(boundary))) +FROM named_places +WHERE name = 'Goose Island'; +IsClosed(LineFromWKB(AsBinary(Boundary(boundary)),SRID(boundary))) +1 +# Conformance Item T20 +SELECT IsRing(LineFromWKB(AsBinary(Boundary(boundary)),SRID(boundary))) +FROM named_places +WHERE name = 'Goose Island'; +IsRing(LineFromWKB(AsBinary(Boundary(boundary)),SRID(boundary))) +0 # Conformance Item T21 SELECT GLength(centerline) FROM road_segments @@ -1380,6 +1403,11 @@ FROM named_places WHERE name = 'Goose Island'; AsText(Centroid(boundary)) POINT(63 15.5) +SELECT ST_Contains(boundary, PointOnSurface(boundary)) +FROM named_places +WHERE name = 'Goose Island'; +ST_Contains(boundary, PointOnSurface(boundary)) +1 # Conformance Item T26 SELECT Area(boundary) FROM named_places @@ -1434,6 +1462,12 @@ FROM ponds WHERE fid = 120; AsText(Centroid(shores)) POINT(25 42) +# Conformance Item T35 +SELECT Contains(shores, PointOnSurface(shores)) +FROM ponds +WHERE fid = 120; +Contains(shores, PointOnSurface(shores)) +1 # Conformance Item T36 SELECT Area(shores) FROM ponds @@ -1462,6 +1496,20 @@ WHERE streams.name = 'Cam Stream' AND lakes.name = 'Blue Lake'; ST_Touches(centerline, shore) 1 +# Conformance Item T40 +SELECT ST_Within(footprint, boundary) +FROM named_places, buildings +WHERE named_places.name = 'Ashton' +AND buildings.address = '215 Main Street'; +ST_Within(footprint, boundary) +1 +# Conformance Item T41 +SELECT ST_Overlaps(forests.boundary, named_places.boundary) +FROM forests, named_places +WHERE forests.name = 'Green Forest' +AND named_places.name = 'Ashton'; +ST_Overlaps(forests.boundary, named_places.boundary) +1 # Conformance Item T42 SELECT Crosses(road_segments.centerline, divided_routes.centerlines) FROM road_segments, divided_routes @@ -1483,6 +1531,13 @@ WHERE forests.name = 'Green Forest' AND named_places.name = 'Ashton'; ST_Contains(forests.boundary, named_places.boundary) 0 +# Conformance Item T45 +SELECT ST_Relate(forests.boundary, named_places.boundary, 'TTTTTTTTT') +FROM forests, named_places +WHERE forests.name = 'Green Forest' +AND named_places.name = 'Ashton'; +ST_Relate(forests.boundary, named_places.boundary, 'TTTTTTTTT') +1 # Conformance Item T46 SELECT ST_Distance(position, boundary) FROM bridges, named_places @@ -1490,6 +1545,13 @@ WHERE bridges.name = 'Cam Bridge' AND named_places.name = 'Ashton'; ST_Distance(position, boundary) 12 +# Conformance Item T47 +SELECT AsText(ST_Intersection(centerline, shore)) +FROM streams, lakes +WHERE streams.name = 'Cam Stream' +AND lakes.name = 'Blue Lake'; +AsText(ST_Intersection(centerline, shore)) +POINT(52 18) # Conformance Item T48 SELECT AsText(ST_Difference(named_places.boundary, forests.boundary)) FROM named_places, forests @@ -1516,6 +1578,12 @@ FROM buildings, bridges WHERE ST_Contains(ST_Buffer(bridges.position, 15.0), buildings.footprint) = 1; count(*) 1 +# Conformance Item T52 +SELECT AsText(ConvexHull(shore)) +FROM lakes +WHERE lakes.name = 'Blue Lake'; +AsText(ConvexHull(shore)) +POLYGON((48 6,52 18,66 23,73 9,48 6)) DROP DATABASE gis_ogs; USE test; # diff --git a/mysql-test/r/log_slow.result b/mysql-test/r/log_slow.result index ca8b9e7c439..f7670f3d3db 100644 --- a/mysql-test/r/log_slow.result +++ b/mysql-test/r/log_slow.result @@ -56,6 +56,7 @@ insert_id int(11) NO NULL server_id int(10) unsigned NO NULL sql_text mediumtext NO NULL thread_id bigint(21) unsigned NO NULL +rows_affected int(11) NO NULL flush slow logs; set long_query_time=0.1; set log_slow_filter=''; diff --git a/mysql-test/r/log_state.result b/mysql-test/r/log_state.result index f157887de4b..6e3ab8a991a 100644 --- a/mysql-test/r/log_state.result +++ b/mysql-test/r/log_state.result @@ -39,7 +39,7 @@ select sleep(@long_query_time + 1); sleep(@long_query_time + 1) 0 select * from mysql.slow_log where sql_text NOT LIKE '%slow_log%'; -start_time user_host query_time lock_time rows_sent rows_examined db last_insert_id insert_id server_id sql_text thread_id +start_time user_host query_time lock_time rows_sent rows_examined db last_insert_id insert_id server_id sql_text thread_id rows_affected # Switch to connection default set global slow_query_log= ON; set local slow_query_log= ON; @@ -49,14 +49,14 @@ select sleep(@long_query_time + 1); sleep(@long_query_time + 1) 0 select * from mysql.slow_log where sql_text NOT LIKE '%slow_log%'; -start_time user_host query_time lock_time rows_sent rows_examined db last_insert_id insert_id server_id sql_text thread_id +start_time user_host query_time lock_time rows_sent rows_examined db last_insert_id insert_id server_id sql_text thread_id rows_affected set local slow_query_log= ON; select sleep(@long_query_time + 2); sleep(@long_query_time + 2) 0 select * from mysql.slow_log where sql_text NOT LIKE '%slow_log%'; -start_time user_host query_time lock_time rows_sent rows_examined db last_insert_id insert_id server_id sql_text thread_id -TIMESTAMP USER_HOST QUERY_TIME 00:00:00.000000 1 0 test 0 0 1 select sleep(@long_query_time + 2) THREAD_ID +start_time user_host query_time lock_time rows_sent rows_examined db last_insert_id insert_id server_id sql_text thread_id rows_affected +TIMESTAMP USER_HOST QUERY_TIME 00:00:00.000000 1 0 test 0 0 1 select sleep(@long_query_time + 2) THREAD_ID 0 # Switch to connection default show global variables where Variable_name = 'general_log' or Variable_name = 'slow_query_log'; diff --git a/mysql-test/r/log_tables.result b/mysql-test/r/log_tables.result index 4471c01c99b..8e39ed861bd 100644 --- a/mysql-test/r/log_tables.result +++ b/mysql-test/r/log_tables.result @@ -17,7 +17,7 @@ event_time user_host thread_id server_id command_type argument TIMESTAMP USER_HOST THREAD_ID 1 Query select * from general_log truncate table slow_log; select * from slow_log; -start_time user_host query_time lock_time rows_sent rows_examined db last_insert_id insert_id server_id sql_text thread_id +start_time user_host query_time lock_time rows_sent rows_examined db last_insert_id insert_id server_id sql_text thread_id rows_affected truncate table general_log; select * from general_log where argument like '%general_log%'; event_time user_host thread_id server_id command_type argument @@ -82,7 +82,8 @@ slow_log CREATE TABLE `slow_log` ( `insert_id` int(11) NOT NULL, `server_id` int(10) unsigned NOT NULL, `sql_text` mediumtext NOT NULL, - `thread_id` bigint(21) unsigned NOT NULL + `thread_id` bigint(21) unsigned NOT NULL, + `rows_affected` int(11) NOT NULL ) ENGINE=CSV DEFAULT CHARSET=utf8 COMMENT='Slow log' show fields from mysql.slow_log; Field Type Null Key Default Extra @@ -98,6 +99,7 @@ insert_id int(11) NO NULL server_id int(10) unsigned NO NULL sql_text mediumtext NO NULL thread_id bigint(21) unsigned NO NULL +rows_affected int(11) NO NULL flush logs; flush tables; SET GLOBAL GENERAL_LOG=ON; @@ -148,8 +150,8 @@ select sleep(2); sleep(2) 0 select * from mysql.slow_log; -start_time user_host query_time lock_time rows_sent rows_examined db last_insert_id insert_id server_id sql_text thread_id -TIMESTAMP USER_HOST QUERY_TIME 00:00:00.000000 1 0 mysql 0 0 1 select sleep(2) THREAD_ID +start_time user_host query_time lock_time rows_sent rows_examined db last_insert_id insert_id server_id sql_text thread_id rows_affected +TIMESTAMP USER_HOST QUERY_TIME 00:00:00.000000 1 0 mysql 0 0 1 select sleep(2) THREAD_ID 0 set @@session.long_query_time = @saved_long_query_time; alter table mysql.general_log engine=myisam; ERROR HY000: You cannot 'ALTER' a log table if logging is enabled @@ -187,7 +189,8 @@ slow_log CREATE TABLE `slow_log` ( `insert_id` int(11) NOT NULL, `server_id` int(10) unsigned NOT NULL, `sql_text` mediumtext NOT NULL, - `thread_id` bigint(21) unsigned NOT NULL + `thread_id` bigint(21) unsigned NOT NULL, + `rows_affected` int(11) NOT NULL ) ENGINE=CSV DEFAULT CHARSET=utf8 COMMENT='Slow log' alter table mysql.general_log engine=myisam; alter table mysql.slow_log engine=myisam; @@ -215,7 +218,8 @@ slow_log CREATE TABLE `slow_log` ( `insert_id` int(11) NOT NULL, `server_id` int(10) unsigned NOT NULL, `sql_text` mediumtext NOT NULL, - `thread_id` bigint(21) unsigned NOT NULL + `thread_id` bigint(21) unsigned NOT NULL, + `rows_affected` int(11) NOT NULL ) ENGINE=MyISAM DEFAULT CHARSET=utf8 COMMENT='Slow log' set global general_log='ON'; set global slow_query_log='ON'; @@ -286,7 +290,8 @@ ON UPDATE CURRENT_TIMESTAMP, `insert_id` int(11) NOT NULL, `server_id` int(10) unsigned NOT NULL, `sql_text` mediumtext NOT NULL, -`thread_id` BIGINT(21) UNSIGNED NOT NULL +`thread_id` BIGINT(21) UNSIGNED NOT NULL, +`rows_affected` int(11) NOT NULL ) ENGINE=CSV DEFAULT CHARSET=utf8 COMMENT='Slow log'; set global general_log='ON'; set global slow_query_log='ON'; @@ -313,7 +318,7 @@ event_time user_host thread_id server_id command_type argument TIMESTAMP USER_HOST THREAD_ID 1 Query select * from general_log truncate table slow_log; select * from slow_log; -start_time user_host query_time lock_time rows_sent rows_examined db last_insert_id insert_id server_id sql_text thread_id +start_time user_host query_time lock_time rows_sent rows_examined db last_insert_id insert_id server_id sql_text thread_id rows_affected create table general_log_new like general_log; rename table general_log TO renamed_general_log, general_log_new TO general_log; create table slow_log_new like slow_log; @@ -334,9 +339,9 @@ TIMESTAMP USER_HOST THREAD_ID 1 Query select * from slow_log TIMESTAMP USER_HOST THREAD_ID 1 Query create table general_log_new like general_log TIMESTAMP USER_HOST THREAD_ID 1 Query rename table general_log TO renamed_general_log, general_log_new TO general_log select * from slow_log; -start_time user_host query_time lock_time rows_sent rows_examined db last_insert_id insert_id server_id sql_text thread_id +start_time user_host query_time lock_time rows_sent rows_examined db last_insert_id insert_id server_id sql_text thread_id rows_affected select * from renamed_slow_log; -start_time user_host query_time lock_time rows_sent rows_examined db last_insert_id insert_id server_id sql_text thread_id +start_time user_host query_time lock_time rows_sent rows_examined db last_insert_id insert_id server_id sql_text thread_id rows_affected set global general_log='OFF'; RENAME TABLE general_log TO general_log2; set global slow_query_log='OFF'; @@ -429,10 +434,10 @@ SELECT "My own slow query", sleep(2); My own slow query sleep(2) My own slow query 0 SELECT * FROM mysql.slow_log WHERE seq >= 2 LIMIT 3; -start_time user_host query_time lock_time rows_sent rows_examined db last_insert_id insert_id server_id sql_text thread_id seq -START_TIME USER_HOST QUERY_TIME 00:00:00.000000 1 0 test 0 0 1 SELECT "My own slow query", sleep(2) 3 2 -START_TIME USER_HOST QUERY_TIME 00:00:00.000000 1 0 test 0 0 1 SELECT "My own slow query", sleep(2) 3 3 -START_TIME USER_HOST QUERY_TIME 00:00:00.000000 1 0 test 0 0 1 SELECT "My own slow query", sleep(2) 3 4 +start_time user_host query_time lock_time rows_sent rows_examined db last_insert_id insert_id server_id sql_text thread_id rows_affected seq +START_TIME USER_HOST QUERY_TIME 00:00:00.000000 1 0 test 0 0 1 SELECT "My own slow query", sleep(2) 3 0 2 +START_TIME USER_HOST QUERY_TIME 00:00:00.000000 1 0 test 0 0 1 SELECT "My own slow query", sleep(2) 3 0 3 +START_TIME USER_HOST QUERY_TIME 00:00:00.000000 1 0 test 0 0 1 SELECT "My own slow query", sleep(2) 3 0 4 SET GLOBAL slow_query_log = 0; SET SESSION long_query_time =@saved_long_query_time; FLUSH LOGS; @@ -550,7 +555,7 @@ CREATE procedure `db_17876.archiveSlowLog`() BEGIN DECLARE start_time, query_time, lock_time CHAR(28); DECLARE user_host MEDIUMTEXT; -DECLARE rows_set, rows_examined, last_insert_id, insert_id, server_id INT; +DECLARE rows_set, rows_examined, last_insert_id, insert_id, server_id, rows_affected INT; DECLARE thread_id BIGINT UNSIGNED; DECLARE dbname MEDIUMTEXT; DECLARE sql_text BLOB; @@ -565,14 +570,15 @@ DECLARE CONTINUE HANDLER FOR ER_SP_FETCH_NO_DATA SET done = 1; FETCH cur1 INTO start_time, user_host, query_time, lock_time, rows_set, rows_examined, dbname, last_insert_id, -insert_id, server_id, sql_text, thread_id; +insert_id, server_id, sql_text, thread_id, rows_affected; END; IF NOT done THEN BEGIN INSERT INTO `db_17876.slow_log_data` VALUES(start_time, user_host, query_time, lock_time, rows_set, rows_examined, -dbname, last_insert_id, insert_id, server_id, sql_text, thread_id); +dbname, last_insert_id, insert_id, server_id, sql_text, thread_id, +rows_affected); END; END IF; END; diff --git a/mysql-test/r/mysqldump.result b/mysql-test/r/mysqldump.result index a7ef5d4d92f..a967af77a8d 100644 --- a/mysql-test/r/mysqldump.result +++ b/mysql-test/r/mysqldump.result @@ -5264,7 +5264,8 @@ slow_log CREATE TABLE `slow_log` ( `insert_id` int(11) NOT NULL, `server_id` int(10) unsigned NOT NULL, `sql_text` mediumtext NOT NULL, - `thread_id` bigint(21) unsigned NOT NULL + `thread_id` bigint(21) unsigned NOT NULL, + `rows_affected` int(11) NOT NULL ) ENGINE=CSV DEFAULT CHARSET=utf8 COMMENT='Slow log' SET @@global.log_output= @old_log_output_state; SET @@global.slow_query_log= @old_slow_query_log_state; diff --git a/mysql-test/r/set_statement.result b/mysql-test/r/set_statement.result index efe5286147c..b7465499a35 100644 --- a/mysql-test/r/set_statement.result +++ b/mysql-test/r/set_statement.result @@ -1020,24 +1020,6 @@ t1 CREATE TABLE `t1` ( ) ENGINE=MyISAM DEFAULT CHARSET=latin1 drop table t1; SET @@default_storage_engine=@save_dfs; -SELECT @@MAX_STATEMENT_TIME; -@@MAX_STATEMENT_TIME -0.000000 -SET STATEMENT MAX_STATEMENT_TIME=2 FOR SELECT SLEEP(1); -SLEEP(1) -0 -SHOW STATUS LIKE "max_statement_time_exceeded"; -Variable_name Value -Max_statement_time_exceeded 0 -SET STATEMENT MAX_STATEMENT_TIME=2 FOR SELECT SLEEP(3); -SLEEP(3) -1 -SHOW STATUS LIKE "max_statement_time_exceeded"; -Variable_name Value -Max_statement_time_exceeded 1 -SELECT @@MAX_STATEMENT_TIME; -@@MAX_STATEMENT_TIME -0.000000 SET STATEMENT keycache1.key_buffer_size=1024 FOR SELECT 1; ERROR HY000: Variable 'key_buffer_size' is a GLOBAL variable and should be set with SET GLOBAL set @save_general_log=@@global.general_log; @@ -1064,10 +1046,6 @@ set statement rand_seed2=default for select 1; ERROR 42000: The system variable rand_seed2 cannot be set in SET STATEMENT. set statement skip_replication=default for select 1; ERROR 42000: The system variable skip_replication cannot be set in SET STATEMENT. -set statement default_master_connection=default for select 1; -ERROR 42000: The system variable default_master_connection cannot be set in SET STATEMENT. -set statement default_master_connection=default for select 1; -ERROR 42000: The system variable default_master_connection cannot be set in SET STATEMENT. set statement last_insert_id=1 for select 1; ERROR 42000: The system variable last_insert_id cannot be set in SET STATEMENT. set statement sql_log_off=default for select 1; diff --git a/mysql-test/r/set_statement_notembedded.result b/mysql-test/r/set_statement_notembedded.result new file mode 100644 index 00000000000..e45ae366c6e --- /dev/null +++ b/mysql-test/r/set_statement_notembedded.result @@ -0,0 +1,22 @@ +SELECT @@MAX_STATEMENT_TIME; +@@MAX_STATEMENT_TIME +0.000000 +SET STATEMENT MAX_STATEMENT_TIME=2 FOR SELECT SLEEP(1); +SLEEP(1) +0 +SHOW STATUS LIKE "max_statement_time_exceeded"; +Variable_name Value +Max_statement_time_exceeded 0 +SET STATEMENT MAX_STATEMENT_TIME=2 FOR SELECT SLEEP(3); +SLEEP(3) +1 +SHOW STATUS LIKE "max_statement_time_exceeded"; +Variable_name Value +Max_statement_time_exceeded 1 +SELECT @@MAX_STATEMENT_TIME; +@@MAX_STATEMENT_TIME +0.000000 +set statement default_master_connection=default for select 1; +ERROR 42000: The system variable default_master_connection cannot be set in SET STATEMENT. +set statement default_master_connection=default for select 1; +ERROR 42000: The system variable default_master_connection cannot be set in SET STATEMENT. diff --git a/mysql-test/r/system_mysql_db.result b/mysql-test/r/system_mysql_db.result index f195b0a607e..2fe6512eee3 100644 --- a/mysql-test/r/system_mysql_db.result +++ b/mysql-test/r/system_mysql_db.result @@ -273,7 +273,8 @@ slow_log CREATE TABLE `slow_log` ( `insert_id` int(11) NOT NULL, `server_id` int(10) unsigned NOT NULL, `sql_text` mediumtext NOT NULL, - `thread_id` bigint(21) unsigned NOT NULL + `thread_id` bigint(21) unsigned NOT NULL, + `rows_affected` int(11) NOT NULL ) ENGINE=CSV DEFAULT CHARSET=utf8 COMMENT='Slow log' show create table table_stats; Table Create Table diff --git a/mysql-test/r/system_mysql_db_fix30020.result b/mysql-test/r/system_mysql_db_fix30020.result deleted file mode 100644 index 4c106ae2e5a..00000000000 --- a/mysql-test/r/system_mysql_db_fix30020.result +++ /dev/null @@ -1,311 +0,0 @@ -show tables; -Tables_in_db -column_stats -columns_priv -db -event -func -general_log -gtid_slave_pos -help_category -help_keyword -help_relation -help_topic -host -index_stats -innodb_index_stats -innodb_table_stats -plugin -proc -procs_priv -proxies_priv -roles_mapping -servers -slow_log -table_stats -tables_priv -time_zone -time_zone_leap_second -time_zone_name -time_zone_transition -time_zone_transition_type -user -show create table db; -Table Create Table -db CREATE TABLE `db` ( - `Host` char(60) COLLATE utf8_bin NOT NULL DEFAULT '', - `Db` char(64) COLLATE utf8_bin NOT NULL DEFAULT '', - `User` char(80) COLLATE utf8_bin NOT NULL DEFAULT '', - `Select_priv` enum('N','Y') CHARACTER SET utf8 NOT NULL DEFAULT 'N', - `Insert_priv` enum('N','Y') CHARACTER SET utf8 NOT NULL DEFAULT 'N', - `Update_priv` enum('N','Y') CHARACTER SET utf8 NOT NULL DEFAULT 'N', - `Delete_priv` enum('N','Y') CHARACTER SET utf8 NOT NULL DEFAULT 'N', - `Create_priv` enum('N','Y') CHARACTER SET utf8 NOT NULL DEFAULT 'N', - `Drop_priv` enum('N','Y') CHARACTER SET utf8 NOT NULL DEFAULT 'N', - `Grant_priv` enum('N','Y') CHARACTER SET utf8 NOT NULL DEFAULT 'N', - `References_priv` enum('N','Y') CHARACTER SET utf8 NOT NULL DEFAULT 'N', - `Index_priv` enum('N','Y') CHARACTER SET utf8 NOT NULL DEFAULT 'N', - `Alter_priv` enum('N','Y') CHARACTER SET utf8 NOT NULL DEFAULT 'N', - `Create_tmp_table_priv` enum('N','Y') CHARACTER SET utf8 NOT NULL DEFAULT 'N', - `Lock_tables_priv` enum('N','Y') CHARACTER SET utf8 NOT NULL DEFAULT 'N', - `Create_view_priv` enum('N','Y') CHARACTER SET utf8 NOT NULL DEFAULT 'N', - `Show_view_priv` enum('N','Y') CHARACTER SET utf8 NOT NULL DEFAULT 'N', - `Create_routine_priv` enum('N','Y') CHARACTER SET utf8 NOT NULL DEFAULT 'N', - `Alter_routine_priv` enum('N','Y') CHARACTER SET utf8 NOT NULL DEFAULT 'N', - `Execute_priv` enum('N','Y') CHARACTER SET utf8 NOT NULL DEFAULT 'N', - `Event_priv` enum('N','Y') CHARACTER SET utf8 NOT NULL DEFAULT 'N', - `Trigger_priv` enum('N','Y') CHARACTER SET utf8 NOT NULL DEFAULT 'N', - PRIMARY KEY (`Host`,`Db`,`User`), - KEY `User` (`User`) -) ENGINE=MyISAM DEFAULT CHARSET=utf8 COLLATE=utf8_bin COMMENT='Database privileges' -show create table host; -Table Create Table -host CREATE TABLE `host` ( - `Host` char(60) COLLATE utf8_bin NOT NULL DEFAULT '', - `Db` char(64) COLLATE utf8_bin NOT NULL DEFAULT '', - `Select_priv` enum('N','Y') CHARACTER SET utf8 NOT NULL DEFAULT 'N', - `Insert_priv` enum('N','Y') CHARACTER SET utf8 NOT NULL DEFAULT 'N', - `Update_priv` enum('N','Y') CHARACTER SET utf8 NOT NULL DEFAULT 'N', - `Delete_priv` enum('N','Y') CHARACTER SET utf8 NOT NULL DEFAULT 'N', - `Create_priv` enum('N','Y') CHARACTER SET utf8 NOT NULL DEFAULT 'N', - `Drop_priv` enum('N','Y') CHARACTER SET utf8 NOT NULL DEFAULT 'N', - `Grant_priv` enum('N','Y') CHARACTER SET utf8 NOT NULL DEFAULT 'N', - `References_priv` enum('N','Y') CHARACTER SET utf8 NOT NULL DEFAULT 'N', - `Index_priv` enum('N','Y') CHARACTER SET utf8 NOT NULL DEFAULT 'N', - `Alter_priv` enum('N','Y') CHARACTER SET utf8 NOT NULL DEFAULT 'N', - `Create_tmp_table_priv` enum('N','Y') CHARACTER SET utf8 NOT NULL DEFAULT 'N', - `Lock_tables_priv` enum('N','Y') CHARACTER SET utf8 NOT NULL DEFAULT 'N', - `Create_view_priv` enum('N','Y') CHARACTER SET utf8 NOT NULL DEFAULT 'N', - `Show_view_priv` enum('N','Y') CHARACTER SET utf8 NOT NULL DEFAULT 'N', - `Create_routine_priv` enum('N','Y') CHARACTER SET utf8 NOT NULL DEFAULT 'N', - `Alter_routine_priv` enum('N','Y') CHARACTER SET utf8 NOT NULL DEFAULT 'N', - `Execute_priv` enum('N','Y') CHARACTER SET utf8 NOT NULL DEFAULT 'N', - `Trigger_priv` enum('N','Y') CHARACTER SET utf8 NOT NULL DEFAULT 'N', - PRIMARY KEY (`Host`,`Db`) -) ENGINE=MyISAM DEFAULT CHARSET=utf8 COLLATE=utf8_bin COMMENT='Host privileges; Merged with database privileges' -show create table user; -Table Create Table -user CREATE TABLE `user` ( - `Host` char(60) COLLATE utf8_bin NOT NULL DEFAULT '', - `User` char(80) COLLATE utf8_bin NOT NULL DEFAULT '', - `Password` char(41) CHARACTER SET latin1 COLLATE latin1_bin NOT NULL DEFAULT '', - `Select_priv` enum('N','Y') CHARACTER SET utf8 NOT NULL DEFAULT 'N', - `Insert_priv` enum('N','Y') CHARACTER SET utf8 NOT NULL DEFAULT 'N', - `Update_priv` enum('N','Y') CHARACTER SET utf8 NOT NULL DEFAULT 'N', - `Delete_priv` enum('N','Y') CHARACTER SET utf8 NOT NULL DEFAULT 'N', - `Create_priv` enum('N','Y') CHARACTER SET utf8 NOT NULL DEFAULT 'N', - `Drop_priv` enum('N','Y') CHARACTER SET utf8 NOT NULL DEFAULT 'N', - `Reload_priv` enum('N','Y') CHARACTER SET utf8 NOT NULL DEFAULT 'N', - `Shutdown_priv` enum('N','Y') CHARACTER SET utf8 NOT NULL DEFAULT 'N', - `Process_priv` enum('N','Y') CHARACTER SET utf8 NOT NULL DEFAULT 'N', - `File_priv` enum('N','Y') CHARACTER SET utf8 NOT NULL DEFAULT 'N', - `Grant_priv` enum('N','Y') CHARACTER SET utf8 NOT NULL DEFAULT 'N', - `References_priv` enum('N','Y') CHARACTER SET utf8 NOT NULL DEFAULT 'N', - `Index_priv` enum('N','Y') CHARACTER SET utf8 NOT NULL DEFAULT 'N', - `Alter_priv` enum('N','Y') CHARACTER SET utf8 NOT NULL DEFAULT 'N', - `Show_db_priv` enum('N','Y') CHARACTER SET utf8 NOT NULL DEFAULT 'N', - `Super_priv` enum('N','Y') CHARACTER SET utf8 NOT NULL DEFAULT 'N', - `Create_tmp_table_priv` enum('N','Y') CHARACTER SET utf8 NOT NULL DEFAULT 'N', - `Lock_tables_priv` enum('N','Y') CHARACTER SET utf8 NOT NULL DEFAULT 'N', - `Execute_priv` enum('N','Y') CHARACTER SET utf8 NOT NULL DEFAULT 'N', - `Repl_slave_priv` enum('N','Y') CHARACTER SET utf8 NOT NULL DEFAULT 'N', - `Repl_client_priv` enum('N','Y') CHARACTER SET utf8 NOT NULL DEFAULT 'N', - `Create_view_priv` enum('N','Y') CHARACTER SET utf8 NOT NULL DEFAULT 'N', - `Show_view_priv` enum('N','Y') CHARACTER SET utf8 NOT NULL DEFAULT 'N', - `Create_routine_priv` enum('N','Y') CHARACTER SET utf8 NOT NULL DEFAULT 'N', - `Alter_routine_priv` enum('N','Y') CHARACTER SET utf8 NOT NULL DEFAULT 'N', - `Create_user_priv` enum('N','Y') CHARACTER SET utf8 NOT NULL DEFAULT 'N', - `Event_priv` enum('N','Y') CHARACTER SET utf8 NOT NULL DEFAULT 'N', - `Trigger_priv` enum('N','Y') CHARACTER SET utf8 NOT NULL DEFAULT 'N', - `Create_tablespace_priv` enum('N','Y') CHARACTER SET utf8 NOT NULL DEFAULT 'N', - `ssl_type` enum('','ANY','X509','SPECIFIED') CHARACTER SET utf8 NOT NULL DEFAULT '', - `ssl_cipher` blob NOT NULL, - `x509_issuer` blob NOT NULL, - `x509_subject` blob NOT NULL, - `max_questions` int(11) unsigned NOT NULL DEFAULT '0', - `max_updates` int(11) unsigned NOT NULL DEFAULT '0', - `max_connections` int(11) unsigned NOT NULL DEFAULT '0', - `max_user_connections` int(11) NOT NULL DEFAULT '0', - `plugin` char(64) CHARACTER SET latin1 NOT NULL DEFAULT '', - `authentication_string` text COLLATE utf8_bin NOT NULL, - `password_expired` enum('N','Y') CHARACTER SET utf8 NOT NULL DEFAULT 'N', - `is_role` enum('N','Y') CHARACTER SET utf8 NOT NULL DEFAULT 'N', - PRIMARY KEY (`Host`,`User`) -) ENGINE=MyISAM DEFAULT CHARSET=utf8 COLLATE=utf8_bin COMMENT='Users and global privileges' -show create table func; -Table Create Table -func CREATE TABLE `func` ( - `name` char(64) COLLATE utf8_bin NOT NULL DEFAULT '', - `ret` tinyint(1) NOT NULL DEFAULT '0', - `dl` char(128) COLLATE utf8_bin NOT NULL DEFAULT '', - `type` enum('function','aggregate') CHARACTER SET utf8 NOT NULL, - PRIMARY KEY (`name`) -) ENGINE=MyISAM DEFAULT CHARSET=utf8 COLLATE=utf8_bin COMMENT='User defined functions' -show create table tables_priv; -Table Create Table -tables_priv CREATE TABLE `tables_priv` ( - `Host` char(60) COLLATE utf8_bin NOT NULL DEFAULT '', - `Db` char(64) COLLATE utf8_bin NOT NULL DEFAULT '', - `User` char(80) COLLATE utf8_bin NOT NULL DEFAULT '', - `Table_name` char(64) COLLATE utf8_bin NOT NULL DEFAULT '', - `Grantor` char(141) COLLATE utf8_bin NOT NULL DEFAULT '', - `Timestamp` timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP, - `Table_priv` set('Select','Insert','Update','Delete','Create','Drop','Grant','References','Index','Alter','Create View','Show view','Trigger') CHARACTER SET utf8 NOT NULL DEFAULT '', - `Column_priv` set('Select','Insert','Update','References') CHARACTER SET utf8 NOT NULL DEFAULT '', - PRIMARY KEY (`Host`,`Db`,`User`,`Table_name`), - KEY `Grantor` (`Grantor`) -) ENGINE=MyISAM DEFAULT CHARSET=utf8 COLLATE=utf8_bin COMMENT='Table privileges' -show create table columns_priv; -Table Create Table -columns_priv CREATE TABLE `columns_priv` ( - `Host` char(60) COLLATE utf8_bin NOT NULL DEFAULT '', - `Db` char(64) COLLATE utf8_bin NOT NULL DEFAULT '', - `User` char(80) COLLATE utf8_bin NOT NULL DEFAULT '', - `Table_name` char(64) COLLATE utf8_bin NOT NULL DEFAULT '', - `Column_name` char(64) COLLATE utf8_bin NOT NULL DEFAULT '', - `Timestamp` timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP, - `Column_priv` set('Select','Insert','Update','References') CHARACTER SET utf8 NOT NULL DEFAULT '', - PRIMARY KEY (`Host`,`Db`,`User`,`Table_name`,`Column_name`) -) ENGINE=MyISAM DEFAULT CHARSET=utf8 COLLATE=utf8_bin COMMENT='Column privileges' -show create table procs_priv; -Table Create Table -procs_priv CREATE TABLE `procs_priv` ( - `Host` char(60) COLLATE utf8_bin NOT NULL DEFAULT '', - `Db` char(64) COLLATE utf8_bin NOT NULL DEFAULT '', - `User` char(80) COLLATE utf8_bin NOT NULL DEFAULT '', - `Routine_name` char(64) CHARACTER SET utf8 NOT NULL DEFAULT '', - `Routine_type` enum('FUNCTION','PROCEDURE') COLLATE utf8_bin NOT NULL, - `Grantor` char(141) COLLATE utf8_bin NOT NULL DEFAULT '', - `Proc_priv` set('Execute','Alter Routine','Grant') CHARACTER SET utf8 NOT NULL DEFAULT '', - `Timestamp` timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP, - PRIMARY KEY (`Host`,`Db`,`User`,`Routine_name`,`Routine_type`), - KEY `Grantor` (`Grantor`) -) ENGINE=MyISAM DEFAULT CHARSET=utf8 COLLATE=utf8_bin COMMENT='Procedure privileges' -show create table servers; -Table Create Table -servers CREATE TABLE `servers` ( - `Server_name` char(64) NOT NULL DEFAULT '', - `Host` char(64) NOT NULL DEFAULT '', - `Db` char(64) NOT NULL DEFAULT '', - `Username` char(80) NOT NULL DEFAULT '', - `Password` char(64) NOT NULL DEFAULT '', - `Port` int(4) NOT NULL DEFAULT '0', - `Socket` char(64) NOT NULL DEFAULT '', - `Wrapper` char(64) NOT NULL DEFAULT '', - `Owner` char(64) NOT NULL DEFAULT '', - PRIMARY KEY (`Server_name`) -) ENGINE=MyISAM DEFAULT CHARSET=utf8 COMMENT='MySQL Foreign Servers table' -show create table proc; -Table Create Table -proc CREATE TABLE `proc` ( - `db` char(64) CHARACTER SET utf8 COLLATE utf8_bin NOT NULL DEFAULT '', - `name` char(64) NOT NULL DEFAULT '', - `type` enum('FUNCTION','PROCEDURE') NOT NULL, - `specific_name` char(64) NOT NULL DEFAULT '', - `language` enum('SQL') NOT NULL DEFAULT 'SQL', - `sql_data_access` enum('CONTAINS_SQL','NO_SQL','READS_SQL_DATA','MODIFIES_SQL_DATA') NOT NULL DEFAULT 'CONTAINS_SQL', - `is_deterministic` enum('YES','NO') NOT NULL DEFAULT 'NO', - `security_type` enum('INVOKER','DEFINER') NOT NULL DEFAULT 'DEFINER', - `param_list` blob NOT NULL, - `returns` longblob NOT NULL, - `body` longblob NOT NULL, - `definer` char(141) CHARACTER SET utf8 COLLATE utf8_bin NOT NULL DEFAULT '', - `created` timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP, - `modified` timestamp NOT NULL DEFAULT '0000-00-00 00:00:00', - `sql_mode` set('REAL_AS_FLOAT','PIPES_AS_CONCAT','ANSI_QUOTES','IGNORE_SPACE','IGNORE_BAD_TABLE_OPTIONS','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','NO_ENGINE_SUBSTITUTION','PAD_CHAR_TO_FULL_LENGTH') NOT NULL DEFAULT '', - `comment` text CHARACTER SET utf8 COLLATE utf8_bin NOT NULL, - `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; -Table Create Table -event CREATE TABLE `event` ( - `db` char(64) CHARACTER SET utf8 COLLATE utf8_bin NOT NULL DEFAULT '', - `name` char(64) NOT NULL DEFAULT '', - `body` longblob NOT NULL, - `definer` char(141) 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 DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP, - `modified` timestamp NOT NULL DEFAULT '0000-00-00 00:00:00', - `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','IGNORE_BAD_TABLE_OPTIONS','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','NO_ENGINE_SUBSTITUTION','PAD_CHAR_TO_FULL_LENGTH') NOT NULL DEFAULT '', - `comment` char(64) CHARACTER SET utf8 COLLATE utf8_bin NOT NULL DEFAULT '', - `originator` int(10) unsigned 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; -Table Create Table -general_log CREATE TABLE `general_log` ( - `event_time` timestamp(6) NOT NULL DEFAULT CURRENT_TIMESTAMP(6) ON UPDATE CURRENT_TIMESTAMP(6), - `user_host` mediumtext NOT NULL, - `thread_id` bigint(21) unsigned NOT NULL, - `server_id` int(10) unsigned NOT NULL, - `command_type` varchar(64) NOT NULL, - `argument` mediumtext NOT NULL -) ENGINE=CSV DEFAULT CHARSET=utf8 COMMENT='General log' -show create table slow_log; -Table Create Table -slow_log CREATE TABLE `slow_log` ( - `start_time` timestamp(6) NOT NULL DEFAULT CURRENT_TIMESTAMP(6) ON UPDATE CURRENT_TIMESTAMP(6), - `user_host` mediumtext NOT NULL, - `query_time` time(6) NOT NULL, - `lock_time` time(6) NOT NULL, - `rows_sent` int(11) NOT NULL, - `rows_examined` int(11) NOT NULL, - `db` varchar(512) NOT NULL, - `last_insert_id` int(11) NOT NULL, - `insert_id` int(11) NOT NULL, - `server_id` int(10) unsigned NOT NULL, - `sql_text` mediumtext NOT NULL, - `thread_id` bigint(21) unsigned NOT NULL -) ENGINE=CSV DEFAULT CHARSET=utf8 COMMENT='Slow log' -show create table table_stats; -Table Create Table -table_stats CREATE TABLE `table_stats` ( - `db_name` varchar(64) COLLATE utf8_bin NOT NULL, - `table_name` varchar(64) COLLATE utf8_bin NOT NULL, - `cardinality` bigint(21) unsigned DEFAULT NULL, - PRIMARY KEY (`db_name`,`table_name`) -) ENGINE=MyISAM DEFAULT CHARSET=utf8 COLLATE=utf8_bin COMMENT='Statistics on Tables' -show create table column_stats; -Table Create Table -column_stats CREATE TABLE `column_stats` ( - `db_name` varchar(64) COLLATE utf8_bin NOT NULL, - `table_name` varchar(64) COLLATE utf8_bin NOT NULL, - `column_name` varchar(64) COLLATE utf8_bin NOT NULL, - `min_value` varchar(255) COLLATE utf8_bin DEFAULT NULL, - `max_value` varchar(255) COLLATE utf8_bin DEFAULT NULL, - `nulls_ratio` decimal(12,4) DEFAULT NULL, - `avg_length` decimal(12,4) DEFAULT NULL, - `avg_frequency` decimal(12,4) DEFAULT NULL, - `hist_size` tinyint(3) unsigned DEFAULT NULL, - `hist_type` enum('SINGLE_PREC_HB','DOUBLE_PREC_HB') COLLATE utf8_bin DEFAULT NULL, - `histogram` varbinary(255) DEFAULT NULL, - PRIMARY KEY (`db_name`,`table_name`,`column_name`) -) ENGINE=MyISAM DEFAULT CHARSET=utf8 COLLATE=utf8_bin COMMENT='Statistics on Columns' -show create table index_stats; -Table Create Table -index_stats CREATE TABLE `index_stats` ( - `db_name` varchar(64) COLLATE utf8_bin NOT NULL, - `table_name` varchar(64) COLLATE utf8_bin NOT NULL, - `index_name` varchar(64) COLLATE utf8_bin NOT NULL, - `prefix_arity` int(11) unsigned NOT NULL, - `avg_frequency` decimal(12,4) DEFAULT NULL, - PRIMARY KEY (`db_name`,`table_name`,`index_name`,`prefix_arity`) -) ENGINE=MyISAM DEFAULT CHARSET=utf8 COLLATE=utf8_bin COMMENT='Statistics on Indexes' -show tables; -Tables_in_test diff --git a/mysql-test/r/system_mysql_db_fix40123.result b/mysql-test/r/system_mysql_db_fix40123.result index f195b0a607e..2fe6512eee3 100644 --- a/mysql-test/r/system_mysql_db_fix40123.result +++ b/mysql-test/r/system_mysql_db_fix40123.result @@ -273,7 +273,8 @@ slow_log CREATE TABLE `slow_log` ( `insert_id` int(11) NOT NULL, `server_id` int(10) unsigned NOT NULL, `sql_text` mediumtext NOT NULL, - `thread_id` bigint(21) unsigned NOT NULL + `thread_id` bigint(21) unsigned NOT NULL, + `rows_affected` int(11) NOT NULL ) ENGINE=CSV DEFAULT CHARSET=utf8 COMMENT='Slow log' show create table table_stats; Table Create Table diff --git a/mysql-test/r/system_mysql_db_fix50030.result b/mysql-test/r/system_mysql_db_fix50030.result index f195b0a607e..2fe6512eee3 100644 --- a/mysql-test/r/system_mysql_db_fix50030.result +++ b/mysql-test/r/system_mysql_db_fix50030.result @@ -273,7 +273,8 @@ slow_log CREATE TABLE `slow_log` ( `insert_id` int(11) NOT NULL, `server_id` int(10) unsigned NOT NULL, `sql_text` mediumtext NOT NULL, - `thread_id` bigint(21) unsigned NOT NULL + `thread_id` bigint(21) unsigned NOT NULL, + `rows_affected` int(11) NOT NULL ) ENGINE=CSV DEFAULT CHARSET=utf8 COMMENT='Slow log' show create table table_stats; Table Create Table diff --git a/mysql-test/r/system_mysql_db_fix50117.result b/mysql-test/r/system_mysql_db_fix50117.result index f195b0a607e..2fe6512eee3 100644 --- a/mysql-test/r/system_mysql_db_fix50117.result +++ b/mysql-test/r/system_mysql_db_fix50117.result @@ -273,7 +273,8 @@ slow_log CREATE TABLE `slow_log` ( `insert_id` int(11) NOT NULL, `server_id` int(10) unsigned NOT NULL, `sql_text` mediumtext NOT NULL, - `thread_id` bigint(21) unsigned NOT NULL + `thread_id` bigint(21) unsigned NOT NULL, + `rows_affected` int(11) NOT NULL ) ENGINE=CSV DEFAULT CHARSET=utf8 COMMENT='Slow log' show create table table_stats; Table Create Table diff --git a/mysql-test/r/union.result b/mysql-test/r/union.result index 25de5ee4648..083acc8d5c9 100644 --- a/mysql-test/r/union.result +++ b/mysql-test/r/union.result @@ -1617,7 +1617,7 @@ NULL UNION RESULT ALL NULL NULL NULL NULL NULL NULL Using filesort 3 DEPENDENT SUBQUERY t2 ALL NULL NULL NULL NULL 2 100.00 Using where Warnings: Note 1276 Field or reference 'a' of SELECT #3 was resolved in SELECT #-1 -Note 1003 select `test`.`t1`.`a` AS `a` from `test`.`t1` union select `test`.`t1`.`a` AS `a` from `test`.`t1` order by <>((select `a` from `test`.`t2` where (`test`.`t2`.`b` = 12))) +Note 1003 select `test`.`t1`.`a` AS `a` from `test`.`t1` union select `test`.`t1`.`a` AS `a` from `test`.`t1` order by <`a`>((select `a` from `test`.`t2` where (`test`.`t2`.`b` = 12))) # Should not crash SELECT * FROM t1 UNION SELECT * FROM t1 ORDER BY (SELECT a FROM t2 WHERE b = 12); diff --git a/mysql-test/suite/funcs_1/r/is_columns_is_embedded.result b/mysql-test/suite/funcs_1/r/is_columns_is_embedded.result index 75e05215569..53d41f10c36 100644 --- a/mysql-test/suite/funcs_1/r/is_columns_is_embedded.result +++ b/mysql-test/suite/funcs_1/r/is_columns_is_embedded.result @@ -152,6 +152,19 @@ def information_schema FILES TRANSACTION_COUNTER 24 NULL YES bigint NULL NULL 19 def information_schema FILES UPDATE_COUNT 13 NULL YES bigint NULL NULL 19 0 NULL NULL NULL bigint(4) def information_schema FILES UPDATE_TIME 34 NULL YES datetime NULL NULL NULL NULL 0 NULL NULL datetime def information_schema FILES VERSION 25 NULL YES bigint NULL NULL 20 0 NULL NULL NULL bigint(21) unsigned +def information_schema GEOMETRY_COLUMNS COORD_DIMENSION 11 0 NO tinyint NULL NULL 3 0 NULL NULL NULL tinyint(2) +def information_schema GEOMETRY_COLUMNS F_GEOMETRY_COLUMN 4 NO varchar 64 192 NULL NULL NULL utf8 utf8_general_ci varchar(64) +def information_schema GEOMETRY_COLUMNS F_TABLE_CATALOG 1 NO varchar 512 1536 NULL NULL NULL utf8 utf8_general_ci varchar(512) +def information_schema GEOMETRY_COLUMNS F_TABLE_NAME 3 NO varchar 64 192 NULL NULL NULL utf8 utf8_general_ci varchar(64) +def information_schema GEOMETRY_COLUMNS F_TABLE_SCHEMA 2 NO varchar 64 192 NULL NULL NULL utf8 utf8_general_ci varchar(64) +def information_schema GEOMETRY_COLUMNS GEOMETRY_TYPE 10 0 NO int NULL NULL 10 0 NULL NULL NULL int(7) +def information_schema GEOMETRY_COLUMNS G_GEOMETRY_COLUMN 8 NO varchar 64 192 NULL NULL NULL utf8 utf8_general_ci varchar(64) +def information_schema GEOMETRY_COLUMNS G_TABLE_CATALOG 5 NO varchar 512 1536 NULL NULL NULL utf8 utf8_general_ci varchar(512) +def information_schema GEOMETRY_COLUMNS G_TABLE_NAME 7 NO varchar 64 192 NULL NULL NULL utf8 utf8_general_ci varchar(64) +def information_schema GEOMETRY_COLUMNS G_TABLE_SCHEMA 6 NO varchar 64 192 NULL NULL NULL utf8 utf8_general_ci varchar(64) +def information_schema GEOMETRY_COLUMNS MAX_PPR 12 0 NO tinyint NULL NULL 3 0 NULL NULL NULL tinyint(2) +def information_schema GEOMETRY_COLUMNS SRID 13 0 NO smallint NULL NULL 5 0 NULL NULL NULL smallint(5) +def information_schema GEOMETRY_COLUMNS STORAGE_TYPE 9 0 NO tinyint NULL NULL 3 0 NULL NULL NULL tinyint(2) def information_schema GLOBAL_STATUS VARIABLE_NAME 1 NO varchar 64 192 NULL NULL NULL utf8 utf8_general_ci varchar(64) def information_schema GLOBAL_STATUS VARIABLE_VALUE 2 NO varchar 1024 3072 NULL NULL NULL utf8 utf8_general_ci varchar(1024) def information_schema GLOBAL_VARIABLES VARIABLE_NAME 1 NO varchar 64 192 NULL NULL NULL utf8 utf8_general_ci varchar(64) @@ -309,6 +322,10 @@ def information_schema SESSION_STATUS VARIABLE_NAME 1 NO varchar 64 192 NULL NU def information_schema SESSION_STATUS VARIABLE_VALUE 2 NO varchar 1024 3072 NULL NULL NULL utf8 utf8_general_ci varchar(1024) def information_schema SESSION_VARIABLES VARIABLE_NAME 1 NO varchar 64 192 NULL NULL NULL utf8 utf8_general_ci varchar(64) def information_schema SESSION_VARIABLES VARIABLE_VALUE 2 NO varchar 1024 3072 NULL NULL NULL utf8 utf8_general_ci varchar(1024) +def information_schema SPATIAL_REF_SYS AUTH_NAME 2 NO varchar 512 1536 NULL NULL NULL utf8 utf8_general_ci varchar(512) +def information_schema SPATIAL_REF_SYS AUTH_SRID 3 0 NO smallint NULL NULL 5 0 NULL NULL NULL smallint(5) +def information_schema SPATIAL_REF_SYS SRID 1 0 NO smallint NULL NULL 5 0 NULL NULL NULL smallint(5) +def information_schema SPATIAL_REF_SYS SRTEXT 4 NO varchar 2048 6144 NULL NULL NULL utf8 utf8_general_ci varchar(2048) def information_schema STATISTICS CARDINALITY 10 NULL YES bigint NULL NULL 19 0 NULL NULL NULL bigint(21) def information_schema STATISTICS COLLATION 9 NULL YES varchar 1 3 NULL NULL NULL utf8 utf8_general_ci varchar(1) def information_schema STATISTICS COLUMN_NAME 8 NO varchar 64 192 NULL NULL NULL utf8 utf8_general_ci varchar(64) @@ -490,6 +507,7 @@ NULL datetime NULL NULL NULL decimal NULL NULL NULL double NULL NULL NULL int NULL NULL +NULL smallint NULL NULL NULL tinyint NULL NULL --> CHAR(0) is allowed (see manual), and here both CHARACHTER_* values --> are 0, which is intended behavior, and the result of 0 / 0 IS NULL @@ -657,6 +675,19 @@ NULL information_schema FILES CHECK_TIME datetime NULL NULL NULL NULL datetime NULL information_schema FILES CHECKSUM bigint NULL NULL NULL NULL bigint(21) unsigned 3.0000 information_schema FILES STATUS varchar 20 60 utf8 utf8_general_ci varchar(20) 3.0000 information_schema FILES EXTRA varchar 255 765 utf8 utf8_general_ci varchar(255) +3.0000 information_schema GEOMETRY_COLUMNS F_TABLE_CATALOG varchar 512 1536 utf8 utf8_general_ci varchar(512) +3.0000 information_schema GEOMETRY_COLUMNS F_TABLE_SCHEMA varchar 64 192 utf8 utf8_general_ci varchar(64) +3.0000 information_schema GEOMETRY_COLUMNS F_TABLE_NAME varchar 64 192 utf8 utf8_general_ci varchar(64) +3.0000 information_schema GEOMETRY_COLUMNS F_GEOMETRY_COLUMN varchar 64 192 utf8 utf8_general_ci varchar(64) +3.0000 information_schema GEOMETRY_COLUMNS G_TABLE_CATALOG varchar 512 1536 utf8 utf8_general_ci varchar(512) +3.0000 information_schema GEOMETRY_COLUMNS G_TABLE_SCHEMA varchar 64 192 utf8 utf8_general_ci varchar(64) +3.0000 information_schema GEOMETRY_COLUMNS G_TABLE_NAME varchar 64 192 utf8 utf8_general_ci varchar(64) +3.0000 information_schema GEOMETRY_COLUMNS G_GEOMETRY_COLUMN varchar 64 192 utf8 utf8_general_ci varchar(64) +NULL information_schema GEOMETRY_COLUMNS STORAGE_TYPE tinyint NULL NULL NULL NULL tinyint(2) +NULL information_schema GEOMETRY_COLUMNS GEOMETRY_TYPE int NULL NULL NULL NULL int(7) +NULL information_schema GEOMETRY_COLUMNS COORD_DIMENSION tinyint NULL NULL NULL NULL tinyint(2) +NULL information_schema GEOMETRY_COLUMNS MAX_PPR tinyint NULL NULL NULL NULL tinyint(2) +NULL information_schema GEOMETRY_COLUMNS SRID smallint NULL NULL NULL NULL smallint(5) 3.0000 information_schema GLOBAL_STATUS VARIABLE_NAME varchar 64 192 utf8 utf8_general_ci varchar(64) 3.0000 information_schema GLOBAL_STATUS VARIABLE_VALUE varchar 1024 3072 utf8 utf8_general_ci varchar(1024) 3.0000 information_schema GLOBAL_VARIABLES VARIABLE_NAME varchar 64 192 utf8 utf8_general_ci varchar(64) @@ -814,6 +845,10 @@ NULL information_schema ROUTINES LAST_ALTERED datetime NULL NULL NULL NULL datet 3.0000 information_schema SESSION_STATUS VARIABLE_VALUE varchar 1024 3072 utf8 utf8_general_ci varchar(1024) 3.0000 information_schema SESSION_VARIABLES VARIABLE_NAME varchar 64 192 utf8 utf8_general_ci varchar(64) 3.0000 information_schema SESSION_VARIABLES VARIABLE_VALUE varchar 1024 3072 utf8 utf8_general_ci varchar(1024) +NULL information_schema SPATIAL_REF_SYS SRID smallint NULL NULL NULL NULL smallint(5) +3.0000 information_schema SPATIAL_REF_SYS AUTH_NAME varchar 512 1536 utf8 utf8_general_ci varchar(512) +NULL information_schema SPATIAL_REF_SYS AUTH_SRID smallint NULL NULL NULL NULL smallint(5) +3.0000 information_schema SPATIAL_REF_SYS SRTEXT varchar 2048 6144 utf8 utf8_general_ci varchar(2048) 3.0000 information_schema STATISTICS TABLE_CATALOG varchar 512 1536 utf8 utf8_general_ci varchar(512) 3.0000 information_schema STATISTICS TABLE_SCHEMA varchar 64 192 utf8 utf8_general_ci varchar(64) 3.0000 information_schema STATISTICS TABLE_NAME varchar 64 192 utf8 utf8_general_ci varchar(64) diff --git a/mysql-test/suite/funcs_1/r/is_columns_mysql.result b/mysql-test/suite/funcs_1/r/is_columns_mysql.result index 09adebfab1c..d1685f40314 100644 --- a/mysql-test/suite/funcs_1/r/is_columns_mysql.result +++ b/mysql-test/suite/funcs_1/r/is_columns_mysql.result @@ -172,6 +172,7 @@ def mysql slow_log insert_id 9 NULL NO int NULL NULL 10 0 NULL NULL NULL int(11) def mysql slow_log last_insert_id 8 NULL NO int NULL NULL 10 0 NULL NULL NULL int(11) select,insert,update,references def mysql slow_log lock_time 4 NULL NO time NULL NULL NULL NULL 6 NULL NULL time(6) select,insert,update,references def mysql slow_log query_time 3 NULL NO time NULL NULL NULL NULL 6 NULL NULL time(6) select,insert,update,references +def mysql slow_log rows_affected 13 NULL NO int NULL NULL 10 0 NULL NULL NULL int(11) select,insert,update,references def mysql slow_log rows_examined 6 NULL NO int NULL NULL 10 0 NULL NULL NULL int(11) select,insert,update,references def mysql slow_log rows_sent 5 NULL NO int NULL NULL 10 0 NULL NULL NULL int(11) select,insert,update,references def mysql slow_log server_id 10 NULL NO int NULL NULL 10 0 NULL NULL NULL int(10) unsigned select,insert,update,references @@ -499,6 +500,7 @@ NULL mysql slow_log insert_id int NULL NULL NULL NULL int(11) NULL mysql slow_log server_id int NULL NULL NULL NULL int(10) unsigned 1.0000 mysql slow_log sql_text mediumtext 16777215 16777215 utf8 utf8_general_ci mediumtext NULL mysql slow_log thread_id bigint NULL NULL NULL NULL bigint(21) unsigned +NULL mysql slow_log rows_affected int NULL NULL NULL NULL int(11) 3.0000 mysql tables_priv Host char 60 180 utf8 utf8_bin char(60) 3.0000 mysql tables_priv Db char 64 192 utf8 utf8_bin char(64) 3.0000 mysql tables_priv User char 80 240 utf8 utf8_bin char(80) diff --git a/mysql-test/suite/funcs_1/r/is_columns_mysql_embedded.result b/mysql-test/suite/funcs_1/r/is_columns_mysql_embedded.result index 7304f76562f..bd13bf3241f 100644 --- a/mysql-test/suite/funcs_1/r/is_columns_mysql_embedded.result +++ b/mysql-test/suite/funcs_1/r/is_columns_mysql_embedded.result @@ -172,6 +172,7 @@ def mysql slow_log insert_id 9 NULL NO int NULL NULL 10 0 NULL NULL NULL int(11) def mysql slow_log last_insert_id 8 NULL NO int NULL NULL 10 0 NULL NULL NULL int(11) def mysql slow_log lock_time 4 NULL NO time NULL NULL NULL NULL 6 NULL NULL time(6) def mysql slow_log query_time 3 NULL NO time NULL NULL NULL NULL 6 NULL NULL time(6) +def mysql slow_log rows_affected 13 NULL NO int NULL NULL 10 0 NULL NULL NULL int(11) def mysql slow_log rows_examined 6 NULL NO int NULL NULL 10 0 NULL NULL NULL int(11) def mysql slow_log rows_sent 5 NULL NO int NULL NULL 10 0 NULL NULL NULL int(11) def mysql slow_log server_id 10 NULL NO int NULL NULL 10 0 NULL NULL NULL int(10) unsigned @@ -499,6 +500,7 @@ NULL mysql slow_log insert_id int NULL NULL NULL NULL int(11) NULL mysql slow_log server_id int NULL NULL NULL NULL int(10) unsigned 1.0000 mysql slow_log sql_text mediumtext 16777215 16777215 utf8 utf8_general_ci mediumtext NULL mysql slow_log thread_id bigint NULL NULL NULL NULL bigint(21) unsigned +NULL mysql slow_log rows_affected int NULL NULL NULL NULL int(11) 3.0000 mysql tables_priv Host char 60 180 utf8 utf8_bin char(60) 3.0000 mysql tables_priv Db char 64 192 utf8 utf8_bin char(64) 3.0000 mysql tables_priv User char 80 240 utf8 utf8_bin char(80) diff --git a/mysql-test/suite/funcs_1/r/is_engines_innodb,innodb_plugin.rdiff b/mysql-test/suite/funcs_1/r/is_engines_innodb,innodb_plugin.rdiff deleted file mode 100644 index 6dcdfb85e3c..00000000000 --- a/mysql-test/suite/funcs_1/r/is_engines_innodb,innodb_plugin.rdiff +++ /dev/null @@ -1,11 +0,0 @@ ---- suite/funcs_1/r/is_engines_innodb.result 2011-10-21 23:35:26.000000000 +0200 -+++ suite/funcs_1/r/is_engines_innodb.reject 2012-02-07 12:44:19.000000000 +0100 -@@ -2,7 +2,7 @@ - WHERE ENGINE = 'InnoDB'; - ENGINE InnoDB - SUPPORT YES --COMMENT Percona-XtraDB, Supports transactions, row-level locking, and foreign keys -+COMMENT Supports transactions, row-level locking, and foreign keys - TRANSACTIONS YES - XA YES - SAVEPOINTS YES diff --git a/mysql-test/suite/funcs_1/r/is_tables_is_embedded.result b/mysql-test/suite/funcs_1/r/is_tables_is_embedded.result index f88afbbdf5a..daa3ce83ba2 100644 --- a/mysql-test/suite/funcs_1/r/is_tables_is_embedded.result +++ b/mysql-test/suite/funcs_1/r/is_tables_is_embedded.result @@ -290,6 +290,29 @@ user_comment Separator ----------------------------------------------------- TABLE_CATALOG def TABLE_SCHEMA information_schema +TABLE_NAME GEOMETRY_COLUMNS +TABLE_TYPE SYSTEM VIEW +ENGINE MEMORY +VERSION 10 +ROW_FORMAT Fixed +TABLE_ROWS #TBLR# +AVG_ROW_LENGTH #ARL# +DATA_LENGTH #DL# +MAX_DATA_LENGTH #MDL# +INDEX_LENGTH #IL# +DATA_FREE #DF# +AUTO_INCREMENT NULL +CREATE_TIME #CRT# +UPDATE_TIME #UT# +CHECK_TIME #CT# +TABLE_COLLATION utf8_general_ci +CHECKSUM NULL +CREATE_OPTIONS #CO# +TABLE_COMMENT #TC# +user_comment +Separator ----------------------------------------------------- +TABLE_CATALOG def +TABLE_SCHEMA information_schema TABLE_NAME GLOBAL_STATUS TABLE_TYPE SYSTEM VIEW ENGINE MEMORY @@ -635,6 +658,29 @@ user_comment Separator ----------------------------------------------------- TABLE_CATALOG def TABLE_SCHEMA information_schema +TABLE_NAME SPATIAL_REF_SYS +TABLE_TYPE SYSTEM VIEW +ENGINE MEMORY +VERSION 10 +ROW_FORMAT Fixed +TABLE_ROWS #TBLR# +AVG_ROW_LENGTH #ARL# +DATA_LENGTH #DL# +MAX_DATA_LENGTH #MDL# +INDEX_LENGTH #IL# +DATA_FREE #DF# +AUTO_INCREMENT NULL +CREATE_TIME #CRT# +UPDATE_TIME #UT# +CHECK_TIME #CT# +TABLE_COLLATION utf8_general_ci +CHECKSUM NULL +CREATE_OPTIONS #CO# +TABLE_COMMENT #TC# +user_comment +Separator ----------------------------------------------------- +TABLE_CATALOG def +TABLE_SCHEMA information_schema TABLE_NAME STATISTICS TABLE_TYPE SYSTEM VIEW ENGINE MEMORY @@ -1180,6 +1226,29 @@ user_comment Separator ----------------------------------------------------- TABLE_CATALOG def TABLE_SCHEMA information_schema +TABLE_NAME GEOMETRY_COLUMNS +TABLE_TYPE SYSTEM VIEW +ENGINE MEMORY +VERSION 10 +ROW_FORMAT Fixed +TABLE_ROWS #TBLR# +AVG_ROW_LENGTH #ARL# +DATA_LENGTH #DL# +MAX_DATA_LENGTH #MDL# +INDEX_LENGTH #IL# +DATA_FREE #DF# +AUTO_INCREMENT NULL +CREATE_TIME #CRT# +UPDATE_TIME #UT# +CHECK_TIME #CT# +TABLE_COLLATION utf8_general_ci +CHECKSUM NULL +CREATE_OPTIONS #CO# +TABLE_COMMENT #TC# +user_comment +Separator ----------------------------------------------------- +TABLE_CATALOG def +TABLE_SCHEMA information_schema TABLE_NAME GLOBAL_STATUS TABLE_TYPE SYSTEM VIEW ENGINE MEMORY @@ -1525,6 +1594,29 @@ user_comment Separator ----------------------------------------------------- TABLE_CATALOG def TABLE_SCHEMA information_schema +TABLE_NAME SPATIAL_REF_SYS +TABLE_TYPE SYSTEM VIEW +ENGINE MEMORY +VERSION 10 +ROW_FORMAT Fixed +TABLE_ROWS #TBLR# +AVG_ROW_LENGTH #ARL# +DATA_LENGTH #DL# +MAX_DATA_LENGTH #MDL# +INDEX_LENGTH #IL# +DATA_FREE #DF# +AUTO_INCREMENT NULL +CREATE_TIME #CRT# +UPDATE_TIME #UT# +CHECK_TIME #CT# +TABLE_COLLATION utf8_general_ci +CHECKSUM NULL +CREATE_OPTIONS #CO# +TABLE_COMMENT #TC# +user_comment +Separator ----------------------------------------------------- +TABLE_CATALOG def +TABLE_SCHEMA information_schema TABLE_NAME STATISTICS TABLE_TYPE SYSTEM VIEW ENGINE MEMORY diff --git a/mysql-test/suite/innodb/t/innodb-page_compression_bzip2.test b/mysql-test/suite/innodb/t/innodb-page_compression_bzip2.test index 2e8831151c7..51493266a60 100644 --- a/mysql-test/suite/innodb/t/innodb-page_compression_bzip2.test +++ b/mysql-test/suite/innodb/t/innodb-page_compression_bzip2.test @@ -1,5 +1,6 @@ -- source include/have_innodb.inc -- source include/have_innodb_bzip2.inc +-- source include/not_embedded.inc --disable_query_log let $innodb_compression_algorithm_orig=`select @@innodb_compression_algorithm`; diff --git a/mysql-test/suite/innodb/t/innodb-page_compression_lz4.test b/mysql-test/suite/innodb/t/innodb-page_compression_lz4.test index 731cbdeab66..f36ea9684e9 100644 --- a/mysql-test/suite/innodb/t/innodb-page_compression_lz4.test +++ b/mysql-test/suite/innodb/t/innodb-page_compression_lz4.test @@ -1,5 +1,6 @@ -- source include/have_innodb.inc -- source include/have_innodb_lz4.inc +-- source include/not_embedded.inc --disable_query_log let $innodb_compression_algorithm_orig=`SELECT @@innodb_compression_algorithm`; diff --git a/mysql-test/suite/innodb/t/innodb-page_compression_lzma.test b/mysql-test/suite/innodb/t/innodb-page_compression_lzma.test index 071e86b0f9b..6ea686bca04 100644 --- a/mysql-test/suite/innodb/t/innodb-page_compression_lzma.test +++ b/mysql-test/suite/innodb/t/innodb-page_compression_lzma.test @@ -1,5 +1,6 @@ -- source include/have_innodb.inc -- source include/have_innodb_lzma.inc +-- source include/not_embedded.inc --disable_query_log let $innodb_compression_algorithm_orig=`SELECT @@innodb_compression_algorithm`; diff --git a/mysql-test/suite/innodb/t/innodb-page_compression_lzo.test b/mysql-test/suite/innodb/t/innodb-page_compression_lzo.test index 6a73f793f26..96ba18f5112 100644 --- a/mysql-test/suite/innodb/t/innodb-page_compression_lzo.test +++ b/mysql-test/suite/innodb/t/innodb-page_compression_lzo.test @@ -1,5 +1,7 @@ -- source include/have_innodb.inc -- source include/have_innodb_lzo.inc +-- source include/not_embedded.inc + --disable_query_log let $innodb_compression_algorithm_orig=`select @@innodb_compression_algorithm`; diff --git a/mysql-test/suite/innodb/t/innodb-page_compression_tables.test b/mysql-test/suite/innodb/t/innodb-page_compression_tables.test index f7810a44c48..41d844d26b4 100644 --- a/mysql-test/suite/innodb/t/innodb-page_compression_tables.test +++ b/mysql-test/suite/innodb/t/innodb-page_compression_tables.test @@ -1,4 +1,5 @@ --- source include/have_innodb.inc +--source include/have_innodb.inc +--source include/not_embedded.inc --disable_query_log let $innodb_compression_algorithm_orig=`SELECT @@innodb_compression_algorithm`; diff --git a/mysql-test/suite/innodb/t/innodb-page_compression_zip.test b/mysql-test/suite/innodb/t/innodb-page_compression_zip.test index 8d06367e9b2..67fafdb9e83 100644 --- a/mysql-test/suite/innodb/t/innodb-page_compression_zip.test +++ b/mysql-test/suite/innodb/t/innodb-page_compression_zip.test @@ -1,4 +1,5 @@ --- source include/have_innodb.inc +--source include/have_innodb.inc +--source include/not_embedded.inc --disable_query_log let $innodb_compression_algorithm_orig=`SELECT @@innodb_compression_algorithm`; diff --git a/mysql-test/suite/innodb/t/innodb_stats_create_on_corrupted.test b/mysql-test/suite/innodb/t/innodb_stats_create_on_corrupted.test index de6026a23aa..c932e45591d 100644 --- a/mysql-test/suite/innodb/t/innodb_stats_create_on_corrupted.test +++ b/mysql-test/suite/innodb/t/innodb_stats_create_on_corrupted.test @@ -8,6 +8,7 @@ # functionality tested here is not related to the page size, so we only # test with 16k page size. -- source include/have_innodb_16k.inc +-- source include/not_embedded.inc call mtr.add_suppression("InnoDB: Error: Table \"mysql\".\"innodb_index_stats\" not found"); call mtr.add_suppression("InnoDB: Error: Fetch of persistent statistics requested for table"); diff --git a/mysql-test/suite/sys_vars/r/sysvars_server_embedded.result b/mysql-test/suite/sys_vars/r/sysvars_server_embedded.result index 313d81af631..5e37b51ba3f 100644 --- a/mysql-test/suite/sys_vars/r/sysvars_server_embedded.result +++ b/mysql-test/suite/sys_vars/r/sysvars_server_embedded.result @@ -1337,6 +1337,20 @@ NUMERIC_BLOCK_SIZE NULL ENUM_VALUE_LIST NULL READ_ONLY NO COMMAND_LINE_ARGUMENT REQUIRED +VARIABLE_NAME KEY_CACHE_FILE_HASH_SIZE +SESSION_VALUE NULL +GLOBAL_VALUE 512 +GLOBAL_VALUE_ORIGIN COMPILE-TIME +DEFAULT_VALUE 512 +VARIABLE_SCOPE GLOBAL +VARIABLE_TYPE BIGINT UNSIGNED +VARIABLE_COMMENT Number of hash buckets for open and changed files. If you have a lot of MyISAM files open you should increase this for faster flush of changes. A good value is probably 1/10 of number of possible open MyISAM files. +NUMERIC_MIN_VALUE NULL +NUMERIC_MAX_VALUE NULL +NUMERIC_BLOCK_SIZE NULL +ENUM_VALUE_LIST NULL +READ_ONLY NO +COMMAND_LINE_ARGUMENT REQUIRED VARIABLE_NAME KEY_CACHE_SEGMENTS SESSION_VALUE NULL GLOBAL_VALUE 0 @@ -2135,6 +2149,20 @@ NUMERIC_BLOCK_SIZE NULL ENUM_VALUE_LIST NULL READ_ONLY NO COMMAND_LINE_ARGUMENT NONE +VARIABLE_NAME MYSQL56_TEMPORAL_FORMAT +SESSION_VALUE NULL +GLOBAL_VALUE ON +GLOBAL_VALUE_ORIGIN COMPILE-TIME +DEFAULT_VALUE ON +VARIABLE_SCOPE GLOBAL +VARIABLE_TYPE BOOLEAN +VARIABLE_COMMENT Use MySQL-5.6 (instead of MariaDB-5.3) format for TIME, DATETIME, TIMESTAMP columns. +NUMERIC_MIN_VALUE NULL +NUMERIC_MAX_VALUE NULL +NUMERIC_BLOCK_SIZE NULL +ENUM_VALUE_LIST OFF,ON +READ_ONLY NO +COMMAND_LINE_ARGUMENT OPTIONAL VARIABLE_NAME NET_BUFFER_LENGTH SESSION_VALUE 16384 GLOBAL_VALUE 16384 @@ -3766,7 +3794,7 @@ GLOBAL_VALUE_ORIGIN COMPILE-TIME DEFAULT_VALUE OFF VARIABLE_SCOPE GLOBAL VARIABLE_TYPE BOOLEAN -VARIABLE_COMMENT Specify whether to time mutexes (only InnoDB mutexes are currently supported) +VARIABLE_COMMENT Specify whether to time mutexes. Deprecated, has no effect. NUMERIC_MIN_VALUE NULL NUMERIC_MAX_VALUE NULL NUMERIC_BLOCK_SIZE NULL diff --git a/mysql-test/t/analyze_stmt_slow_query_log.test b/mysql-test/t/analyze_stmt_slow_query_log.test index 92fa1a3f612..7346ac3b2c5 100644 --- a/mysql-test/t/analyze_stmt_slow_query_log.test +++ b/mysql-test/t/analyze_stmt_slow_query_log.test @@ -15,9 +15,8 @@ perl; my $slow_log_file= $ENV{'SLOW_LOG_FILE'} or die "SLOW_LOG_FILE not set"; open(FILE, $slow_log_file) or die "Failed to open $slow_log_file"; while() { - if (/explain:/) { - print $_; - } + next if 1../create table t1/; # skip entries generated by mtr prelude + print if /explain:/; } close(FILE); diff --git a/mysql-test/t/func_misc.test b/mysql-test/t/func_misc.test index 8b1f0ca108e..5236987e16f 100644 --- a/mysql-test/t/func_misc.test +++ b/mysql-test/t/func_misc.test @@ -863,6 +863,33 @@ SELECT INET6_NTOA(ip), HEX(ip), LENGTH(ip) FROM t2; DROP TABLE t1; DROP TABLE t2; +--echo # +--echo # MDEV-4018 : Microseconds in GET_LOCK() +--echo # + +--echo # -> Switching to connection 'default' +connection default; +select is_used_lock('test') = connection_id(); + +--echo # GET_LOCK returns 1 if it manages to acquire a lock +select get_lock('test', 0); + +connect (con1,localhost,root,,); +--echo # -> Switching to connection 'con1' +connection con1; +select is_used_lock('test') = connection_id(); +select get_lock('test', 0); +select get_lock('test', 1.0); +select get_lock('test', 1.5); +select get_lock('test', 0.1); +select get_lock('test', 0.000001); +select get_lock('test', 0.0000000000000001); + +--echo # -> Switching to connection 'default' +connection default; +select is_used_lock('test') = connection_id(); +select release_lock('test'); + --echo --echo # -- Done. --echo diff --git a/mysql-test/t/gis.test b/mysql-test/t/gis.test index 5dc5b48f32c..60642e5741c 100644 --- a/mysql-test/t/gis.test +++ b/mysql-test/t/gis.test @@ -1119,33 +1119,27 @@ FROM named_places WHERE name = 'Goose Island'; --echo # Conformance Item T10 -# TODO: ST_SRID() alias SELECT SRID(boundary) FROM named_places WHERE name = 'Goose Island'; --echo # Conformance Item T11 -# TODO: ST_IsEmpty() alias SELECT IsEmpty(centerline) FROM road_segments WHERE name = 'Route 5' AND aliases = 'Main Street'; -# FIXME: get wrong result:0, expected 1. -#--echo # Conformance Item T12 -# TODO: ST_IsSimple() alias -#SELECT IsSimple(shore) -#FROM lakes -#WHERE name = 'Blue Lake'; +--echo # Conformance Item T12 +SELECT IsSimple(shore) +FROM lakes +WHERE name = 'Blue Lake'; -# TODO: WL#2377 -#--echo # Conformance Item T13 -#SELECT AsText(Boundary((boundary),101) -#FROM named_places -#WHERE name = 'Goose Island'; +--echo # Conformance Item T13 +SELECT AsText(ST_Boundary(boundary)) +FROM named_places +WHERE name = 'Goose Island'; --echo # Conformance Item T14 -# TODO: ST_Envelope( ) alias # FIXME: we get anticlockwise, GIS suggests clockwise SELECT AsText(Envelope(boundary)) FROM named_places @@ -1170,122 +1164,100 @@ FROM road_segments WHERE fid = 102; --echo # Conformance Item T18 -# TODO: ST_EndPoint SELECT AsText(EndPoint(centerline)) FROM road_segments WHERE fid = 102; -# TODO: WL#2377 -#--echo # Conformance Item T19 -# TODO: ST_LineFromWKB() alias -#SELECT IsClosed(LineFromWKB(AsBinary(Boundary(boundary)),SRID(boundary))) -#FROM named_places -#WHERE name = 'Goose Island'; +SELECT IsClosed(LineFromWKB(AsBinary(Boundary(boundary)),SRID(boundary))) +FROM named_places +WHERE name = 'Goose Island'; -# TODO: WL#2377 -#--echo # Conformance Item T20 -#SELECT IsRing(LineFromWKB(AsBinary(Boundary(boundary)),SRID(boundary))) -#FROM named_places -#WHERE name = 'Goose Island'; +--echo # Conformance Item T20 +SELECT IsRing(LineFromWKB(AsBinary(Boundary(boundary)),SRID(boundary))) +FROM named_places +WHERE name = 'Goose Island'; --echo # Conformance Item T21 -# TODO: ST_Length() alias SELECT GLength(centerline) FROM road_segments WHERE fid = 106; --echo # Conformance Item T22 -# TODO: ST_NumPoints() alias SELECT NumPoints(centerline) FROM road_segments WHERE fid = 102; --echo # Conformance Item T23 -# TODO: ST_PointN() alias SELECT AsText(PointN(centerline, 1)) FROM road_segments WHERE fid = 102; --echo # Conformance Item T24 -# TODO: ST_Centroid() alias SELECT AsText(Centroid(boundary)) FROM named_places WHERE name = 'Goose Island'; -# TODO: WL#2377 -#--echo # Conformance Item T25 -#SELECT Contains(boundary, PointOnSurface(boundary)) -#FROM named_places -#WHERE name = 'Goose Island'; +SELECT ST_Contains(boundary, PointOnSurface(boundary)) +FROM named_places +WHERE name = 'Goose Island'; --echo # Conformance Item T26 -# TODO: ST_Area() alias SELECT Area(boundary) FROM named_places WHERE name = 'Goose Island'; --echo # Conformance Item T27 -# TODO: ST_ExteriorRing() alias SELECT AsText(ExteriorRing(shore)) FROM lakes WHERE name = 'Blue Lake'; --echo # Conformance Item T28 -# TODO: ST_NumInteriorRings() alias SELECT NumInteriorRings(shore) FROM lakes WHERE name = 'Blue Lake'; --echo # Conformance Item T29 -# TODO: ST_InteriorRingN() alias SELECT AsText(InteriorRingN(shore, 1)) FROM lakes WHERE name = 'Blue Lake'; --echo # Conformance Item T30 -# TODO: ST_NumGeometries() alias SELECT NumGeometries(centerlines) FROM divided_routes WHERE name = 'Route 75'; --echo # Conformance Item T31 -# TODO: ST_GeometryN() alias SELECT AsText(GeometryN(centerlines, 2)) FROM divided_routes WHERE name = 'Route 75'; --echo # Conformance Item T32 -# TODO: ST_IsClosed() alias SELECT IsClosed(centerlines) FROM divided_routes WHERE name = 'Route 75'; --echo # Conformance Item T33 -# TODO: ST_Length() alias SELECT GLength(centerlines) FROM divided_routes WHERE name = 'Route 75'; --echo # Conformance Item T34 -# TODO: ST_Centroid() alias SELECT AsText(Centroid(shores)) FROM ponds WHERE fid = 120; # TODO: WL#2377 -#--echo # Conformance Item T35 -#SELECT Contains(shores, PointOnSurface(shores)) -#FROM ponds -#WHERE fid = 120; +--echo # Conformance Item T35 +SELECT Contains(shores, PointOnSurface(shores)) +FROM ponds +WHERE fid = 120; --echo # Conformance Item T36 -# TODO: ST_Area() alias SELECT Area(shores) FROM ponds WHERE fid = 120; --echo # Conformance Item T37 -# TODO: ST_PolyFromText() alias SELECT ST_Equals(boundary, PolyFromText('POLYGON( ( 67 13, 67 18, 59 18, 59 13, 67 13) )',1)) FROM named_places @@ -1303,22 +1275,19 @@ FROM streams, lakes WHERE streams.name = 'Cam Stream' AND lakes.name = 'Blue Lake'; -# FIXME: wrong result: get 0, expected 1 -#--echo # Conformance Item T40 -#SELECT ST_Within(boundary, footprint) -#FROM named_places, buildings -#WHERE named_places.name = 'Ashton' -#AND buildings.address = '215 Main Street'; +--echo # Conformance Item T40 +SELECT ST_Within(footprint, boundary) +FROM named_places, buildings +WHERE named_places.name = 'Ashton' +AND buildings.address = '215 Main Street'; -# FIXME: wrong result: get 0, expected 1 -#--echo # Conformance Item T41 -#SELECT ST_Overlaps(forests.boundary, named_places.boundary) -#FROM forests, named_places -#WHERE forests.name = 'Green Forest' -#AND named_places.name = 'Ashton'; +--echo # Conformance Item T41 +SELECT ST_Overlaps(forests.boundary, named_places.boundary) +FROM forests, named_places +WHERE forests.name = 'Green Forest' +AND named_places.name = 'Ashton'; --echo # Conformance Item T42 -# FIXME: TODO: ST_Crosses() alias SELECT Crosses(road_segments.centerline, divided_routes.centerlines) FROM road_segments, divided_routes WHERE road_segments.fid = 102 @@ -1336,12 +1305,11 @@ FROM forests, named_places WHERE forests.name = 'Green Forest' AND named_places.name = 'Ashton'; -# TODO: WL#2377 -#--echo # Conformance Item T45 -#SELECT Relate(forests.boundary, named_places.boundary, 'TTTTTTTTT') -#FROM forests, named_places -#WHERE forests.name = 'Green Forest' -#AND named_places.name = 'Ashton'; +--echo # Conformance Item T45 +SELECT ST_Relate(forests.boundary, named_places.boundary, 'TTTTTTTTT') +FROM forests, named_places +WHERE forests.name = 'Green Forest' +AND named_places.name = 'Ashton'; --echo # Conformance Item T46 SELECT ST_Distance(position, boundary) @@ -1349,12 +1317,11 @@ FROM bridges, named_places WHERE bridges.name = 'Cam Bridge' AND named_places.name = 'Ashton'; -# FIXME: wrong result: NULL, expected 12 -#--echo # Conformance Item T47 -#SELECT AsText(ST_Intersection(centerline, shore)) -#FROM streams, lakes -#WHERE streams.name = 'Cam Stream' -#AND lakes.name = 'Blue Lake'; +--echo # Conformance Item T47 +SELECT AsText(ST_Intersection(centerline, shore)) +FROM streams, lakes +WHERE streams.name = 'Cam Stream' +AND lakes.name = 'Blue Lake'; --echo # Conformance Item T48 SELECT AsText(ST_Difference(named_places.boundary, forests.boundary)) @@ -1379,11 +1346,10 @@ SELECT count(*) FROM buildings, bridges WHERE ST_Contains(ST_Buffer(bridges.position, 15.0), buildings.footprint) = 1; -# TODO: WL#2377 -#--echo # Conformance Item T52 -#SELECT AsText(ConvexHull(shore)) -#FROM lakes -#WHERE lakes.name = 'Blue Lake'; +--echo # Conformance Item T52 +SELECT AsText(ConvexHull(shore)) +FROM lakes +WHERE lakes.name = 'Blue Lake'; DROP DATABASE gis_ogs; USE test; diff --git a/mysql-test/t/log_tables.test b/mysql-test/t/log_tables.test index 64c70c039ab..69e16bc87f5 100644 --- a/mysql-test/t/log_tables.test +++ b/mysql-test/t/log_tables.test @@ -309,7 +309,8 @@ CREATE TABLE `slow_log` ( `insert_id` int(11) NOT NULL, `server_id` int(10) unsigned NOT NULL, `sql_text` mediumtext NOT NULL, - `thread_id` BIGINT(21) UNSIGNED NOT NULL + `thread_id` BIGINT(21) UNSIGNED NOT NULL, + `rows_affected` int(11) NOT NULL ) ENGINE=CSV DEFAULT CHARSET=utf8 COMMENT='Slow log'; set global general_log='ON'; @@ -743,7 +744,7 @@ CREATE procedure `db_17876.archiveSlowLog`() BEGIN DECLARE start_time, query_time, lock_time CHAR(28); DECLARE user_host MEDIUMTEXT; - DECLARE rows_set, rows_examined, last_insert_id, insert_id, server_id INT; + DECLARE rows_set, rows_examined, last_insert_id, insert_id, server_id, rows_affected INT; DECLARE thread_id BIGINT UNSIGNED; DECLARE dbname MEDIUMTEXT; DECLARE sql_text BLOB; @@ -762,7 +763,7 @@ BEGIN FETCH cur1 INTO start_time, user_host, query_time, lock_time, rows_set, rows_examined, dbname, last_insert_id, - insert_id, server_id, sql_text, thread_id; + insert_id, server_id, sql_text, thread_id, rows_affected; END; IF NOT done THEN @@ -770,7 +771,8 @@ BEGIN INSERT INTO `db_17876.slow_log_data` VALUES(start_time, user_host, query_time, lock_time, rows_set, rows_examined, - dbname, last_insert_id, insert_id, server_id, sql_text, thread_id); + dbname, last_insert_id, insert_id, server_id, sql_text, thread_id, + rows_affected); END; END IF; END; diff --git a/mysql-test/t/set_statement.test b/mysql-test/t/set_statement.test index a65807192b5..8b8431315f4 100644 --- a/mysql-test/t/set_statement.test +++ b/mysql-test/t/set_statement.test @@ -965,16 +965,6 @@ SHOW CREATE TABLE t1; drop table t1; SET @@default_storage_engine=@save_dfs; -# -# statement timeout -# -SELECT @@MAX_STATEMENT_TIME; -SET STATEMENT MAX_STATEMENT_TIME=2 FOR SELECT SLEEP(1); -SHOW STATUS LIKE "max_statement_time_exceeded"; -SET STATEMENT MAX_STATEMENT_TIME=2 FOR SELECT SLEEP(3); -SHOW STATUS LIKE "max_statement_time_exceeded"; -SELECT @@MAX_STATEMENT_TIME; - # # MDEV-6946:Assertion `0' failed in mysql_execute_command on SET STATEMENT # keycache1.key_buffer_size=.. FOR @@ -1011,10 +1001,6 @@ set statement rand_seed2=default for select 1; --error ER_SET_STATEMENT_NOT_SUPPORTED set statement skip_replication=default for select 1; --error ER_SET_STATEMENT_NOT_SUPPORTED -set statement default_master_connection=default for select 1; ---error ER_SET_STATEMENT_NOT_SUPPORTED -set statement default_master_connection=default for select 1; ---error ER_SET_STATEMENT_NOT_SUPPORTED set statement last_insert_id=1 for select 1; --error ER_SET_STATEMENT_NOT_SUPPORTED set statement sql_log_off=default for select 1; diff --git a/mysql-test/t/set_statement_notembedded.test b/mysql-test/t/set_statement_notembedded.test new file mode 100644 index 00000000000..b0021de51ee --- /dev/null +++ b/mysql-test/t/set_statement_notembedded.test @@ -0,0 +1,17 @@ +--source include/not_embedded.inc + +# +# statement timeout +# +SELECT @@MAX_STATEMENT_TIME; +SET STATEMENT MAX_STATEMENT_TIME=2 FOR SELECT SLEEP(1); +SHOW STATUS LIKE "max_statement_time_exceeded"; +SET STATEMENT MAX_STATEMENT_TIME=2 FOR SELECT SLEEP(3); +SHOW STATUS LIKE "max_statement_time_exceeded"; +SELECT @@MAX_STATEMENT_TIME; + +--error ER_SET_STATEMENT_NOT_SUPPORTED +set statement default_master_connection=default for select 1; +--error ER_SET_STATEMENT_NOT_SUPPORTED +set statement default_master_connection=default for select 1; + diff --git a/mysql-test/t/union.test b/mysql-test/t/union.test index 929eb3f9534..8cb9d53842f 100644 --- a/mysql-test/t/union.test +++ b/mysql-test/t/union.test @@ -1089,6 +1089,7 @@ SELECT * FROM t1 UNION SELECT * FROM t1 ORDER BY MATCH(a) AGAINST ('+abc' IN BOOLEAN MODE); --echo # Should not crash +--sorted_result SELECT * FROM t1 UNION SELECT * FROM t1 ORDER BY MATCH(a) AGAINST ('+abc' IN BOOLEAN MODE); diff --git a/scripts/mysql_system_tables.sql b/scripts/mysql_system_tables.sql index faad08ab6d9..eea65f285d3 100644 --- a/scripts/mysql_system_tables.sql +++ b/scripts/mysql_system_tables.sql @@ -95,7 +95,7 @@ DROP PREPARE stmt; -- Create slow_log if CSV is enabled. -SET @str = IF (@have_csv = 'YES', 'CREATE TABLE IF NOT EXISTS slow_log (start_time TIMESTAMP(6) NOT NULL DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP, user_host MEDIUMTEXT NOT NULL, query_time TIME(6) NOT NULL, lock_time TIME(6) NOT NULL, rows_sent INTEGER NOT NULL, rows_examined INTEGER NOT NULL, db VARCHAR(512) NOT NULL, last_insert_id INTEGER NOT NULL, insert_id INTEGER NOT NULL, server_id INTEGER UNSIGNED NOT NULL, sql_text MEDIUMTEXT NOT NULL, thread_id BIGINT(21) UNSIGNED NOT NULL) engine=CSV CHARACTER SET utf8 comment="Slow log"', 'SET @dummy = 0'); +SET @str = IF (@have_csv = 'YES', 'CREATE TABLE IF NOT EXISTS slow_log (start_time TIMESTAMP(6) NOT NULL DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP, user_host MEDIUMTEXT NOT NULL, query_time TIME(6) NOT NULL, lock_time TIME(6) NOT NULL, rows_sent INTEGER NOT NULL, rows_examined INTEGER NOT NULL, db VARCHAR(512) NOT NULL, last_insert_id INTEGER NOT NULL, insert_id INTEGER NOT NULL, server_id INTEGER UNSIGNED NOT NULL, sql_text MEDIUMTEXT NOT NULL, thread_id BIGINT(21) UNSIGNED NOT NULL, rows_affected INTEGER NOT NULL) engine=CSV CHARACTER SET utf8 comment="Slow log"', 'SET @dummy = 0'); PREPARE stmt FROM @str; EXECUTE stmt; diff --git a/scripts/mysql_system_tables_fix.sql b/scripts/mysql_system_tables_fix.sql index b9bb59cb188..dab38bbd48c 100644 --- a/scripts/mysql_system_tables_fix.sql +++ b/scripts/mysql_system_tables_fix.sql @@ -250,6 +250,8 @@ SET @old_log_state = @@global.slow_query_log; SET GLOBAL slow_query_log = 'OFF'; ALTER TABLE slow_log ADD COLUMN thread_id BIGINT(21) UNSIGNED NOT NULL AFTER sql_text; +ALTER TABLE slow_log + ADD COLUMN rows_affected INTEGER NOT NULL AFTER thread_id; ALTER TABLE slow_log MODIFY start_time TIMESTAMP(6) NOT NULL DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP, MODIFY user_host MEDIUMTEXT NOT NULL, diff --git a/scripts/mysqld_safe.sh b/scripts/mysqld_safe.sh index f91d936c315..9a1d43ba996 100644 --- a/scripts/mysqld_safe.sh +++ b/scripts/mysqld_safe.sh @@ -153,7 +153,7 @@ log_notice () { } eval_log_error () { - cmd="$1" + local cmd="$1" case $logging in file) cmd="$cmd >> "`shell_quote_string "$err_log"`" 2>&1" ;; syslog) @@ -966,9 +966,9 @@ do if [ -z "$url" ] then - eval_log_error "$cmd $wsrep_start_position_opt $nohup_redir" + eval_log_error "$cmd $wsrep_start_position_opt" else - eval_log_error "$cmd $wsrep_start_position_opt --wsrep_cluster_address=$url $nohup_redir" + eval_log_error "$cmd $wsrep_start_position_opt --wsrep_cluster_address=$url" fi if [ $want_syslog -eq 0 -a ! -f "$err_log" ]; then diff --git a/scripts/mysqldumpslow.sh b/scripts/mysqldumpslow.sh index c04ffad7457..d8b6158ecbe 100644 --- a/scripts/mysqldumpslow.sh +++ b/scripts/mysqldumpslow.sh @@ -27,8 +27,8 @@ use strict; use Getopt::Long; -# t=time, l=lock time, r=rows -# at, al, and ar are the corresponding averages +# t=time, l=lock time, r=rows, a=rows affected +# at, al, ar and aa are the corresponding averages my %opt = ( s => 'at', @@ -110,9 +110,11 @@ while ( defined($_ = shift @pending) or defined($_ = <>) ) { s/^#? Time: \d{6}\s+\d+:\d+:\d+.*\n//; my ($user,$host) = s/^#? User\@Host:\s+(\S+)\s+\@\s+(\S+).*\n// ? ($1,$2) : ('',''); - s/^# Thread_id: [0-9]+\s+Schema: [^\n]+\n//; + s/^# Thread_id: [0-9]+\s+Schema: .*\s+QC_hit:.*[^\n]+\n//; s/^# Query_time: ([0-9.]+)\s+Lock_time: ([0-9.]+)\s+Rows_sent: ([0-9.]+)\s+Rows_examined: ([0-9.]+).*\n//; my ($t, $l, $r, $e) = ($1, $2, $3, $4); + s/^# Rows_affected: ([0-9.]+).*\n//; + my ($a) = ($1); $t -= $l unless $opt{l}; @@ -156,6 +158,7 @@ while ( defined($_ = shift @pending) or defined($_ = <>) ) { $s->{l} += $l; $s->{r} += $r; $s->{e} += $e; + $s->{a} += $a; $s->{users}->{$user}++ if $user; $s->{hosts}->{$host}++ if $host; @@ -164,11 +167,12 @@ while ( defined($_ = shift @pending) or defined($_ = <>) ) { foreach (keys %stmt) { my $v = $stmt{$_} || die; - my ($c, $t, $l, $r, $e) = @{ $v }{qw(c t l r e)}; + my ($c, $t, $l, $r, $e, $a) = @{ $v }{qw(c t l r e a)}; $v->{at} = $t / $c; $v->{al} = $l / $c; $v->{ar} = $r / $c; $v->{ae} = $e / $c; + $v->{aa} = $a / $c; } my @sorted = sort { $stmt{$b}->{$opt{s}} <=> $stmt{$a}->{$opt{s}} } keys %stmt; @@ -177,13 +181,13 @@ my @sorted = sort { $stmt{$b}->{$opt{s}} <=> $stmt{$a}->{$opt{s}} } keys %stmt; foreach (@sorted) { my $v = $stmt{$_} || die; - my ($c, $t,$at, $l,$al, $r,$ar,$e, $ae) = @{ $v }{qw(c t at l al r ar e ae)}; + my ($c, $t, $at, $l, $al, $r, $ar, $e, $ae, $a, $aa) = @{ $v }{qw(c t at l al r ar e ae a aa)}; my @users = keys %{$v->{users}}; my $user = (@users==1) ? $users[0] : sprintf "%dusers",scalar @users; my @hosts = keys %{$v->{hosts}}; my $host = (@hosts==1) ? $hosts[0] : sprintf "%dhosts",scalar @hosts; - printf "Count: %d Time=%.2fs (%ds) Lock=%.2fs (%ds) Rows_sent=%.1f (%d), Rows_examined=%.1f (%d), $user\@$host\n%s\n\n", - $c, $at,$t, $al,$l, $ar,$r, $ae, $e, $_; + printf "Count: %d Time=%.2fs (%ds) Lock=%.2fs (%ds) Rows_sent=%.1f (%d), Rows_examined=%.1f (%d), Rows_affected=%.1f (%d), $user\@$host\n%s\n\n", + $c, $at,$t, $al,$l, $ar,$r, $ae, $e, $aa, $a, $_; } sub usage { @@ -203,6 +207,7 @@ Parse and summarize the MySQL slow query log. Options are al: average lock time ar: average rows sent at: average query time + aa: average rows affected c: count l: lock time r: rows sent diff --git a/sql/gcalc_slicescan.cc b/sql/gcalc_slicescan.cc index 251869cad03..ed533abdaf4 100644 --- a/sql/gcalc_slicescan.cc +++ b/sql/gcalc_slicescan.cc @@ -1961,7 +1961,7 @@ double Gcalc_scan_iterator::get_h() const state.pi->calc_xy(&x, &next_y); } else - next_y= state.pi->y; + next_y= state.pi->next ? state.pi->get_next()->y : 0.0; return next_y - cur_y; } @@ -1974,7 +1974,7 @@ double Gcalc_scan_iterator::get_sp_x(const point *sp) const dy= sp->next_pi->y - sp->pi->y; if (fabs(dy) < 1e-12) return sp->pi->x; - return (sp->next_pi->x - sp->pi->x) * dy; + return sp->pi->x + (sp->next_pi->x - sp->pi->x) * dy; } diff --git a/sql/item_create.cc b/sql/item_create.cc index fa8249c3321..efc1d9d3504 100644 --- a/sql/item_create.cc +++ b/sql/item_create.cc @@ -513,7 +513,35 @@ protected: Create_func_centroid() {} virtual ~Create_func_centroid() {} }; -#endif + + +class Create_func_convexhull : public Create_func_arg1 +{ +public: + virtual Item *create_1_arg(THD *thd, Item *arg1); + + static Create_func_convexhull s_singleton; + +protected: + Create_func_convexhull() {} + virtual ~Create_func_convexhull() {} +}; + + +class Create_func_pointonsurface : public Create_func_arg1 +{ +public: + virtual Item *create_1_arg(THD *thd, Item *arg1); + + static Create_func_pointonsurface s_singleton; + +protected: + Create_func_pointonsurface() {} + virtual ~Create_func_pointonsurface() {} +}; + + +#endif /*HAVE_SPATIAL*/ class Create_func_char_length : public Create_func_arg1 @@ -1015,7 +1043,19 @@ protected: Create_func_envelope() {} virtual ~Create_func_envelope() {} }; -#endif + +class Create_func_boundary : public Create_func_arg1 +{ +public: + virtual Item *create_1_arg(THD *thd, Item *arg1); + + static Create_func_boundary s_singleton; + +protected: + Create_func_boundary() {} + virtual ~Create_func_boundary() {} +}; +#endif /*HAVE_SPATIAL*/ #ifdef HAVE_SPATIAL @@ -1466,6 +1506,19 @@ protected: #ifdef HAVE_SPATIAL +class Create_func_relate : public Create_func_arg3 +{ +public: + virtual Item *create_3_arg(THD *thd, Item *arg1, Item *arg2, Item *arg3); + + static Create_func_relate s_singleton; + +protected: + Create_func_relate() {} + virtual ~Create_func_relate() {} +}; + + class Create_func_mbr_intersects : public Create_func_arg2 { public: @@ -1596,6 +1649,19 @@ protected: Create_func_isclosed() {} virtual ~Create_func_isclosed() {} }; + + +class Create_func_isring : public Create_func_arg1 +{ +public: + virtual Item *create_1_arg(THD *thd, Item *arg1); + + static Create_func_isring s_singleton; + +protected: + Create_func_isring() {} + virtual ~Create_func_isring() {} +}; #endif @@ -3338,7 +3404,25 @@ Create_func_centroid::create_1_arg(THD *thd, Item *arg1) { return new (thd->mem_root) Item_func_centroid(arg1); } -#endif + + +Create_func_convexhull Create_func_convexhull::s_singleton; + +Item* +Create_func_convexhull::create_1_arg(THD *thd, Item *arg1) +{ + return new (thd->mem_root) Item_func_convexhull(arg1); +} + + +Create_func_pointonsurface Create_func_pointonsurface::s_singleton; + +Item* +Create_func_pointonsurface::create_1_arg(THD *thd, Item *arg1) +{ + return new (thd->mem_root) Item_func_pointonsurface(arg1); +} +#endif /*HAVE_SPATIAL*/ Create_func_char_length Create_func_char_length::s_singleton; @@ -3819,6 +3903,15 @@ Create_func_envelope::create_1_arg(THD *thd, Item *arg1) { return new (thd->mem_root) Item_func_envelope(arg1); } + + +Create_func_boundary Create_func_boundary::s_singleton; + +Item* +Create_func_boundary::create_1_arg(THD *thd, Item *arg1) +{ + return new (thd->mem_root) Item_func_boundary(arg1); +} #endif @@ -4329,6 +4422,15 @@ Create_func_interiorringn::create_2_arg(THD *thd, Item *arg1, Item *arg2) #ifdef HAVE_SPATIAL +Create_func_relate Create_func_relate::s_singleton; + +Item* +Create_func_relate::create_3_arg(THD *thd, Item *arg1, Item *arg2, Item *matrix) +{ + return new (thd->mem_root) Item_func_spatial_rel(arg1, arg2, matrix); +} + + Create_func_mbr_intersects Create_func_mbr_intersects::s_singleton; Item* @@ -4429,10 +4531,17 @@ Create_func_isclosed::create_1_arg(THD *thd, Item *arg1) { return new (thd->mem_root) Item_func_isclosed(arg1); } -#endif -#ifdef HAVE_SPATIAL +Create_func_isring Create_func_isring::s_singleton; + +Item* +Create_func_isring::create_1_arg(THD *thd, Item *arg1) +{ + return new (thd->mem_root) Item_func_isring(arg1); +} + + Create_func_isempty Create_func_isempty::s_singleton; Item* @@ -4440,7 +4549,7 @@ Create_func_isempty::create_1_arg(THD *thd, Item *arg1) { return new (thd->mem_root) Item_func_isempty(arg1); } -#endif +#endif /*HAVE_SPATIAL*/ Create_func_isnull Create_func_isnull::s_singleton; @@ -5656,6 +5765,7 @@ static Native_func_registry func_array[] = { { C_STRING_WITH_LEN("BINLOG_GTID_POS") }, BUILDER(Create_func_binlog_gtid_pos)}, { { C_STRING_WITH_LEN("BIT_COUNT") }, BUILDER(Create_func_bit_count)}, { { C_STRING_WITH_LEN("BIT_LENGTH") }, BUILDER(Create_func_bit_length)}, + { { C_STRING_WITH_LEN("BOUNDARY") }, GEOM_BUILDER(Create_func_boundary)}, { { C_STRING_WITH_LEN("BUFFER") }, GEOM_BUILDER(Create_func_buffer)}, { { C_STRING_WITH_LEN("CEIL") }, BUILDER(Create_func_ceiling)}, { { C_STRING_WITH_LEN("CEILING") }, BUILDER(Create_func_ceiling)}, @@ -5673,6 +5783,7 @@ static Native_func_registry func_array[] = { { C_STRING_WITH_LEN("CONNECTION_ID") }, BUILDER(Create_func_connection_id)}, { { C_STRING_WITH_LEN("CONV") }, BUILDER(Create_func_conv)}, { { C_STRING_WITH_LEN("CONVERT_TZ") }, BUILDER(Create_func_convert_tz)}, + { { C_STRING_WITH_LEN("CONVEXHULL") }, GEOM_BUILDER(Create_func_convexhull)}, { { C_STRING_WITH_LEN("COS") }, BUILDER(Create_func_cos)}, { { C_STRING_WITH_LEN("COT") }, BUILDER(Create_func_cot)}, { { C_STRING_WITH_LEN("CRC32") }, BUILDER(Create_func_crc32)}, @@ -5737,6 +5848,7 @@ static Native_func_registry func_array[] = { { C_STRING_WITH_LEN("ISCLOSED") }, GEOM_BUILDER(Create_func_isclosed)}, { { C_STRING_WITH_LEN("ISEMPTY") }, GEOM_BUILDER(Create_func_isempty)}, { { C_STRING_WITH_LEN("ISNULL") }, BUILDER(Create_func_isnull)}, + { { C_STRING_WITH_LEN("ISRING") }, GEOM_BUILDER(Create_func_isring)}, { { C_STRING_WITH_LEN("ISSIMPLE") }, GEOM_BUILDER(Create_func_issimple)}, { { C_STRING_WITH_LEN("IS_FREE_LOCK") }, BUILDER(Create_func_is_free_lock)}, { { C_STRING_WITH_LEN("IS_USED_LOCK") }, BUILDER(Create_func_is_used_lock)}, @@ -5803,6 +5915,7 @@ static Native_func_registry func_array[] = { { C_STRING_WITH_LEN("POINTFROMTEXT") }, GEOM_BUILDER(Create_func_geometry_from_text)}, { { C_STRING_WITH_LEN("POINTFROMWKB") }, GEOM_BUILDER(Create_func_geometry_from_wkb)}, { { C_STRING_WITH_LEN("POINTN") }, GEOM_BUILDER(Create_func_pointn)}, + { { C_STRING_WITH_LEN("POINTONSURFACE") }, GEOM_BUILDER(Create_func_pointonsurface)}, { { C_STRING_WITH_LEN("POLYFROMTEXT") }, GEOM_BUILDER(Create_func_geometry_from_text)}, { { C_STRING_WITH_LEN("POLYFROMWKB") }, GEOM_BUILDER(Create_func_geometry_from_wkb)}, { { C_STRING_WITH_LEN("POLYGONFROMTEXT") }, GEOM_BUILDER(Create_func_geometry_from_text)}, @@ -5839,9 +5952,11 @@ static Native_func_registry func_array[] = { { C_STRING_WITH_LEN("ST_ASTEXT") }, GEOM_BUILDER(Create_func_as_wkt)}, { { C_STRING_WITH_LEN("ST_ASWKB") }, GEOM_BUILDER(Create_func_as_wkb)}, { { C_STRING_WITH_LEN("ST_ASWKT") }, GEOM_BUILDER(Create_func_as_wkt)}, + { { C_STRING_WITH_LEN("ST_BOUNDARY") }, GEOM_BUILDER(Create_func_boundary)}, { { C_STRING_WITH_LEN("ST_BUFFER") }, GEOM_BUILDER(Create_func_buffer)}, { { C_STRING_WITH_LEN("ST_CENTROID") }, GEOM_BUILDER(Create_func_centroid)}, { { C_STRING_WITH_LEN("ST_CONTAINS") }, GEOM_BUILDER(Create_func_contains)}, + { { C_STRING_WITH_LEN("ST_CONVEXHULL") }, GEOM_BUILDER(Create_func_convexhull)}, { { C_STRING_WITH_LEN("ST_CROSSES") }, GEOM_BUILDER(Create_func_crosses)}, { { C_STRING_WITH_LEN("ST_DIFFERENCE") }, GEOM_BUILDER(Create_func_difference)}, { { C_STRING_WITH_LEN("ST_DIMENSION") }, GEOM_BUILDER(Create_func_dimension)}, @@ -5870,6 +5985,7 @@ static Native_func_registry func_array[] = { { C_STRING_WITH_LEN("ST_INTERSECTION") }, GEOM_BUILDER(Create_func_intersection)}, { { C_STRING_WITH_LEN("ST_ISCLOSED") }, GEOM_BUILDER(Create_func_isclosed)}, { { C_STRING_WITH_LEN("ST_ISEMPTY") }, GEOM_BUILDER(Create_func_isempty)}, + { { C_STRING_WITH_LEN("ST_ISRING") }, GEOM_BUILDER(Create_func_isring)}, { { C_STRING_WITH_LEN("ST_ISSIMPLE") }, GEOM_BUILDER(Create_func_issimple)}, { { C_STRING_WITH_LEN("ST_LENGTH") }, GEOM_BUILDER(Create_func_glength)}, { { C_STRING_WITH_LEN("ST_LINEFROMTEXT") }, GEOM_BUILDER(Create_func_geometry_from_text)}, @@ -5883,10 +5999,12 @@ static Native_func_registry func_array[] = { { C_STRING_WITH_LEN("ST_POINTFROMTEXT") }, GEOM_BUILDER(Create_func_geometry_from_text)}, { { C_STRING_WITH_LEN("ST_POINTFROMWKB") }, GEOM_BUILDER(Create_func_geometry_from_wkb)}, { { C_STRING_WITH_LEN("ST_POINTN") }, GEOM_BUILDER(Create_func_pointn)}, + { { C_STRING_WITH_LEN("ST_POINTONSURFACE") }, GEOM_BUILDER(Create_func_pointonsurface)}, { { C_STRING_WITH_LEN("ST_POLYFROMTEXT") }, GEOM_BUILDER(Create_func_geometry_from_text)}, { { C_STRING_WITH_LEN("ST_POLYFROMWKB") }, GEOM_BUILDER(Create_func_geometry_from_wkb)}, { { C_STRING_WITH_LEN("ST_POLYGONFROMTEXT") }, GEOM_BUILDER(Create_func_geometry_from_text)}, { { C_STRING_WITH_LEN("ST_POLYGONFROMWKB") }, GEOM_BUILDER(Create_func_geometry_from_wkb)}, + { { C_STRING_WITH_LEN("ST_RELATE") }, GEOM_BUILDER(Create_func_relate)}, { { C_STRING_WITH_LEN("ST_SRID") }, GEOM_BUILDER(Create_func_srid)}, { { C_STRING_WITH_LEN("ST_STARTPOINT") }, GEOM_BUILDER(Create_func_startpoint)}, { { C_STRING_WITH_LEN("ST_SYMDIFFERENCE") }, GEOM_BUILDER(Create_func_symdifference)}, diff --git a/sql/item_func.cc b/sql/item_func.cc index 25c0197cb9b..30a9aa9821c 100644 --- a/sql/item_func.cc +++ b/sql/item_func.cc @@ -4257,7 +4257,7 @@ longlong Item_func_get_lock::val_int() { DBUG_ASSERT(fixed == 1); String *res= args[0]->val_str(&value); - ulonglong timeout= args[1]->val_int(); + double timeout= args[1]->val_real(); THD *thd= current_thd; User_level_lock *ull; DBUG_ENTER("Item_func_get_lock::val_int"); diff --git a/sql/item_func.h b/sql/item_func.h index 6c9d7e8af74..bc5f15ec16d 100644 --- a/sql/item_func.h +++ b/sql/item_func.h @@ -61,7 +61,7 @@ public: SP_TOUCHES_FUNC,SP_CROSSES_FUNC,SP_WITHIN_FUNC, SP_CONTAINS_FUNC,SP_OVERLAPS_FUNC, SP_STARTPOINT,SP_ENDPOINT,SP_EXTERIORRING, - SP_POINTN,SP_GEOMETRYN,SP_INTERIORRINGN, + SP_POINTN,SP_GEOMETRYN,SP_INTERIORRINGN, SP_RELATE_FUNC, NOT_FUNC, NOT_ALL_FUNC, NOW_FUNC, TRIG_COND_FUNC, SUSERVAR_FUNC, GUSERVAR_FUNC, COLLATE_FUNC, diff --git a/sql/item_geofunc.cc b/sql/item_geofunc.cc index d9200b3e8d3..d38729771f8 100644 --- a/sql/item_geofunc.cc +++ b/sql/item_geofunc.cc @@ -218,6 +218,130 @@ String *Item_func_envelope::val_str(String *str) } +int Item_func_boundary::Transporter::single_point(double x, double y) +{ + return 0; +} + + +int Item_func_boundary::Transporter::start_line() +{ + n_points= 0; + current_type= Gcalc_function::shape_line; + return 0; +} + + +int Item_func_boundary::Transporter::complete_line() +{ + current_type= (Gcalc_function::shape_type) 0; + if (n_points > 1) + return m_receiver->single_point(last_x, last_y); + return 0; +} + + +int Item_func_boundary::Transporter::start_poly() +{ + current_type= Gcalc_function::shape_polygon; + return 0; +} + + +int Item_func_boundary::Transporter::complete_poly() +{ + current_type= (Gcalc_function::shape_type) 0; + return 0; +} + + +int Item_func_boundary::Transporter::start_ring() +{ + n_points= 0; + return m_receiver->start_shape(Gcalc_function::shape_line); +} + + +int Item_func_boundary::Transporter::complete_ring() +{ + if (n_points > 1) + { + m_receiver->add_point(last_x, last_y); + } + m_receiver->complete_shape(); + return 0; +} + + +int Item_func_boundary::Transporter::add_point(double x, double y) +{ + ++n_points; + if (current_type== Gcalc_function::shape_polygon) + { + /* Polygon's ring case */ + if (n_points == 1) + { + last_x= x; + last_y= y; + } + return m_receiver->add_point(x, y); + } + + if (current_type== Gcalc_function::shape_line) + { + /* Line's case */ + last_x= x; + last_y= y; + if (n_points == 1) + return m_receiver->single_point(x, y); + } + return 0; +} + + +int Item_func_boundary::Transporter::start_collection(int n_objects) +{ + return 0; +} + + +String *Item_func_boundary::val_str(String *str_value) +{ + DBUG_ENTER("Item_func_boundary::val_str"); + DBUG_ASSERT(fixed == 1); + String arg_val; + String *swkb= args[0]->val_str(&arg_val); + Geometry_buffer buffer; + Geometry *g; + uint32 srid= 0; + Transporter trn(&res_receiver); + + if ((null_value= + args[0]->null_value || + !(g= Geometry::construct(&buffer, swkb->ptr(), swkb->length())))) + DBUG_RETURN(0); + + if (g->store_shapes(&trn)) + goto mem_error; + + str_value->set_charset(&my_charset_bin); + if (str_value->reserve(SRID_SIZE, 512)) + goto mem_error; + str_value->length(0); + str_value->q_append(srid); + + if (!Geometry::create_from_opresult(&buffer, str_value, res_receiver)) + goto mem_error; + + res_receiver.reset(); + DBUG_RETURN(str_value); + +mem_error: + null_value= 1; + DBUG_RETURN(0); +} + + Field::geometry_type Item_func_centroid::get_geometry_type() const { return Field::GEOM_POINT; @@ -248,6 +372,289 @@ String *Item_func_centroid::val_str(String *str) } +int Item_func_convexhull::add_node_to_line(ch_node **p_cur, int dir, + const Gcalc_heap::Info *pi) +{ + ch_node *new_node; + ch_node *cur= *p_cur; + + while (cur->prev) + { + int v_sign= Gcalc_scan_iterator::point::cmp_dx_dy( + cur->prev->pi, cur->pi, cur->pi, pi); + if (v_sign*dir <0) + break; + new_node= cur; + cur= cur->prev; + res_heap.free_item(new_node); + } + if (!(new_node= new_ch_node())) + return 1; + cur->next= new_node; + new_node->prev= cur; + new_node->pi= pi; + *p_cur= new_node; + return 0; +} + + +#ifndef HEAVY_CONVEX_HULL +String *Item_func_convexhull::val_str(String *str_value) +{ + Geometry_buffer buffer; + Geometry *geom= NULL; + MBR mbr; + const char *c_end; + Gcalc_operation_transporter trn(&func, &collector); + uint32 srid= 0; + ch_node *left_first, *left_cur, *right_first, *right_cur; + Gcalc_heap::Info *cur_pi; + + DBUG_ENTER("Item_func_convexhull::val_str"); + DBUG_ASSERT(fixed == 1); + String *swkb= args[0]->val_str(&tmp_value); + + if ((null_value= + args[0]->null_value || + !(geom= Geometry::construct(&buffer, swkb->ptr(), swkb->length())))) + DBUG_RETURN(0); + + geom->get_mbr(&mbr, &c_end); + collector.set_extent(mbr.xmin, mbr.xmax, mbr.ymin, mbr.ymax); + if ((null_value= geom->store_shapes(&trn))) + { + str_value= 0; + goto mem_error; + } + + collector.prepare_operation(); + if (!(cur_pi= collector.get_first())) + goto build_result; /* An EMPTY GEOMETRY */ + + if (!cur_pi->get_next()) + { + /* Single point. */ + if (res_receiver.single_point(cur_pi->x, cur_pi->y)) + goto mem_error; + goto build_result; + } + + left_cur= left_first= new_ch_node(); + right_cur= right_first= new_ch_node(); + right_first->prev= left_first->prev= 0; + right_first->pi= left_first->pi= cur_pi; + + while ((cur_pi= cur_pi->get_next())) + { + /* Handle left part of the hull, then the right part. */ + if (add_node_to_line(&left_cur, 1, cur_pi)) + goto mem_error; + if (add_node_to_line(&right_cur, -1, cur_pi)) + goto mem_error; + } + + left_cur->next= 0; + if (left_first->get_next()->get_next() == NULL && + right_cur->prev->prev == NULL) + { + /* We only have 2 nodes in the result, so we create a polyline. */ + if (res_receiver.start_shape(Gcalc_function::shape_line) || + res_receiver.add_point(left_first->pi->x, left_first->pi->y) || + res_receiver.add_point(left_cur->pi->x, left_cur->pi->y) || + res_receiver.complete_shape()) + + goto mem_error; + + goto build_result; + } + + if (res_receiver.start_shape(Gcalc_function::shape_polygon)) + goto mem_error; + + while (left_first) + { + if (res_receiver.add_point(left_first->pi->x, left_first->pi->y)) + goto mem_error; + left_first= left_first->get_next(); + } + + /* Skip last point in the right part as it coincides */ + /* with the last one in the left. */ + right_cur= right_cur->prev; + while (right_cur->prev) + { + if (res_receiver.add_point(right_cur->pi->x, right_cur->pi->y)) + goto mem_error; + right_cur= right_cur->prev; + } + res_receiver.complete_shape(); + +build_result: + str_value->set_charset(&my_charset_bin); + if (str_value->reserve(SRID_SIZE, 512)) + goto mem_error; + str_value->length(0); + str_value->q_append(srid); + + if (!Geometry::create_from_opresult(&buffer, str_value, res_receiver)) + goto mem_error; + +mem_error: + collector.reset(); + func.reset(); + res_receiver.reset(); + res_heap.reset(); + DBUG_RETURN(str_value); +} + +#else /*HEAVY_CONVEX_HULL*/ +String *Item_func_convexhull::val_str(String *str_value) +{ + Geometry_buffer buffer; + Geometry *geom= NULL; + MBR mbr; + const char *c_end; + Gcalc_operation_transporter trn(&func, &collector); + const Gcalc_scan_iterator::event_point *ev; + uint32 srid= 0; + ch_node *left_first, *left_cur, *right_first, *right_cur; + + DBUG_ENTER("Item_func_convexhull::val_str"); + DBUG_ASSERT(fixed == 1); + String *swkb= args[0]->val_str(&tmp_value); + + if ((null_value= + args[0]->null_value || + !(geom= Geometry::construct(&buffer, swkb->ptr(), swkb->length())))) + DBUG_RETURN(0); + + geom->get_mbr(&mbr, &c_end); + collector.set_extent(mbr.xmin, mbr.xmax, mbr.ymin, mbr.ymax); + if ((null_value= geom->store_shapes(&trn))) + { + str_value= 0; + goto mem_error; + } + + collector.prepare_operation(); + scan_it.init(&collector); + scan_it.killed= (int *) &(current_thd->killed); + + if (!scan_it.more_points()) + goto build_result; /* An EMPTY GEOMETRY */ + + if (scan_it.step()) + goto mem_error; + + if (!scan_it.more_points()) + { + /* Single point. */ + if (res_receiver.single_point(scan_it.get_events()->pi->x, + scan_it.get_events()->pi->y)) + goto mem_error; + goto build_result; + } + + left_cur= left_first= new_ch_node(); + right_cur= right_first= new_ch_node(); + right_first->prev= left_first->prev= 0; + right_first->pi= left_first->pi= scan_it.get_events()->pi; + + while (scan_it.more_points()) + { + if (scan_it.step()) + goto mem_error; + ev= scan_it.get_events(); + + /* Skip the intersections-only events. */ + while (ev->event == scev_intersection) + { + ev= ev->get_next(); + if (!ev) + goto skip_point; + } + + { + Gcalc_point_iterator pit(&scan_it); + if (!pit.point() || scan_it.get_event_position() == pit.point()) + { + /* Handle left part of the hull. */ + if (add_node_to_line(&left_cur, 1, ev->pi)) + goto mem_error; + } + if (pit.point()) + { + /* Check the rightmost point */ + for(; pit.point()->c_get_next(); ++pit) + ; + } + if (!pit.point() || pit.point()->event || + scan_it.get_event_position() == pit.point()->c_get_next()) + { + /* Handle right part of the hull. */ + if (add_node_to_line(&right_cur, -1, ev->pi)) + goto mem_error; + } + } +skip_point:; + } + + left_cur->next= 0; + if (left_first->get_next()->get_next() == NULL && + right_cur->prev->prev == NULL) + { + /* We only have 2 nodes in the result, so we create a polyline. */ + if (res_receiver.start_shape(Gcalc_function::shape_line) || + res_receiver.add_point(left_first->pi->x, left_first->pi->y) || + res_receiver.add_point(left_cur->pi->x, left_cur->pi->y) || + res_receiver.complete_shape()) + + goto mem_error; + + goto build_result; + } + + if (res_receiver.start_shape(Gcalc_function::shape_polygon)) + goto mem_error; + + while (left_first) + { + if (res_receiver.add_point(left_first->pi->x, left_first->pi->y)) + goto mem_error; + left_first= left_first->get_next(); + } + + /* Skip last point in the right part as it coincides */ + /* with the last one in the left. */ + right_cur= right_cur->prev; + while (right_cur->prev) + { + if (res_receiver.add_point(right_cur->pi->x, right_cur->pi->y)) + goto mem_error; + right_cur= right_cur->prev; + } + res_receiver.complete_shape(); + +build_result: + str_value->set_charset(&my_charset_bin); + if (str_value->reserve(SRID_SIZE, 512)) + goto mem_error; + str_value->length(0); + str_value->q_append(srid); + + if (!Geometry::create_from_opresult(&buffer, str_value, res_receiver)) + goto mem_error; + +mem_error: + collector.reset(); + func.reset(); + res_receiver.reset(); + res_heap.reset(); + DBUG_RETURN(str_value); +} +#endif /*HEAVY_CONVEX_HULL*/ + + /* Spatial decomposition functions */ @@ -593,12 +1000,17 @@ longlong Item_func_spatial_mbr_rel::val_int() Item_func_spatial_rel::Item_func_spatial_rel(Item *a,Item *b, enum Functype sp_rel) : - Item_bool_func2(a,b), collector() + Item_int_func(a,b), collector() { spatial_rel = sp_rel; } +Item_func_spatial_rel::Item_func_spatial_rel(Item *a,Item *b, Item *mask) : + Item_int_func(a,b,mask), spatial_rel(SP_RELATE_FUNC) +{} + + Item_func_spatial_rel::~Item_func_spatial_rel() { } @@ -623,6 +1035,8 @@ const char *Item_func_spatial_rel::func_name() const return "st_crosses"; case SP_OVERLAPS_FUNC: return "st_overlaps"; + case SP_RELATE_FUNC: + return "st_relate"; default: DBUG_ASSERT(0); // Should never happened return "sp_unknown"; @@ -661,6 +1075,84 @@ static double distance_points(const Gcalc_heap::Info *a, } +static Gcalc_function::op_type op_matrix(int n) +{ + switch (n) + { + case 0: + return Gcalc_function::op_border; + case 1: + return Gcalc_function::op_internals; + case 2: + return (Gcalc_function::op_type) + ((int) Gcalc_function::op_not | (int) Gcalc_function::op_union); + }; + GCALC_DBUG_ASSERT(FALSE); + return Gcalc_function::op_any; +} + + +static int setup_relate_func(Geometry *g1, Geometry *g2, + Gcalc_operation_transporter *trn, Gcalc_function *func, + const char *mask) +{ + int do_store_shapes=1; + uint shape_a, shape_b; + uint n_operands= 0; + int last_shape_pos; + + last_shape_pos= func->get_next_expression_pos(); + func->add_operation(Gcalc_function::op_intersection, 0); + for (int nc=0; nc<9; nc++) + { + uint cur_op; + + cur_op= Gcalc_function::op_intersection; + switch (mask[nc]) + { + case '*': + continue; + case 'T': + case '0': + case '1': + case '2': + cur_op|= Gcalc_function::v_find_t; + break; + case 'F': + cur_op|= Gcalc_function::v_find_f; + break; + }; + ++n_operands; + if (func->reserve_op_buffer(1)) + return 1; + func->add_operation(cur_op, 2); + + func->add_operation(op_matrix(nc/3), 1); + if (do_store_shapes) + { + shape_a= func->get_next_expression_pos(); + if (g1->store_shapes(trn)) + return 1; + } + else + func->repeat_expression(shape_a); + func->add_operation(op_matrix(nc%3), 1); + if (do_store_shapes) + { + shape_b= func->get_next_expression_pos(); + if (g2->store_shapes(trn)) + return 1; + do_store_shapes= 0; + } + else + func->repeat_expression(shape_b); + } + + func->add_operands_to_op(last_shape_pos, n_operands); + return 0; +} + + #define GIS_ZERO 0.00000000001 longlong Item_func_spatial_rel::val_int() @@ -669,6 +1161,7 @@ longlong Item_func_spatial_rel::val_int() DBUG_ASSERT(fixed == 1); String *res1; String *res2; + String *res3; Geometry_buffer buffer1, buffer2; Geometry *g1, *g2; int result= 0; @@ -736,6 +1229,8 @@ longlong Item_func_spatial_rel::val_int() case SP_OVERLAPS_FUNC: case SP_CROSSES_FUNC: func.add_operation(Gcalc_function::op_intersection, 2); + if (func.reserve_op_buffer(1)) + break; func.add_operation(Gcalc_function::v_find_t | Gcalc_function::op_intersection, 2); shape_a= func.get_next_expression_pos(); @@ -744,6 +1239,8 @@ longlong Item_func_spatial_rel::val_int() shape_b= func.get_next_expression_pos(); if ((null_value= g2->store_shapes(&trn))) break; + if (func.reserve_op_buffer(7)) + break; func.add_operation(Gcalc_function::v_find_t | Gcalc_function::op_intersection, 2); func.add_operation(Gcalc_function::v_find_t | @@ -756,6 +1253,8 @@ longlong Item_func_spatial_rel::val_int() func.repeat_expression(shape_a); break; case SP_TOUCHES_FUNC: + if (func.reserve_op_buffer(2)) + break; func.add_operation(Gcalc_function::op_intersection, 2); func.add_operation(Gcalc_function::v_find_f | Gcalc_function::op_not | @@ -775,6 +1274,13 @@ longlong Item_func_spatial_rel::val_int() func.add_operation(Gcalc_function::op_border, 1); func.repeat_expression(shape_b); break; + case SP_RELATE_FUNC: + res3= args[2]->val_str(&tmp_matrix); + if ((null_value= args[2]->null_value)) + break; + null_value= (res3->length() != 9) || + setup_relate_func(g1, g2, &trn, &func, res3->ptr()); + break; default: DBUG_ASSERT(FALSE); break; @@ -859,7 +1365,7 @@ String *Item_func_spatial_operation::val_str(String *str_value) str_value->length(0); str_value->q_append(srid); - if (Geometry::create_from_opresult(&buffer1, str_value, res_receiver)) + if (!Geometry::create_from_opresult(&buffer1, str_value, res_receiver)) goto exit; exit: @@ -1319,7 +1825,7 @@ String *Item_func_buffer::val_str(String *str_value) str_value->length(0); str_value->q_append(srid); - if (Geometry::create_from_opresult(&buffer, str_value, res_receiver)) + if (!Geometry::create_from_opresult(&buffer, str_value, res_receiver)) goto mem_error; null_value= 0; @@ -1423,6 +1929,30 @@ longlong Item_func_isclosed::val_int() return (longlong) isclosed; } + +longlong Item_func_isring::val_int() +{ + /* It's actually a combination of two functions - IsClosed and IsSimple */ + DBUG_ASSERT(fixed == 1); + String tmp; + String *swkb= args[0]->val_str(&tmp); + Geometry_buffer buffer; + Geometry *geom; + int isclosed= 0; // In case of error + + null_value= (!swkb || + args[0]->null_value || + !(geom= + Geometry::construct(&buffer, swkb->ptr(), swkb->length())) || + geom->is_closed(&isclosed)); + + if (!isclosed) + return 0; + + return Item_func_issimple::val_int(); +} + + /* Numerical functions */ @@ -1739,6 +2269,121 @@ mem_error: } +String *Item_func_pointonsurface::val_str(String *str) +{ + Gcalc_operation_transporter trn(&func, &collector); + + DBUG_ENTER("Item_func_pointonsurface::val_real"); + DBUG_ASSERT(fixed == 1); + String *res= args[0]->val_str(&tmp_value); + Geometry_buffer buffer; + Geometry *g; + MBR mbr; + const char *c_end; + double px, py, x0, y0; + String *result= 0; + const Gcalc_scan_iterator::point *pprev= NULL; + uint32 srid; + + + null_value= 1; + if ((args[0]->null_value || + !(g= Geometry::construct(&buffer, res->ptr(), res->length())) || + g->get_mbr(&mbr, &c_end))) + goto mem_error; + + collector.set_extent(mbr.xmin, mbr.xmax, mbr.ymin, mbr.ymax); + + if (g->store_shapes(&trn)) + goto mem_error; + + collector.prepare_operation(); + scan_it.init(&collector); + + while (scan_it.more_points()) + { + if (scan_it.step()) + goto mem_error; + + if (scan_it.get_h() > GIS_ZERO) + { + y0= scan_it.get_y(); + break; + } + } + + if (!scan_it.more_points()) + { + goto exit; + } + + if (scan_it.step()) + goto mem_error; + + for (Gcalc_point_iterator pit(&scan_it); pit.point(); ++pit) + { + if (pprev == NULL) + { + pprev= pit.point(); + continue; + } + x0= scan_it.get_sp_x(pprev); + px= scan_it.get_sp_x(pit.point()); + if (px - x0 > GIS_ZERO) + { + if (scan_it.get_h() > GIS_ZERO) + { + px= (px + x0) / 2.0; + py= scan_it.get_y(); + } + else + { + px= (px + x0) / 2.0; + py= (y0 + scan_it.get_y()) / 2.0; + } + null_value= 0; + break; + } + pprev= NULL; + } + + if (null_value) + goto exit; + + str->set_charset(&my_charset_bin); + if (str->reserve(SRID_SIZE, 512)) + goto mem_error; + + str->length(0); + srid= uint4korr(res->ptr()); + str->q_append(srid); + + if (Geometry::create_point(str, px, py)) + goto mem_error; + + result= str; + +exit: + collector.reset(); + func.reset(); + scan_it.reset(); + DBUG_RETURN(result); + +mem_error: + collector.reset(); + func.reset(); + scan_it.reset(); + null_value= 1; + DBUG_RETURN(0); +} + + +Field::geometry_type Item_func_pointonsurface::get_geometry_type() const +{ + return Field::GEOM_POINT; +} + + #ifndef DBUG_OFF longlong Item_func_gis_debug::val_int() { diff --git a/sql/item_geofunc.h b/sql/item_geofunc.h index 6d52661e5c9..64863ed7d18 100644 --- a/sql/item_geofunc.h +++ b/sql/item_geofunc.h @@ -93,6 +93,39 @@ public: }; }; + +// #define HEAVY_CONVEX_HULL +class Item_func_convexhull: public Item_geometry_func +{ + class ch_node: public Gcalc_dyn_list::Item + { + public: + const Gcalc_heap::Info *pi; + ch_node *prev; + Gcalc_dyn_list::Item *next; + ch_node *get_next() { return (ch_node *) next; } + }; + + Gcalc_heap collector; + Gcalc_function func; + Gcalc_dyn_list res_heap; + + Gcalc_result_receiver res_receiver; + String tmp_value; +#ifdef HEAVY_CONVEX_HULL + Gcalc_scan_iterator scan_it; +#endif /*HEAVY_CONVEX_HULL*/ + ch_node *new_ch_node() { return (ch_node *) res_heap.new_item(); } + int add_node_to_line(ch_node **p_cur, int dir, const Gcalc_heap::Info *pi); +public: + Item_func_convexhull(Item *a): Item_geometry_func(a), + res_heap(8192, sizeof(ch_node)) + {} + const char *func_name() const { return "st_convexhull"; } + String *val_str(String *); +}; + + class Item_func_centroid: public Item_geometry_func { public: @@ -111,6 +144,38 @@ public: Field::geometry_type get_geometry_type() const; }; + +class Item_func_boundary: public Item_geometry_func +{ + class Transporter : public Gcalc_shape_transporter + { + Gcalc_result_receiver *m_receiver; + uint n_points; + Gcalc_function::shape_type current_type; + double last_x, last_y; + public: + Transporter(Gcalc_result_receiver *receiver) : + Gcalc_shape_transporter(NULL), m_receiver(receiver) + {} + int single_point(double x, double y); + int start_line(); + int complete_line(); + int start_poly(); + int complete_poly(); + int start_ring(); + int complete_ring(); + int add_point(double x, double y); + + int start_collection(int n_objects); + }; + Gcalc_result_receiver res_receiver; +public: + Item_func_boundary(Item *a): Item_geometry_func(a) {} + const char *func_name() const { return "st_boundary"; } + String *val_str(String *); +}; + + class Item_func_point: public Item_geometry_func { public: @@ -229,15 +294,16 @@ public: }; -class Item_func_spatial_rel: public Item_bool_func2 +class Item_func_spatial_rel: public Item_int_func { enum Functype spatial_rel; Gcalc_heap collector; Gcalc_scan_iterator scan_it; Gcalc_function func; - String tmp_value1,tmp_value2; + String tmp_value1,tmp_value2, tmp_matrix; public: Item_func_spatial_rel(Item *a,Item *b, enum Functype sp_rel); + Item_func_spatial_rel(Item *a, Item *b, Item *matrix); virtual ~Item_func_spatial_rel(); longlong val_int(); enum Functype functype() const @@ -253,6 +319,9 @@ public: void fix_length_and_dec() { maybe_null= 1; } bool is_null() { (void) val_int(); return null_value; } + bool is_bool_func() { return 1; } + uint decimal_precision() const { return 1; } + optimize_type select_optimize() const { return OPTIMIZE_OP; } }; @@ -369,6 +438,14 @@ public: void fix_length_and_dec() { maybe_null= 1; } }; +class Item_func_isring: public Item_func_issimple +{ +public: + Item_func_isring(Item *a): Item_func_issimple(a) {} + longlong val_int(); + const char *func_name() const { return "st_isring"; } +}; + class Item_func_dimension: public Item_int_func { String value; @@ -497,6 +574,20 @@ public: }; +class Item_func_pointonsurface: public Item_geometry_func +{ + String tmp_value; + Gcalc_heap collector; + Gcalc_function func; + Gcalc_scan_iterator scan_it; +public: + Item_func_pointonsurface(Item *a): Item_geometry_func(a) {} + const char *func_name() const { return "st_pointonsurface"; } + String *val_str(String *); + Field::geometry_type get_geometry_type() const; +}; + + #ifndef DBUG_OFF class Item_func_gis_debug: public Item_int_func { diff --git a/sql/log.cc b/sql/log.cc index ff04105b43d..24e52838e47 100644 --- a/sql/log.cc +++ b/sql/log.cc @@ -837,7 +837,7 @@ bool Log_to_csv_event_handler:: restore_record(table, s->default_values); // Get empty record /* check that all columns exist */ - if (table->s->fields < 11) + if (table->s->fields < 13) goto err; /* store the time and user values */ @@ -918,6 +918,12 @@ bool Log_to_csv_event_handler:: if (table->field[11]->store((longlong) thd->thread_id, TRUE)) goto err; + /* Rows_affected */ + if (table->field[12]->store(thd->get_stmt_da()->is_ok() ? + (longlong) thd->get_stmt_da()->affected_rows() : + 0, TRUE)) + goto err; + /* log table entries are not replicated */ if (table->file->ha_write_row(table->record[0])) goto err; @@ -2918,12 +2924,16 @@ bool MYSQL_QUERY_LOG::write(THD *thd, time_t current_time, sprintf(lock_time_buff, "%.6f", ulonglong2double(lock_utime)/1000000.0); if (my_b_printf(&log_file, "# Thread_id: %lu Schema: %s QC_hit: %s\n" \ - "# Query_time: %s Lock_time: %s Rows_sent: %lu Rows_examined: %lu\n", + "# Query_time: %s Lock_time: %s Rows_sent: %lu Rows_examined: %lu\n" \ + "# Rows_affected: %lu\n", (ulong) thd->thread_id, (thd->db ? thd->db : ""), ((thd->query_plan_flags & QPLAN_QC) ? "Yes" : "No"), query_time_buff, lock_time_buff, (ulong) thd->get_sent_row_count(), - (ulong) thd->get_examined_row_count()) == (size_t) -1) + (ulong) thd->get_examined_row_count(), + thd->get_stmt_da()->is_ok() ? + (ulong) thd->get_stmt_da()->affected_rows() : + 0) == (size_t) -1) tmp_errno= errno; if ((thd->variables.log_slow_verbosity & LOG_SLOW_VERBOSITY_QUERY_PLAN) && (thd->query_plan_flags & diff --git a/sql/mdl.cc b/sql/mdl.cc index 42f12a47afd..09c26cf4c34 100644 --- a/sql/mdl.cc +++ b/sql/mdl.cc @@ -2388,7 +2388,7 @@ void MDL_scoped_lock::notify_conflicting_locks(MDL_context *ctx) */ bool -MDL_context::acquire_lock(MDL_request *mdl_request, ulong lock_wait_timeout) +MDL_context::acquire_lock(MDL_request *mdl_request, double lock_wait_timeout) { MDL_lock *lock; MDL_ticket *ticket; @@ -2550,7 +2550,7 @@ extern "C" int mdl_request_ptr_cmp(const void* ptr1, const void* ptr2) */ bool MDL_context::acquire_locks(MDL_request_list *mdl_requests, - ulong lock_wait_timeout) + double lock_wait_timeout) { MDL_request_list::Iterator it(*mdl_requests); MDL_request **sort_buf, **p_req; @@ -2623,13 +2623,13 @@ err: bool MDL_context::upgrade_shared_lock(MDL_ticket *mdl_ticket, enum_mdl_type new_type, - ulong lock_wait_timeout) + double lock_wait_timeout) { MDL_request mdl_xlock_request; MDL_savepoint mdl_svp= mdl_savepoint(); bool is_new_ticket; DBUG_ENTER("MDL_context::upgrade_shared_lock"); - DBUG_PRINT("enter",("new_type: %d lock_wait_timeout: %lu", new_type, + DBUG_PRINT("enter",("new_type: %d lock_wait_timeout: %f", new_type, lock_wait_timeout)); DEBUG_SYNC(get_thd(), "mdl_upgrade_lock"); diff --git a/sql/mdl.h b/sql/mdl.h index 27289e621ef..44e692b97a0 100644 --- a/sql/mdl.h +++ b/sql/mdl.h @@ -752,11 +752,11 @@ public: void destroy(); bool try_acquire_lock(MDL_request *mdl_request); - bool acquire_lock(MDL_request *mdl_request, ulong lock_wait_timeout); - bool acquire_locks(MDL_request_list *requests, ulong lock_wait_timeout); + bool acquire_lock(MDL_request *mdl_request, double lock_wait_timeout); + bool acquire_locks(MDL_request_list *requests, double lock_wait_timeout); bool upgrade_shared_lock(MDL_ticket *mdl_ticket, enum_mdl_type new_type, - ulong lock_wait_timeout); + double lock_wait_timeout); bool clone_ticket(MDL_request *mdl_request); diff --git a/sql/mysqld.cc b/sql/mysqld.cc index f15fa1769c6..4aa5bf74123 100644 --- a/sql/mysqld.cc +++ b/sql/mysqld.cc @@ -5620,10 +5620,14 @@ int mysqld_main(int argc, char **argv) } #endif - if (WSREP_ON && wsrep_recovery) + // Recover and exit. + if (wsrep_recovery) { select_thread_in_use= 0; - wsrep_recover(); + if (WSREP_ON) + wsrep_recover(); + else + sql_print_information("WSREP: disabled, skipping position recovery"); unireg_abort(0); } diff --git a/sql/sp_head.cc b/sql/sp_head.cc index 296135c93e7..0ef336a4436 100644 --- a/sql/sp_head.cc +++ b/sql/sp_head.cc @@ -1131,31 +1131,8 @@ sp_head::execute(THD *thd, bool merge_da_on_success) Diagnostics_area *da= thd->get_stmt_da(); Warning_info sp_wi(da->warning_info_id(), false, true); - /* - Just reporting a stack overrun error - (@sa check_stack_overrun()) requires stack memory for error - message buffer. Thus, we have to put the below check - relatively close to the beginning of the execution stack, - where available stack margin is still big. As long as the check - has to be fairly high up the call stack, the amount of memory - we "book" for has to stay fairly high as well, and hence - not very accurate. The number below has been calculated - by trial and error, and reflects the amount of memory necessary - to execute a single stored procedure instruction, be it either - an SQL statement, or, heaviest of all, a CALL, which involves - parsing and loading of another stored procedure into the cache - (@sa db_load_routine() and Bug#10100). - At the time of measuring, a recursive SP invocation required - 3232 bytes of stack on 32 bit Linux, 6016 bytes on 64 bit Mac - and 11152 on 64 bit Solaris sparc. - The same with db_load_routine() required circa 7k bytes and - 14k bytes accordingly. Hence, here we book the stack with some - reasonable margin. - - Reverting back to 8 * STACK_MIN_SIZE until further fix. - 8 * STACK_MIN_SIZE is required on some exotic platforms. - */ - if (check_stack_overrun(thd, 8 * STACK_MIN_SIZE, (uchar*)&old_packet)) + /* this 7*STACK_MIN_SIZE is a complex matter with a long history (see it!) */ + if (check_stack_overrun(thd, 7 * STACK_MIN_SIZE, (uchar*)&old_packet)) DBUG_RETURN(TRUE); /* init per-instruction memroot */ diff --git a/sql/spatial.cc b/sql/spatial.cc index 34d2417f632..9f672801c9f 100644 --- a/sql/spatial.cc +++ b/sql/spatial.cc @@ -291,19 +291,18 @@ Geometry *Geometry::create_from_wkb(Geometry_buffer *buffer, } -int Geometry::create_from_opresult(Geometry_buffer *g_buf, +Geometry *Geometry::create_from_opresult(Geometry_buffer *g_buf, String *res, Gcalc_result_receiver &rr) { uint32 geom_type= rr.get_result_typeid(); Geometry *obj= create_by_typeid(g_buf, geom_type); if (!obj || res->reserve(WKB_HEADER_SIZE, 512)) - return 1; + return NULL; res->q_append((char) wkb_ndr); res->q_append(geom_type); - return obj->init_from_opresult(res, rr.result(), rr.length()) == 0 && - rr.length(); + return obj->init_from_opresult(res, rr.result(), rr.length()) ? obj : NULL; } @@ -386,7 +385,7 @@ bool Geometry::create_point(String *result, const char *data) const 1 Can't reallocate 'result' */ -bool Geometry::create_point(String *result, double x, double y) const +bool Geometry::create_point(String *result, double x, double y) { if (result->reserve(1 + 4 + POINT_DATA_SIZE)) return 1; @@ -2221,6 +2220,13 @@ uint Gis_geometry_collection::init_from_opresult(String *bin, return 0; bin->q_append(n_objects); + if (res_len == 0) + { + /* Special case of GEOMETRYCOLLECTION EMPTY. */ + opres+= 1; + goto empty_geom; + } + while (res_len) { switch ((Gcalc_function::shape_type) uint4korr(opres)) @@ -2244,6 +2250,7 @@ uint Gis_geometry_collection::init_from_opresult(String *bin, res_len-= g_len; n_objects++; } +empty_geom: bin->write_at_position(no_pos, n_objects); return (uint) (opres - opres_orig); } diff --git a/sql/spatial.h b/sql/spatial.h index 3a6055add06..b850d405228 100644 --- a/sql/spatial.h +++ b/sql/spatial.h @@ -298,7 +298,7 @@ public: bool init_stream=1); static Geometry *create_from_wkb(Geometry_buffer *buffer, const char *wkb, uint32 len, String *res); - static int create_from_opresult(Geometry_buffer *g_buf, + static Geometry *create_from_opresult(Geometry_buffer *g_buf, String *res, Gcalc_result_receiver &rr); int as_wkt(String *wkt, const char **end); @@ -316,6 +316,7 @@ public: bool envelope(String *result) const; static Class_info *ci_collection[wkb_last+1]; + static bool create_point(String *result, double x, double y); protected: static Class_info *find_class(int type_id) { @@ -326,7 +327,6 @@ protected: const char *append_points(String *txt, uint32 n_points, const char *data, uint32 offset) const; bool create_point(String *result, const char *data) const; - bool create_point(String *result, double x, double y) const; const char *get_mbr_for_points(MBR *mbr, const char *data, uint offset) const; diff --git a/sql/sql_parse.cc b/sql/sql_parse.cc index b1f2553d785..09f066bc569 100644 --- a/sql/sql_parse.cc +++ b/sql/sql_parse.cc @@ -7767,6 +7767,9 @@ bool st_select_lex_unit::add_fake_select_lex(THD *thd_arg) fake_select_lex->context.resolve_in_select_list= TRUE; fake_select_lex->context.select_lex= fake_select_lex; + fake_select_lex->nest_level_base= first_select()->nest_level_base; + fake_select_lex->nest_level=first_select()->nest_level; + if (!is_union()) { /*