Commit c4cd361f authored by Tatiana A. Nurnberg's avatar Tatiana A. Nurnberg

manual merge for 40657 beautification

parents e58840fc 2ca84a4c
...@@ -736,6 +736,17 @@ select replace(@full_mode, 'ALLOW_INVALID_DATES', 'INVALID_DATES') into @full_mo ...@@ -736,6 +736,17 @@ select replace(@full_mode, 'ALLOW_INVALID_DATES', 'INVALID_DATES') into @full_mo
select name from mysql.event where name = 'p' and sql_mode = @full_mode; select name from mysql.event where name = 'p' and sql_mode = @full_mode;
name name
drop event e1; drop event e1;
SET @old_server_id = @@GLOBAL.server_id;
SET GLOBAL server_id = (1 << 32) - 1;
SELECT @@GLOBAL.server_id;
@@GLOBAL.server_id
4294967295
CREATE EVENT ev1 ON SCHEDULE EVERY 1 DAY DO SELECT 1;
SELECT event_name, originator FROM INFORMATION_SCHEMA.EVENTS;
event_name originator
ev1 4294967295
DROP EVENT ev1;
SET GLOBAL server_id = @old_server_id;
DROP DATABASE events_test; DROP DATABASE events_test;
SET GLOBAL event_scheduler= 'ON'; SET GLOBAL event_scheduler= 'ON';
SET @@global.concurrent_insert= @concurrent_insert; SET @@global.concurrent_insert= @concurrent_insert;
...@@ -579,3 +579,291 @@ c1 ...@@ -579,3 +579,291 @@ c1
18446744073709551610 18446744073709551610
18446744073709551615 18446744073709551615
DROP TABLE t1; DROP TABLE t1;
SET @@SESSION.AUTO_INCREMENT_INCREMENT=1, @@SESSION.AUTO_INCREMENT_OFFSET=1;
SET @@INSERT_ID=1;
SHOW VARIABLES LIKE "%auto_inc%";
Variable_name Value
auto_increment_increment 1
auto_increment_offset 1
CREATE TABLE t1 (c1 DOUBLE NOT NULL AUTO_INCREMENT, c2 INT, PRIMARY KEY (c1)) ENGINE=InnoDB;
INSERT INTO t1 VALUES(NULL, 1);
INSERT INTO t1 VALUES(NULL, 2);
SELECT * FROM t1;
c1 c2
1 1
2 2
ALTER TABLE t1 CHANGE c1 c1 SERIAL;
SELECT * FROM t1;
c1 c2
1 1
2 2
INSERT INTO t1 VALUES(NULL, 3);
INSERT INTO t1 VALUES(NULL, 4);
SELECT * FROM t1;
c1 c2
1 1
2 2
3 3
4 4
DROP TABLE IF EXISTS t1;
CREATE TABLE t1 (c1 FLOAT NOT NULL AUTO_INCREMENT, c2 INT, PRIMARY KEY (c1)) ENGINE=InnoDB;
INSERT INTO t1 VALUES(NULL, 1);
INSERT INTO t1 VALUES(NULL, 2);
SELECT * FROM t1;
c1 c2
1 1
2 2
ALTER TABLE t1 CHANGE c1 c1 SERIAL;
SELECT * FROM t1;
c1 c2
1 1
2 2
INSERT INTO t1 VALUES(NULL, 3);
INSERT INTO t1 VALUES(NULL, 4);
SELECT * FROM t1;
c1 c2
1 1
2 2
3 3
4 4
DROP TABLE t1;
SET @@SESSION.AUTO_INCREMENT_INCREMENT=1, @@SESSION.AUTO_INCREMENT_OFFSET=5;
DROP TABLE IF EXISTS t1;
Warnings:
Note 1051 Unknown table 't1'
DROP TABLE IF EXISTS t2;
Warnings:
Note 1051 Unknown table 't2'
CREATE TABLE t1 (
a INT(11) UNSIGNED NOT NULL AUTO_INCREMENT,
b INT(10) UNSIGNED NOT NULL,
c ENUM('FALSE','TRUE') DEFAULT NULL,
PRIMARY KEY (a)) ENGINE = InnoDB;
CREATE TABLE t2 (
m INT(11) UNSIGNED NOT NULL AUTO_INCREMENT,
n INT(10) UNSIGNED NOT NULL,
o enum('FALSE','TRUE') DEFAULT NULL,
PRIMARY KEY (m)) ENGINE = InnoDB;
INSERT INTO t2 (n,o) VALUES
(1 , 'true'), (1 , 'false'), (2 , 'true'), (2 , 'false'), (3 , 'true'),
(3 , 'false'), (4 , 'true'), (4 , 'false'), (5 , 'true'), (5 , 'false');
SHOW CREATE TABLE t2;
Table Create Table
t2 CREATE TABLE `t2` (
`m` int(11) unsigned NOT NULL AUTO_INCREMENT,
`n` int(10) unsigned NOT NULL,
`o` enum('FALSE','TRUE') DEFAULT NULL,
PRIMARY KEY (`m`)
) ENGINE=InnoDB AUTO_INCREMENT=15 DEFAULT CHARSET=latin1
INSERT INTO t1 (b,c) SELECT n,o FROM t2 ;
SHOW CREATE TABLE t1;
Table Create Table
t1 CREATE TABLE `t1` (
`a` int(11) unsigned NOT NULL AUTO_INCREMENT,
`b` int(10) unsigned NOT NULL,
`c` enum('FALSE','TRUE') DEFAULT NULL,
PRIMARY KEY (`a`)
) ENGINE=InnoDB AUTO_INCREMENT=13 DEFAULT CHARSET=latin1
INSERT INTO t1 (b,c) SELECT n,o FROM t2 ;
SELECT * FROM t1;
a b c
1 1 TRUE
2 1 FALSE
3 2 TRUE
4 2 FALSE
5 3 TRUE
6 3 FALSE
7 4 TRUE
8 4 FALSE
9 5 TRUE
10 5 FALSE
13 1 TRUE
14 1 FALSE
15 2 TRUE
16 2 FALSE
17 3 TRUE
18 3 FALSE
19 4 TRUE
20 4 FALSE
21 5 TRUE
22 5 FALSE
SHOW CREATE TABLE t1;
Table Create Table
t1 CREATE TABLE `t1` (
`a` int(11) unsigned NOT NULL AUTO_INCREMENT,
`b` int(10) unsigned NOT NULL,
`c` enum('FALSE','TRUE') DEFAULT NULL,
PRIMARY KEY (`a`)
) ENGINE=InnoDB AUTO_INCREMENT=23 DEFAULT CHARSET=latin1
INSERT INTO t1 (b,c) SELECT n,o FROM t2 WHERE o = 'false';
SELECT * FROM t1;
a b c
1 1 TRUE
2 1 FALSE
3 2 TRUE
4 2 FALSE
5 3 TRUE
6 3 FALSE
7 4 TRUE
8 4 FALSE
9 5 TRUE
10 5 FALSE
13 1 TRUE
14 1 FALSE
15 2 TRUE
16 2 FALSE
17 3 TRUE
18 3 FALSE
19 4 TRUE
20 4 FALSE
21 5 TRUE
22 5 FALSE
23 1 FALSE
24 2 FALSE
25 3 FALSE
26 4 FALSE
27 5 FALSE
SHOW CREATE TABLE t1;
Table Create Table
t1 CREATE TABLE `t1` (
`a` int(11) unsigned NOT NULL AUTO_INCREMENT,
`b` int(10) unsigned NOT NULL,
`c` enum('FALSE','TRUE') DEFAULT NULL,
PRIMARY KEY (`a`)
) ENGINE=InnoDB AUTO_INCREMENT=30 DEFAULT CHARSET=latin1
INSERT INTO t1 (b,c) SELECT n,o FROM t2 WHERE o = 'false';
SELECT * FROM t1;
a b c
1 1 TRUE
2 1 FALSE
3 2 TRUE
4 2 FALSE
5 3 TRUE
6 3 FALSE
7 4 TRUE
8 4 FALSE
9 5 TRUE
10 5 FALSE
13 1 TRUE
14 1 FALSE
15 2 TRUE
16 2 FALSE
17 3 TRUE
18 3 FALSE
19 4 TRUE
20 4 FALSE
21 5 TRUE
22 5 FALSE
23 1 FALSE
24 2 FALSE
25 3 FALSE
26 4 FALSE
27 5 FALSE
30 1 FALSE
31 2 FALSE
32 3 FALSE
33 4 FALSE
34 5 FALSE
SHOW CREATE TABLE t1;
Table Create Table
t1 CREATE TABLE `t1` (
`a` int(11) unsigned NOT NULL AUTO_INCREMENT,
`b` int(10) unsigned NOT NULL,
`c` enum('FALSE','TRUE') DEFAULT NULL,
PRIMARY KEY (`a`)
) ENGINE=InnoDB AUTO_INCREMENT=37 DEFAULT CHARSET=latin1
INSERT INTO t1 (b,c) SELECT n,o FROM t2 WHERE o = 'false';
SHOW CREATE TABLE t1;
Table Create Table
t1 CREATE TABLE `t1` (
`a` int(11) unsigned NOT NULL AUTO_INCREMENT,
`b` int(10) unsigned NOT NULL,
`c` enum('FALSE','TRUE') DEFAULT NULL,
PRIMARY KEY (`a`)
) ENGINE=InnoDB AUTO_INCREMENT=44 DEFAULT CHARSET=latin1
INSERT INTO t1 (b,c) SELECT n,o FROM t2 WHERE o = 'false';
SHOW CREATE TABLE t1;
Table Create Table
t1 CREATE TABLE `t1` (
`a` int(11) unsigned NOT NULL AUTO_INCREMENT,
`b` int(10) unsigned NOT NULL,
`c` enum('FALSE','TRUE') DEFAULT NULL,
PRIMARY KEY (`a`)
) ENGINE=InnoDB AUTO_INCREMENT=51 DEFAULT CHARSET=latin1
INSERT INTO t1 (b,c) SELECT n,o FROM t2 WHERE o = 'false';
SELECT * FROM t1;
a b c
1 1 TRUE
2 1 FALSE
3 2 TRUE
4 2 FALSE
5 3 TRUE
6 3 FALSE
7 4 TRUE
8 4 FALSE
9 5 TRUE
10 5 FALSE
13 1 TRUE
14 1 FALSE
15 2 TRUE
16 2 FALSE
17 3 TRUE
18 3 FALSE
19 4 TRUE
20 4 FALSE
21 5 TRUE
22 5 FALSE
23 1 FALSE
24 2 FALSE
25 3 FALSE
26 4 FALSE
27 5 FALSE
30 1 FALSE
31 2 FALSE
32 3 FALSE
33 4 FALSE
34 5 FALSE
37 1 FALSE
38 2 FALSE
39 3 FALSE
40 4 FALSE
41 5 FALSE
44 1 FALSE
45 2 FALSE
46 3 FALSE
47 4 FALSE
48 5 FALSE
51 1 FALSE
52 2 FALSE
53 3 FALSE
54 4 FALSE
55 5 FALSE
SHOW CREATE TABLE t1;
Table Create Table
t1 CREATE TABLE `t1` (
`a` int(11) unsigned NOT NULL AUTO_INCREMENT,
`b` int(10) unsigned NOT NULL,
`c` enum('FALSE','TRUE') DEFAULT NULL,
PRIMARY KEY (`a`)
) ENGINE=InnoDB AUTO_INCREMENT=58 DEFAULT CHARSET=latin1
DROP TABLE t1;
DROP TABLE t2;
DROP TABLE IF EXISTS t1;
Warnings:
Note 1051 Unknown table 't1'
DROP TABLE IF EXISTS t2;
Warnings:
Note 1051 Unknown table 't2'
CREATE TABLE t1(
c1 INT(10) UNSIGNED NOT NULL AUTO_INCREMENT
PRIMARY KEY) ENGINE=InnoDB;
INSERT INTO t1 VALUES (NULL),(NULL),(NULL),(NULL),(NULL),(NULL),(NULL),(NULL),(NULL),(NULL),(NULL),(NULL),(NULL),(NULL),(NULL),(NULL),(NULL),(NULL),(NULL),(NULL),(NULL),(NULL),(NULL),(NULL),(NULL),(NULL),(NULL),(NULL),(NULL),(NULL),(NULL),(NULL),(NULL),(NULL),(NULL),(NULL),(NULL),(NULL),(NULL),(NULL),(NULL),(NULL),(NULL),(NULL),(NULL),(NULL),(NULL),(NULL),(NULL),(NULL),(NULL),(NULL),(NULL),(NULL),(NULL),(NULL),(NULL),(NULL),(NULL),(NULL),(NULL),(NULL),(NULL),(NULL),(NULL),(NULL),(NULL),(NULL),(NULL),(NULL),(NULL),(NULL),(NULL),(NULL),(NULL),(NULL),(NULL),(NULL),(NULL),(NULL),(NULL),(NULL),(NULL),(NULL),(NULL),(NULL),(NULL),(NULL),(NULL),(NULL),(NULL),(NULL),(NULL),(NULL),(NULL),(NULL),(NULL),(NULL),(NULL),(NULL),(NULL),(NULL),(NULL),(NULL),(NULL),(NULL),(NULL),(NULL),(NULL),(NULL),(NULL),(NULL),(NULL),(NULL),(NULL),(NULL),(NULL),(NULL),(NULL),(NULL),(NULL),(NULL),(NULL),(NULL),(NULL),(NULL),(NULL),(NULL),(NULL),(NULL),(NULL),(NULL),(NULL),(NULL),(NULL),(NULL),(NULL),(NULL),(NULL),(NULL),(NULL),(NULL),(NULL),(NULL),(NULL),(NULL),(NULL),(NULL),(NULL),(NULL),(NULL),(NULL),(NULL),(NULL),(NULL),(NULL),(NULL),(NULL),(NULL),(NULL),(NULL),(NULL),(NULL),(NULL),(NULL),(NULL),(NULL),(NULL),(NULL),(NULL),(NULL),(NULL),(NULL),(NULL),(NULL),(NULL),(NULL),(NULL),(NULL),(NULL),(NULL),(NULL),(NULL),(NULL),(NULL),(NULL),(NULL),(NULL),(NULL),(NULL),(NULL),(NULL),(NULL),(NULL),(NULL),(NULL),(NULL),(NULL),(NULL),(NULL),(NULL),(NULL),(NULL),(NULL),(NULL),(NULL),(NULL),(NULL),(NULL),(NULL),(NULL),(NULL),(NULL),(NULL),(NULL),(NULL),(NULL),(NULL),(NULL),(NULL),(NULL),(NULL),(NULL),(NULL),(NULL),(NULL),(NULL),(NULL),(NULL),(NULL),(NULL),(NULL),(NULL),(NULL),(NULL),(NULL),(NULL),(NULL),(NULL),(NULL),(NULL),(NULL),(NULL),(NULL),(NULL),(NULL),(NULL),(NULL),(NULL),(NULL),(NULL),(NULL),(NULL),(NULL),(NULL),(NULL);
CREATE TABLE t2(
c1 TINYINT(3) UNSIGNED NOT NULL AUTO_INCREMENT
PRIMARY KEY) ENGINE=InnoDB;
INSERT INTO t2 SELECT c1 FROM t1;
Got one of the listed errors
INSERT INTO t2 SELECT NULL FROM t1;
Got one of the listed errors
DROP TABLE t1;
DROP TABLE t2;
...@@ -56,7 +56,7 @@ general_log CREATE TABLE `general_log` ( ...@@ -56,7 +56,7 @@ general_log CREATE TABLE `general_log` (
`event_time` timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP, `event_time` timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP,
`user_host` mediumtext NOT NULL, `user_host` mediumtext NOT NULL,
`thread_id` int(11) NOT NULL, `thread_id` int(11) NOT NULL,
`server_id` int(11) NOT NULL, `server_id` int(10) unsigned NOT NULL,
`command_type` varchar(64) NOT NULL, `command_type` varchar(64) NOT NULL,
`argument` mediumtext NOT NULL `argument` mediumtext NOT NULL
) ENGINE=CSV DEFAULT CHARSET=utf8 COMMENT='General log' ) ENGINE=CSV DEFAULT CHARSET=utf8 COMMENT='General log'
...@@ -65,7 +65,7 @@ Field Type Null Key Default Extra ...@@ -65,7 +65,7 @@ Field Type Null Key Default Extra
event_time timestamp NO CURRENT_TIMESTAMP on update CURRENT_TIMESTAMP event_time timestamp NO CURRENT_TIMESTAMP on update CURRENT_TIMESTAMP
user_host mediumtext NO NULL user_host mediumtext NO NULL
thread_id int(11) NO NULL thread_id int(11) NO NULL
server_id int(11) NO NULL server_id int(10) unsigned NO NULL
command_type varchar(64) NO NULL command_type varchar(64) NO NULL
argument mediumtext NO NULL argument mediumtext NO NULL
show create table mysql.slow_log; show create table mysql.slow_log;
...@@ -80,7 +80,7 @@ slow_log CREATE TABLE `slow_log` ( ...@@ -80,7 +80,7 @@ slow_log CREATE TABLE `slow_log` (
`db` varchar(512) NOT NULL, `db` varchar(512) NOT NULL,
`last_insert_id` int(11) NOT NULL, `last_insert_id` int(11) NOT NULL,
`insert_id` int(11) NOT NULL, `insert_id` int(11) NOT NULL,
`server_id` int(11) NOT NULL, `server_id` int(10) unsigned NOT NULL,
`sql_text` mediumtext NOT NULL `sql_text` mediumtext NOT NULL
) ENGINE=CSV DEFAULT CHARSET=utf8 COMMENT='Slow log' ) ENGINE=CSV DEFAULT CHARSET=utf8 COMMENT='Slow log'
show fields from mysql.slow_log; show fields from mysql.slow_log;
...@@ -94,7 +94,7 @@ rows_examined int(11) NO NULL ...@@ -94,7 +94,7 @@ rows_examined int(11) NO NULL
db varchar(512) NO NULL db varchar(512) NO NULL
last_insert_id int(11) NO NULL last_insert_id int(11) NO NULL
insert_id int(11) NO NULL insert_id int(11) NO NULL
server_id int(11) NO NULL server_id int(10) unsigned NO NULL
sql_text mediumtext NO NULL sql_text mediumtext NO NULL
flush logs; flush logs;
flush tables; flush tables;
...@@ -167,7 +167,7 @@ general_log CREATE TABLE `general_log` ( ...@@ -167,7 +167,7 @@ general_log CREATE TABLE `general_log` (
`event_time` timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP, `event_time` timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP,
`user_host` mediumtext NOT NULL, `user_host` mediumtext NOT NULL,
`thread_id` int(11) NOT NULL, `thread_id` int(11) NOT NULL,
`server_id` int(11) NOT NULL, `server_id` int(10) unsigned NOT NULL,
`command_type` varchar(64) NOT NULL, `command_type` varchar(64) NOT NULL,
`argument` mediumtext NOT NULL `argument` mediumtext NOT NULL
) ENGINE=CSV DEFAULT CHARSET=utf8 COMMENT='General log' ) ENGINE=CSV DEFAULT CHARSET=utf8 COMMENT='General log'
...@@ -183,7 +183,7 @@ slow_log CREATE TABLE `slow_log` ( ...@@ -183,7 +183,7 @@ slow_log CREATE TABLE `slow_log` (
`db` varchar(512) NOT NULL, `db` varchar(512) NOT NULL,
`last_insert_id` int(11) NOT NULL, `last_insert_id` int(11) NOT NULL,
`insert_id` int(11) NOT NULL, `insert_id` int(11) NOT NULL,
`server_id` int(11) NOT NULL, `server_id` int(10) unsigned NOT NULL,
`sql_text` mediumtext NOT NULL `sql_text` mediumtext NOT NULL
) ENGINE=CSV DEFAULT CHARSET=utf8 COMMENT='Slow log' ) ENGINE=CSV DEFAULT CHARSET=utf8 COMMENT='Slow log'
alter table mysql.general_log engine=myisam; alter table mysql.general_log engine=myisam;
...@@ -194,7 +194,7 @@ general_log CREATE TABLE `general_log` ( ...@@ -194,7 +194,7 @@ general_log CREATE TABLE `general_log` (
`event_time` timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP, `event_time` timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP,
`user_host` mediumtext NOT NULL, `user_host` mediumtext NOT NULL,
`thread_id` int(11) NOT NULL, `thread_id` int(11) NOT NULL,
`server_id` int(11) NOT NULL, `server_id` int(10) unsigned NOT NULL,
`command_type` varchar(64) NOT NULL, `command_type` varchar(64) NOT NULL,
`argument` mediumtext NOT NULL `argument` mediumtext NOT NULL
) ENGINE=MyISAM DEFAULT CHARSET=utf8 COMMENT='General log' ) ENGINE=MyISAM DEFAULT CHARSET=utf8 COMMENT='General log'
...@@ -210,7 +210,7 @@ slow_log CREATE TABLE `slow_log` ( ...@@ -210,7 +210,7 @@ slow_log CREATE TABLE `slow_log` (
`db` varchar(512) NOT NULL, `db` varchar(512) NOT NULL,
`last_insert_id` int(11) NOT NULL, `last_insert_id` int(11) NOT NULL,
`insert_id` int(11) NOT NULL, `insert_id` int(11) NOT NULL,
`server_id` int(11) NOT NULL, `server_id` int(10) unsigned NOT NULL,
`sql_text` mediumtext NOT NULL `sql_text` mediumtext NOT NULL
) ENGINE=MyISAM DEFAULT CHARSET=utf8 COMMENT='Slow log' ) ENGINE=MyISAM DEFAULT CHARSET=utf8 COMMENT='Slow log'
set global general_log='ON'; set global general_log='ON';
...@@ -268,7 +268,7 @@ CREATE TABLE `general_log` ( ...@@ -268,7 +268,7 @@ CREATE TABLE `general_log` (
ON UPDATE CURRENT_TIMESTAMP, ON UPDATE CURRENT_TIMESTAMP,
`user_host` mediumtext NOT NULL, `user_host` mediumtext NOT NULL,
`thread_id` int(11) NOT NULL, `thread_id` int(11) NOT NULL,
`server_id` int(11) NOT NULL, `server_id` int(10) unsigned NOT NULL,
`command_type` varchar(64) NOT NULL, `command_type` varchar(64) NOT NULL,
`argument` mediumtext NOT NULL `argument` mediumtext NOT NULL
) ENGINE=CSV DEFAULT CHARSET=utf8 COMMENT='General log'; ) ENGINE=CSV DEFAULT CHARSET=utf8 COMMENT='General log';
...@@ -283,7 +283,7 @@ ON UPDATE CURRENT_TIMESTAMP, ...@@ -283,7 +283,7 @@ ON UPDATE CURRENT_TIMESTAMP,
`db` varchar(512) NOT NULL, `db` varchar(512) NOT NULL,
`last_insert_id` int(11) NOT NULL, `last_insert_id` int(11) NOT NULL,
`insert_id` int(11) NOT NULL, `insert_id` int(11) NOT NULL,
`server_id` int(11) NOT NULL, `server_id` int(10) unsigned NOT NULL,
`sql_text` mediumtext NOT NULL `sql_text` mediumtext NOT NULL
) ENGINE=CSV DEFAULT CHARSET=utf8 COMMENT='Slow log'; ) ENGINE=CSV DEFAULT CHARSET=utf8 COMMENT='Slow log';
set global general_log='ON'; set global general_log='ON';
......
...@@ -227,7 +227,7 @@ event CREATE TABLE `event` ( ...@@ -227,7 +227,7 @@ event CREATE TABLE `event` (
`on_completion` enum('DROP','PRESERVE') NOT NULL DEFAULT 'DROP', `on_completion` enum('DROP','PRESERVE') NOT NULL DEFAULT 'DROP',
`sql_mode` set('REAL_AS_FLOAT','PIPES_AS_CONCAT','ANSI_QUOTES','IGNORE_SPACE','NOT_USED','ONLY_FULL_GROUP_BY','NO_UNSIGNED_SUBTRACTION','NO_DIR_IN_CREATE','POSTGRESQL','ORACLE','MSSQL','DB2','MAXDB','NO_KEY_OPTIONS','NO_TABLE_OPTIONS','NO_FIELD_OPTIONS','MYSQL323','MYSQL40','ANSI','NO_AUTO_VALUE_ON_ZERO','NO_BACKSLASH_ESCAPES','STRICT_TRANS_TABLES','STRICT_ALL_TABLES','NO_ZERO_IN_DATE','NO_ZERO_DATE','INVALID_DATES','ERROR_FOR_DIVISION_BY_ZERO','TRADITIONAL','NO_AUTO_CREATE_USER','HIGH_NOT_PRECEDENCE','NO_ENGINE_SUBSTITUTION','PAD_CHAR_TO_FULL_LENGTH') NOT NULL DEFAULT '', `sql_mode` set('REAL_AS_FLOAT','PIPES_AS_CONCAT','ANSI_QUOTES','IGNORE_SPACE','NOT_USED','ONLY_FULL_GROUP_BY','NO_UNSIGNED_SUBTRACTION','NO_DIR_IN_CREATE','POSTGRESQL','ORACLE','MSSQL','DB2','MAXDB','NO_KEY_OPTIONS','NO_TABLE_OPTIONS','NO_FIELD_OPTIONS','MYSQL323','MYSQL40','ANSI','NO_AUTO_VALUE_ON_ZERO','NO_BACKSLASH_ESCAPES','STRICT_TRANS_TABLES','STRICT_ALL_TABLES','NO_ZERO_IN_DATE','NO_ZERO_DATE','INVALID_DATES','ERROR_FOR_DIVISION_BY_ZERO','TRADITIONAL','NO_AUTO_CREATE_USER','HIGH_NOT_PRECEDENCE','NO_ENGINE_SUBSTITUTION','PAD_CHAR_TO_FULL_LENGTH') NOT NULL DEFAULT '',
`comment` char(64) CHARACTER SET utf8 COLLATE utf8_bin NOT NULL DEFAULT '', `comment` char(64) CHARACTER SET utf8 COLLATE utf8_bin NOT NULL DEFAULT '',
`originator` int(10) NOT NULL, `originator` int(10) unsigned NOT NULL,
`time_zone` char(64) CHARACTER SET latin1 NOT NULL DEFAULT 'SYSTEM', `time_zone` char(64) CHARACTER SET latin1 NOT NULL DEFAULT 'SYSTEM',
`character_set_client` char(32) CHARACTER SET utf8 COLLATE utf8_bin DEFAULT 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, `collation_connection` char(32) CHARACTER SET utf8 COLLATE utf8_bin DEFAULT NULL,
...@@ -241,7 +241,7 @@ general_log CREATE TABLE `general_log` ( ...@@ -241,7 +241,7 @@ general_log CREATE TABLE `general_log` (
`event_time` timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP, `event_time` timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP,
`user_host` mediumtext NOT NULL, `user_host` mediumtext NOT NULL,
`thread_id` int(11) NOT NULL, `thread_id` int(11) NOT NULL,
`server_id` int(11) NOT NULL, `server_id` int(10) unsigned NOT NULL,
`command_type` varchar(64) NOT NULL, `command_type` varchar(64) NOT NULL,
`argument` mediumtext NOT NULL `argument` mediumtext NOT NULL
) ENGINE=CSV DEFAULT CHARSET=utf8 COMMENT='General log' ) ENGINE=CSV DEFAULT CHARSET=utf8 COMMENT='General log'
...@@ -257,7 +257,7 @@ slow_log CREATE TABLE `slow_log` ( ...@@ -257,7 +257,7 @@ slow_log CREATE TABLE `slow_log` (
`db` varchar(512) NOT NULL, `db` varchar(512) NOT NULL,
`last_insert_id` int(11) NOT NULL, `last_insert_id` int(11) NOT NULL,
`insert_id` int(11) NOT NULL, `insert_id` int(11) NOT NULL,
`server_id` int(11) NOT NULL, `server_id` int(10) unsigned NOT NULL,
`sql_text` mediumtext NOT NULL `sql_text` mediumtext NOT NULL
) ENGINE=CSV DEFAULT CHARSET=utf8 COMMENT='Slow log' ) ENGINE=CSV DEFAULT CHARSET=utf8 COMMENT='Slow log'
show tables; show tables;
......
...@@ -1432,4 +1432,32 @@ Catalog Database Table Table_alias Column Column_alias Type Length Max length Is ...@@ -1432,4 +1432,32 @@ Catalog Database Table Table_alias Column Column_alias Type Length Max length Is
def @@storage_engine 253 6 6 N 1 31 8 def @@storage_engine 253 6 6 N 1 31 8
@@storage_engine @@storage_engine
MyISAM MyISAM
SET @old_server_id = @@GLOBAL.server_id;
SET GLOBAL server_id = (1 << 32) - 1;
SELECT @@GLOBAL.server_id;
@@GLOBAL.server_id
4294967295
SET GLOBAL server_id = (1 << 32);
Warnings:
Warning 1292 Truncated incorrect server_id value: '4294967296'
SELECT @@GLOBAL.server_id;
@@GLOBAL.server_id
4294967295
SET GLOBAL server_id = (1 << 60);
Warnings:
Warning 1292 Truncated incorrect server_id value: '1152921504606846976'
SELECT @@GLOBAL.server_id;
@@GLOBAL.server_id
4294967295
SET GLOBAL server_id = 0;
SELECT @@GLOBAL.server_id;
@@GLOBAL.server_id
0
SET GLOBAL server_id = -1;
Warnings:
Warning 1292 Truncated incorrect server_id value: '-1'
SELECT @@GLOBAL.server_id;
@@GLOBAL.server_id
0
SET GLOBAL server_id = @old_server_id;
End of 5.1 tests End of 5.1 tests
...@@ -55,7 +55,7 @@ SELECT @@session.auto_increment_increment; ...@@ -55,7 +55,7 @@ SELECT @@session.auto_increment_increment;
'#------------------FN_DYNVARS_001_05-----------------------#' '#------------------FN_DYNVARS_001_05-----------------------#'
SET @@global.auto_increment_increment = 0; SET @@global.auto_increment_increment = 0;
Warnings: Warnings:
Warning 1292 Truncated incorrect auto-increment-increment value: '0' Warning 1292 Truncated incorrect auto_increment_increment value: '0'
SELECT @@global.auto_increment_increment; SELECT @@global.auto_increment_increment;
@@global.auto_increment_increment @@global.auto_increment_increment
1 1
...@@ -83,7 +83,7 @@ SELECT @@global.auto_increment_increment; ...@@ -83,7 +83,7 @@ SELECT @@global.auto_increment_increment;
65535 65535
SET @@session.auto_increment_increment = 0; SET @@session.auto_increment_increment = 0;
Warnings: Warnings:
Warning 1292 Truncated incorrect auto-increment-increment value: '0' Warning 1292 Truncated incorrect auto_increment_increment value: '0'
SELECT @@session.auto_increment_increment; SELECT @@session.auto_increment_increment;
@@session.auto_increment_increment @@session.auto_increment_increment
1 1
...@@ -126,7 +126,7 @@ SELECT @@global.auto_increment_increment; ...@@ -126,7 +126,7 @@ SELECT @@global.auto_increment_increment;
1 1
SET @@global.auto_increment_increment = FALSE; SET @@global.auto_increment_increment = FALSE;
Warnings: Warnings:
Warning 1292 Truncated incorrect auto-increment-increment value: '0' Warning 1292 Truncated incorrect auto_increment_increment value: '0'
SELECT @@global.auto_increment_increment; SELECT @@global.auto_increment_increment;
@@global.auto_increment_increment @@global.auto_increment_increment
1 1
......
...@@ -55,7 +55,7 @@ SELECT @@session.auto_increment_offset; ...@@ -55,7 +55,7 @@ SELECT @@session.auto_increment_offset;
'#------------------FN_DYNVARS_002_05-----------------------#' '#------------------FN_DYNVARS_002_05-----------------------#'
SET @@global.auto_increment_offset = 0; SET @@global.auto_increment_offset = 0;
Warnings: Warnings:
Warning 1292 Truncated incorrect auto-increment-offset value: '0' Warning 1292 Truncated incorrect auto_increment_offset value: '0'
SELECT @@global.auto_increment_offset; SELECT @@global.auto_increment_offset;
@@global.auto_increment_offset @@global.auto_increment_offset
1 1
...@@ -88,7 +88,7 @@ SELECT @@global.auto_increment_offset; ...@@ -88,7 +88,7 @@ SELECT @@global.auto_increment_offset;
65535 65535
SET @@session.auto_increment_offset = 0; SET @@session.auto_increment_offset = 0;
Warnings: Warnings:
Warning 1292 Truncated incorrect auto-increment-offset value: '0' Warning 1292 Truncated incorrect auto_increment_offset value: '0'
SELECT @@session.auto_increment_offset; SELECT @@session.auto_increment_offset;
@@session.auto_increment_offset @@session.auto_increment_offset
1 1
...@@ -139,7 +139,7 @@ SELECT @@global.auto_increment_offset; ...@@ -139,7 +139,7 @@ SELECT @@global.auto_increment_offset;
1 1
SET @@global.auto_increment_offset = FALSE; SET @@global.auto_increment_offset = FALSE;
Warnings: Warnings:
Warning 1292 Truncated incorrect auto-increment-offset value: '0' Warning 1292 Truncated incorrect auto_increment_offset value: '0'
SELECT @@global.auto_increment_offset; SELECT @@global.auto_increment_offset;
@@global.auto_increment_offset @@global.auto_increment_offset
1 1
......
...@@ -35,7 +35,7 @@ Select @@global.concurrent_insert; ...@@ -35,7 +35,7 @@ Select @@global.concurrent_insert;
0 0
SET @@global.concurrent_insert = 100; SET @@global.concurrent_insert = 100;
Warnings: Warnings:
Warning 1292 Truncated incorrect concurrent-insert value: '100' Warning 1292 Truncated incorrect concurrent_insert value: '100'
Select @@global.concurrent_insert; Select @@global.concurrent_insert;
@@global.concurrent_insert @@global.concurrent_insert
2 2
......
...@@ -23,13 +23,13 @@ SELECT @@global.rpl_recovery_rank; ...@@ -23,13 +23,13 @@ SELECT @@global.rpl_recovery_rank;
123456789 123456789
SET @@global.rpl_recovery_rank = 2147483648*2; SET @@global.rpl_recovery_rank = 2147483648*2;
Warnings: Warnings:
Warning 1292 Truncated incorrect rpl-recovery-rank value: '4294967296' Warning 1292 Truncated incorrect rpl_recovery_rank value: '4294967296'
SELECT @@global.rpl_recovery_rank; SELECT @@global.rpl_recovery_rank;
@@global.rpl_recovery_rank @@global.rpl_recovery_rank
4294967295 4294967295
SET @@global.rpl_recovery_rank = 2147483648*1024; SET @@global.rpl_recovery_rank = 2147483648*1024;
Warnings: Warnings:
Warning 1292 Truncated incorrect rpl-recovery-rank value: '2199023255552' Warning 1292 Truncated incorrect rpl_recovery_rank value: '2199023255552'
SELECT @@global.rpl_recovery_rank; SELECT @@global.rpl_recovery_rank;
@@global.rpl_recovery_rank @@global.rpl_recovery_rank
4294967295 4294967295
...@@ -38,7 +38,7 @@ SELECT @@global.rpl_recovery_rank; ...@@ -38,7 +38,7 @@ SELECT @@global.rpl_recovery_rank;
4294967295 4294967295
SET @@global.rpl_recovery_rank = 2147483648*2147483648; SET @@global.rpl_recovery_rank = 2147483648*2147483648;
Warnings: Warnings:
Warning 1292 Truncated incorrect rpl-recovery-rank value: '4611686018427387904' Warning 1292 Truncated incorrect rpl_recovery_rank value: '4611686018427387904'
SELECT @@global.rpl_recovery_rank; SELECT @@global.rpl_recovery_rank;
@@global.rpl_recovery_rank @@global.rpl_recovery_rank
4294967295 4294967295
......
...@@ -61,7 +61,7 @@ SELECT @@global.server_id; ...@@ -61,7 +61,7 @@ SELECT @@global.server_id;
0 0
SET @@global.server_id = 2147483649*2; SET @@global.server_id = 2147483649*2;
Warnings: Warnings:
Warning 1292 Truncated incorrect server-id value: '4294967298' Warning 1292 Truncated incorrect server_id value: '4294967298'
SELECT @@global.server_id; SELECT @@global.server_id;
@@global.server_id @@global.server_id
4294967295 4294967295
......
...@@ -52,17 +52,23 @@ SET @@local.server_id = 4; ...@@ -52,17 +52,23 @@ SET @@local.server_id = 4;
ERROR HY000: Variable 'server_id' is a GLOBAL variable and should be set with SET GLOBAL ERROR HY000: Variable 'server_id' is a GLOBAL variable and should be set with SET GLOBAL
'#------------------FN_DYNVARS_144_05-----------------------#' '#------------------FN_DYNVARS_144_05-----------------------#'
SET @@global.server_id = -1; SET @@global.server_id = -1;
Warnings:
Warning 1292 Truncated incorrect server_id value: '-1'
SELECT @@global.server_id; SELECT @@global.server_id;
@@global.server_id @@global.server_id
0 0
SET @@global.server_id = -2147483648; SET @@global.server_id = -2147483648;
Warnings:
Warning 1292 Truncated incorrect server_id value: '-2147483648'
SELECT @@global.server_id; SELECT @@global.server_id;
@@global.server_id @@global.server_id
0 0
SET @@global.server_id = 2147483649*2; SET @@global.server_id = 2147483649*2;
Warnings:
Warning 1292 Truncated incorrect server_id value: '4294967298'
SELECT @@global.server_id; SELECT @@global.server_id;
@@global.server_id @@global.server_id
4294967298 4294967295
SET @@global.server_id = 65530.34.; SET @@global.server_id = 65530.34.;
ERROR 42000: You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near '.' at line 1 ERROR 42000: You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near '.' at line 1
SET @@global.server_id = '125'; SET @@global.server_id = '125';
......
...@@ -1209,6 +1209,18 @@ select replace(@full_mode, 'ALLOW_INVALID_DATES', 'INVALID_DATES') into @full_mo ...@@ -1209,6 +1209,18 @@ select replace(@full_mode, 'ALLOW_INVALID_DATES', 'INVALID_DATES') into @full_mo
select name from mysql.event where name = 'p' and sql_mode = @full_mode; select name from mysql.event where name = 'p' and sql_mode = @full_mode;
drop event e1; drop event e1;
#
# Bug#36540: CREATE EVENT and ALTER EVENT statements fail with large server_id
#
SET @old_server_id = @@GLOBAL.server_id;
SET GLOBAL server_id = (1 << 32) - 1;
SELECT @@GLOBAL.server_id;
CREATE EVENT ev1 ON SCHEDULE EVERY 1 DAY DO SELECT 1;
SELECT event_name, originator FROM INFORMATION_SCHEMA.EVENTS;
DROP EVENT ev1;
SET GLOBAL server_id = @old_server_id;
########################################################################### ###########################################################################
# #
# End of tests # End of tests
......
...@@ -390,3 +390,91 @@ INSERT INTO t1 VALUES (NULL); ...@@ -390,3 +390,91 @@ INSERT INTO t1 VALUES (NULL);
#endif #endif
SELECT * FROM t1; SELECT * FROM t1;
DROP TABLE t1; DROP TABLE t1;
#
# Check for floating point autoinc column handling
#
SET @@SESSION.AUTO_INCREMENT_INCREMENT=1, @@SESSION.AUTO_INCREMENT_OFFSET=1;
SET @@INSERT_ID=1;
SHOW VARIABLES LIKE "%auto_inc%";
CREATE TABLE t1 (c1 DOUBLE NOT NULL AUTO_INCREMENT, c2 INT, PRIMARY KEY (c1)) ENGINE=InnoDB;
INSERT INTO t1 VALUES(NULL, 1);
INSERT INTO t1 VALUES(NULL, 2);
SELECT * FROM t1;
ALTER TABLE t1 CHANGE c1 c1 SERIAL;
SELECT * FROM t1;
INSERT INTO t1 VALUES(NULL, 3);
INSERT INTO t1 VALUES(NULL, 4);
SELECT * FROM t1;
DROP TABLE IF EXISTS t1;
CREATE TABLE t1 (c1 FLOAT NOT NULL AUTO_INCREMENT, c2 INT, PRIMARY KEY (c1)) ENGINE=InnoDB;
INSERT INTO t1 VALUES(NULL, 1);
INSERT INTO t1 VALUES(NULL, 2);
SELECT * FROM t1;
ALTER TABLE t1 CHANGE c1 c1 SERIAL;
SELECT * FROM t1;
INSERT INTO t1 VALUES(NULL, 3);
INSERT INTO t1 VALUES(NULL, 4);
SELECT * FROM t1;
DROP TABLE t1;
#
# Bug# 42714: AUTOINC column calculated next value not greater than highest
# value stored in table.
#
SET @@SESSION.AUTO_INCREMENT_INCREMENT=1, @@SESSION.AUTO_INCREMENT_OFFSET=5;
DROP TABLE IF EXISTS t1;
DROP TABLE IF EXISTS t2;
CREATE TABLE t1 (
a INT(11) UNSIGNED NOT NULL AUTO_INCREMENT,
b INT(10) UNSIGNED NOT NULL,
c ENUM('FALSE','TRUE') DEFAULT NULL,
PRIMARY KEY (a)) ENGINE = InnoDB;
CREATE TABLE t2 (
m INT(11) UNSIGNED NOT NULL AUTO_INCREMENT,
n INT(10) UNSIGNED NOT NULL,
o enum('FALSE','TRUE') DEFAULT NULL,
PRIMARY KEY (m)) ENGINE = InnoDB;
INSERT INTO t2 (n,o) VALUES
(1 , 'true'), (1 , 'false'), (2 , 'true'), (2 , 'false'), (3 , 'true'),
(3 , 'false'), (4 , 'true'), (4 , 'false'), (5 , 'true'), (5 , 'false');
SHOW CREATE TABLE t2;
INSERT INTO t1 (b,c) SELECT n,o FROM t2 ;
SHOW CREATE TABLE t1;
INSERT INTO t1 (b,c) SELECT n,o FROM t2 ;
SELECT * FROM t1;
SHOW CREATE TABLE t1;
INSERT INTO t1 (b,c) SELECT n,o FROM t2 WHERE o = 'false';
SELECT * FROM t1;
SHOW CREATE TABLE t1;
INSERT INTO t1 (b,c) SELECT n,o FROM t2 WHERE o = 'false';
SELECT * FROM t1;
SHOW CREATE TABLE t1;
INSERT INTO t1 (b,c) SELECT n,o FROM t2 WHERE o = 'false';
SHOW CREATE TABLE t1;
INSERT INTO t1 (b,c) SELECT n,o FROM t2 WHERE o = 'false';
SHOW CREATE TABLE t1;
INSERT INTO t1 (b,c) SELECT n,o FROM t2 WHERE o = 'false';
SELECT * FROM t1;
SHOW CREATE TABLE t1;
DROP TABLE t1;
DROP TABLE t2;
#
# 43203: Overflow from auto incrementing causes server segv
#
DROP TABLE IF EXISTS t1;
DROP TABLE IF EXISTS t2;
CREATE TABLE t1(
c1 INT(10) UNSIGNED NOT NULL AUTO_INCREMENT
PRIMARY KEY) ENGINE=InnoDB;
INSERT INTO t1 VALUES (NULL),(NULL),(NULL),(NULL),(NULL),(NULL),(NULL),(NULL),(NULL),(NULL),(NULL),(NULL),(NULL),(NULL),(NULL),(NULL),(NULL),(NULL),(NULL),(NULL),(NULL),(NULL),(NULL),(NULL),(NULL),(NULL),(NULL),(NULL),(NULL),(NULL),(NULL),(NULL),(NULL),(NULL),(NULL),(NULL),(NULL),(NULL),(NULL),(NULL),(NULL),(NULL),(NULL),(NULL),(NULL),(NULL),(NULL),(NULL),(NULL),(NULL),(NULL),(NULL),(NULL),(NULL),(NULL),(NULL),(NULL),(NULL),(NULL),(NULL),(NULL),(NULL),(NULL),(NULL),(NULL),(NULL),(NULL),(NULL),(NULL),(NULL),(NULL),(NULL),(NULL),(NULL),(NULL),(NULL),(NULL),(NULL),(NULL),(NULL),(NULL),(NULL),(NULL),(NULL),(NULL),(NULL),(NULL),(NULL),(NULL),(NULL),(NULL),(NULL),(NULL),(NULL),(NULL),(NULL),(NULL),(NULL),(NULL),(NULL),(NULL),(NULL),(NULL),(NULL),(NULL),(NULL),(NULL),(NULL),(NULL),(NULL),(NULL),(NULL),(NULL),(NULL),(NULL),(NULL),(NULL),(NULL),(NULL),(NULL),(NULL),(NULL),(NULL),(NULL),(NULL),(NULL),(NULL),(NULL),(NULL),(NULL),(NULL),(NULL),(NULL),(NULL),(NULL),(NULL),(NULL),(NULL),(NULL),(NULL),(NULL),(NULL),(NULL),(NULL),(NULL),(NULL),(NULL),(NULL),(NULL),(NULL),(NULL),(NULL),(NULL),(NULL),(NULL),(NULL),(NULL),(NULL),(NULL),(NULL),(NULL),(NULL),(NULL),(NULL),(NULL),(NULL),(NULL),(NULL),(NULL),(NULL),(NULL),(NULL),(NULL),(NULL),(NULL),(NULL),(NULL),(NULL),(NULL),(NULL),(NULL),(NULL),(NULL),(NULL),(NULL),(NULL),(NULL),(NULL),(NULL),(NULL),(NULL),(NULL),(NULL),(NULL),(NULL),(NULL),(NULL),(NULL),(NULL),(NULL),(NULL),(NULL),(NULL),(NULL),(NULL),(NULL),(NULL),(NULL),(NULL),(NULL),(NULL),(NULL),(NULL),(NULL),(NULL),(NULL),(NULL),(NULL),(NULL),(NULL),(NULL),(NULL),(NULL),(NULL),(NULL),(NULL),(NULL),(NULL),(NULL),(NULL),(NULL),(NULL),(NULL),(NULL),(NULL),(NULL),(NULL),(NULL),(NULL),(NULL),(NULL),(NULL),(NULL),(NULL),(NULL),(NULL),(NULL),(NULL),(NULL),(NULL),(NULL),(NULL),(NULL),(NULL),(NULL),(NULL);
CREATE TABLE t2(
c1 TINYINT(3) UNSIGNED NOT NULL AUTO_INCREMENT
PRIMARY KEY) ENGINE=InnoDB;
-- error ER_DUP_ENTRY,1062
INSERT INTO t2 SELECT c1 FROM t1;
-- error ER_DUP_ENTRY,1467
INSERT INTO t2 SELECT NULL FROM t1;
DROP TABLE t1;
DROP TABLE t2;
...@@ -287,7 +287,7 @@ CREATE TABLE `general_log` ( ...@@ -287,7 +287,7 @@ CREATE TABLE `general_log` (
ON UPDATE CURRENT_TIMESTAMP, ON UPDATE CURRENT_TIMESTAMP,
`user_host` mediumtext NOT NULL, `user_host` mediumtext NOT NULL,
`thread_id` int(11) NOT NULL, `thread_id` int(11) NOT NULL,
`server_id` int(11) NOT NULL, `server_id` int(10) unsigned NOT NULL,
`command_type` varchar(64) NOT NULL, `command_type` varchar(64) NOT NULL,
`argument` mediumtext NOT NULL `argument` mediumtext NOT NULL
) ENGINE=CSV DEFAULT CHARSET=utf8 COMMENT='General log'; ) ENGINE=CSV DEFAULT CHARSET=utf8 COMMENT='General log';
...@@ -303,7 +303,7 @@ CREATE TABLE `slow_log` ( ...@@ -303,7 +303,7 @@ CREATE TABLE `slow_log` (
`db` varchar(512) NOT NULL, `db` varchar(512) NOT NULL,
`last_insert_id` int(11) NOT NULL, `last_insert_id` int(11) NOT NULL,
`insert_id` int(11) NOT NULL, `insert_id` int(11) NOT NULL,
`server_id` int(11) NOT NULL, `server_id` int(10) unsigned NOT NULL,
`sql_text` mediumtext NOT NULL `sql_text` mediumtext NOT NULL
) ENGINE=CSV DEFAULT CHARSET=utf8 COMMENT='Slow log'; ) ENGINE=CSV DEFAULT CHARSET=utf8 COMMENT='Slow log';
......
...@@ -40,6 +40,8 @@ drop table t1; ...@@ -40,6 +40,8 @@ drop table t1;
create table t1 (a bit) engine=innodb; create table t1 (a bit) engine=innodb;
insert into t1 values (b'0'), (b'1'), (b'000'), (b'100'), (b'001'); insert into t1 values (b'0'), (b'1'), (b'000'), (b'100'), (b'001');
select hex(a) from t1; select hex(a) from t1;
# It is not deterministic which duplicate will be seen first
--replace_regex /(.*Duplicate entry )'.*'( for key.*)/\1''\2/
--error ER_DUP_ENTRY --error ER_DUP_ENTRY
alter table t1 add unique (a); alter table t1 add unique (a);
drop table t1; drop table t1;
......
...@@ -1169,5 +1169,21 @@ SET GLOBAL auto_increment_offset=0; ...@@ -1169,5 +1169,21 @@ SET GLOBAL auto_increment_offset=0;
select @@storage_engine; select @@storage_engine;
--disable_metadata --disable_metadata
#
# Bug#36540: CREATE EVENT and ALTER EVENT statements fail with large server_id
#
SET @old_server_id = @@GLOBAL.server_id;
SET GLOBAL server_id = (1 << 32) - 1;
SELECT @@GLOBAL.server_id;
SET GLOBAL server_id = (1 << 32);
SELECT @@GLOBAL.server_id;
SET GLOBAL server_id = (1 << 60);
SELECT @@GLOBAL.server_id;
SET GLOBAL server_id = 0;
SELECT @@GLOBAL.server_id;
SET GLOBAL server_id = -1;
SELECT @@GLOBAL.server_id;
SET GLOBAL server_id = @old_server_id;
--echo End of 5.1 tests --echo End of 5.1 tests
...@@ -66,7 +66,7 @@ CREATE TABLE IF NOT EXISTS procs_priv ( Host char(60) binary DEFAULT '' NOT NULL ...@@ -66,7 +66,7 @@ CREATE TABLE IF NOT EXISTS procs_priv ( Host char(60) binary DEFAULT '' NOT NULL
-- Create general_log if CSV is enabled. -- Create general_log if CSV is enabled.
SET @str = IF (@@have_csv = 'YES', 'CREATE TABLE IF NOT EXISTS general_log (event_time TIMESTAMP NOT NULL, user_host MEDIUMTEXT NOT NULL, thread_id INTEGER NOT NULL, server_id INTEGER NOT NULL, command_type VARCHAR(64) NOT NULL, argument MEDIUMTEXT NOT NULL) engine=CSV CHARACTER SET utf8 comment="General log"', 'SET @dummy = 0'); SET @str = IF (@@have_csv = 'YES', 'CREATE TABLE IF NOT EXISTS general_log (event_time TIMESTAMP NOT NULL, user_host MEDIUMTEXT NOT NULL, thread_id INTEGER NOT NULL, server_id INTEGER UNSIGNED NOT NULL, command_type VARCHAR(64) NOT NULL, argument MEDIUMTEXT NOT NULL) engine=CSV CHARACTER SET utf8 comment="General log"', 'SET @dummy = 0');
PREPARE stmt FROM @str; PREPARE stmt FROM @str;
EXECUTE stmt; EXECUTE stmt;
...@@ -74,13 +74,13 @@ DROP PREPARE stmt; ...@@ -74,13 +74,13 @@ DROP PREPARE stmt;
-- Create slow_log if CSV is enabled. -- Create slow_log if CSV is enabled.
SET @str = IF (@@have_csv = 'YES', 'CREATE TABLE IF NOT EXISTS slow_log (start_time TIMESTAMP NOT NULL, user_host MEDIUMTEXT NOT NULL, query_time TIME NOT NULL, lock_time TIME 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 NOT NULL, sql_text MEDIUMTEXT 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 NOT NULL, user_host MEDIUMTEXT NOT NULL, query_time TIME NOT NULL, lock_time TIME 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) engine=CSV CHARACTER SET utf8 comment="Slow log"', 'SET @dummy = 0');
PREPARE stmt FROM @str; PREPARE stmt FROM @str;
EXECUTE stmt; EXECUTE stmt;
DROP PREPARE stmt; DROP PREPARE stmt;
CREATE TABLE IF NOT EXISTS event ( db char(64) CHARACTER SET utf8 COLLATE utf8_bin NOT NULL default '', name char(64) CHARACTER SET utf8 NOT NULL default '', body longblob NOT NULL, definer char(77) CHARACTER SET utf8 COLLATE utf8_bin NOT NULL default '', execute_at DATETIME default NULL, interval_value int(11) default NULL, interval_field ENUM('YEAR','QUARTER','MONTH','DAY','HOUR','MINUTE','WEEK','SECOND','MICROSECOND','YEAR_MONTH','DAY_HOUR','DAY_MINUTE','DAY_SECOND','HOUR_MINUTE','HOUR_SECOND','MINUTE_SECOND','DAY_MICROSECOND','HOUR_MICROSECOND','MINUTE_MICROSECOND','SECOND_MICROSECOND') default NULL, created TIMESTAMP NOT NULL, modified TIMESTAMP NOT NULL, last_executed DATETIME default NULL, starts DATETIME default NULL, ends DATETIME default NULL, status ENUM('ENABLED','DISABLED','SLAVESIDE_DISABLED') NOT NULL default 'ENABLED', on_completion ENUM('DROP','PRESERVE') NOT NULL default 'DROP', sql_mode set('REAL_AS_FLOAT','PIPES_AS_CONCAT','ANSI_QUOTES','IGNORE_SPACE','NOT_USED','ONLY_FULL_GROUP_BY','NO_UNSIGNED_SUBTRACTION','NO_DIR_IN_CREATE','POSTGRESQL','ORACLE','MSSQL','DB2','MAXDB','NO_KEY_OPTIONS','NO_TABLE_OPTIONS','NO_FIELD_OPTIONS','MYSQL323','MYSQL40','ANSI','NO_AUTO_VALUE_ON_ZERO','NO_BACKSLASH_ESCAPES','STRICT_TRANS_TABLES','STRICT_ALL_TABLES','NO_ZERO_IN_DATE','NO_ZERO_DATE','INVALID_DATES','ERROR_FOR_DIVISION_BY_ZERO','TRADITIONAL','NO_AUTO_CREATE_USER','HIGH_NOT_PRECEDENCE','NO_ENGINE_SUBSTITUTION','PAD_CHAR_TO_FULL_LENGTH') DEFAULT '' NOT NULL, comment char(64) CHARACTER SET utf8 COLLATE utf8_bin NOT NULL default '', originator int(10) NOT NULL, time_zone char(64) CHARACTER SET latin1 NOT NULL DEFAULT 'SYSTEM', character_set_client char(32) collate utf8_bin, collation_connection char(32) collate utf8_bin, db_collation char(32) collate utf8_bin, body_utf8 longblob, PRIMARY KEY (db, name) ) ENGINE=MyISAM DEFAULT CHARSET=utf8 COMMENT 'Events'; CREATE TABLE IF NOT EXISTS event ( db char(64) CHARACTER SET utf8 COLLATE utf8_bin NOT NULL default '', name char(64) CHARACTER SET utf8 NOT NULL default '', body longblob NOT NULL, definer char(77) CHARACTER SET utf8 COLLATE utf8_bin NOT NULL default '', execute_at DATETIME default NULL, interval_value int(11) default NULL, interval_field ENUM('YEAR','QUARTER','MONTH','DAY','HOUR','MINUTE','WEEK','SECOND','MICROSECOND','YEAR_MONTH','DAY_HOUR','DAY_MINUTE','DAY_SECOND','HOUR_MINUTE','HOUR_SECOND','MINUTE_SECOND','DAY_MICROSECOND','HOUR_MICROSECOND','MINUTE_MICROSECOND','SECOND_MICROSECOND') default NULL, created TIMESTAMP NOT NULL, modified TIMESTAMP NOT NULL, last_executed DATETIME default NULL, starts DATETIME default NULL, ends DATETIME default NULL, status ENUM('ENABLED','DISABLED','SLAVESIDE_DISABLED') NOT NULL default 'ENABLED', on_completion ENUM('DROP','PRESERVE') NOT NULL default 'DROP', sql_mode set('REAL_AS_FLOAT','PIPES_AS_CONCAT','ANSI_QUOTES','IGNORE_SPACE','NOT_USED','ONLY_FULL_GROUP_BY','NO_UNSIGNED_SUBTRACTION','NO_DIR_IN_CREATE','POSTGRESQL','ORACLE','MSSQL','DB2','MAXDB','NO_KEY_OPTIONS','NO_TABLE_OPTIONS','NO_FIELD_OPTIONS','MYSQL323','MYSQL40','ANSI','NO_AUTO_VALUE_ON_ZERO','NO_BACKSLASH_ESCAPES','STRICT_TRANS_TABLES','STRICT_ALL_TABLES','NO_ZERO_IN_DATE','NO_ZERO_DATE','INVALID_DATES','ERROR_FOR_DIVISION_BY_ZERO','TRADITIONAL','NO_AUTO_CREATE_USER','HIGH_NOT_PRECEDENCE','NO_ENGINE_SUBSTITUTION','PAD_CHAR_TO_FULL_LENGTH') DEFAULT '' NOT NULL, comment char(64) CHARACTER SET utf8 COLLATE utf8_bin NOT NULL default '', originator INTEGER UNSIGNED NOT NULL, time_zone char(64) CHARACTER SET latin1 NOT NULL DEFAULT 'SYSTEM', character_set_client char(32) collate utf8_bin, collation_connection char(32) collate utf8_bin, db_collation char(32) collate utf8_bin, body_utf8 longblob, PRIMARY KEY (db, name) ) ENGINE=MyISAM DEFAULT CHARSET=utf8 COMMENT 'Events';
CREATE TABLE IF NOT EXISTS ndb_binlog_index (Position BIGINT UNSIGNED NOT NULL, File VARCHAR(255) NOT NULL, epoch BIGINT UNSIGNED NOT NULL, inserts BIGINT UNSIGNED NOT NULL, updates BIGINT UNSIGNED NOT NULL, deletes BIGINT UNSIGNED NOT NULL, schemaops BIGINT UNSIGNED NOT NULL, PRIMARY KEY(epoch)) ENGINE=MYISAM; CREATE TABLE IF NOT EXISTS ndb_binlog_index (Position BIGINT UNSIGNED NOT NULL, File VARCHAR(255) NOT NULL, epoch BIGINT UNSIGNED NOT NULL, inserts BIGINT UNSIGNED NOT NULL, updates BIGINT UNSIGNED NOT NULL, deletes BIGINT UNSIGNED NOT NULL, schemaops BIGINT UNSIGNED NOT NULL, PRIMARY KEY(epoch)) ENGINE=MYISAM;
......
...@@ -215,6 +215,20 @@ ALTER TABLE func ...@@ -215,6 +215,20 @@ ALTER TABLE func
ALTER TABLE func ALTER TABLE func
MODIFY type enum ('function','aggregate') COLLATE utf8_general_ci NOT NULL; MODIFY type enum ('function','aggregate') COLLATE utf8_general_ci NOT NULL;
#
# Modify log tables.
#
SET @old_log_state = @@global.general_log;
SET GLOBAL general_log = 'OFF';
ALTER TABLE general_log MODIFY COLUMN server_id INTEGER UNSIGNED NOT NULL;
SET GLOBAL general_log = @old_log_state;
SET @old_log_state = @@global.slow_query_log;
SET GLOBAL slow_query_log = 'OFF';
ALTER TABLE slow_log MODIFY COLUMN server_id INTEGER UNSIGNED NOT NULL;
SET GLOBAL slow_query_log = @old_log_state;
# #
# Detect whether we had Create_view_priv # Detect whether we had Create_view_priv
# #
...@@ -471,7 +485,10 @@ ALTER TABLE event MODIFY sql_mode ...@@ -471,7 +485,10 @@ ALTER TABLE event MODIFY sql_mode
'PAD_CHAR_TO_FULL_LENGTH' 'PAD_CHAR_TO_FULL_LENGTH'
) DEFAULT '' NOT NULL AFTER on_completion; ) DEFAULT '' NOT NULL AFTER on_completion;
ALTER TABLE event MODIFY name char(64) CHARACTER SET utf8 NOT NULL default ''; ALTER TABLE event MODIFY name char(64) CHARACTER SET utf8 NOT NULL default '';
ALTER TABLE event ADD COLUMN originator INT(10) NOT NULL AFTER comment;
ALTER TABLE event MODIFY COLUMN originator INT UNSIGNED NOT NULL;
ALTER TABLE event ADD COLUMN originator INT UNSIGNED NOT NULL AFTER comment;
ALTER TABLE event MODIFY COLUMN status ENUM('ENABLED','DISABLED','SLAVESIDE_DISABLED') NOT NULL default 'ENABLED'; ALTER TABLE event MODIFY COLUMN status ENUM('ENABLED','DISABLED','SLAVESIDE_DISABLED') NOT NULL default 'ENABLED';
ALTER TABLE event ADD COLUMN time_zone char(64) CHARACTER SET latin1 ALTER TABLE event ADD COLUMN time_zone char(64) CHARACTER SET latin1
......
When comparing with ms-sql:
Check how to get MySQL faster mysql ms-sql
count_distinct (2000) | 89.00| 39.00|
count_distinct_big (120) | 324.00| 121.00|
count_distinct_group (1000) | 158.00| 107.00|
count_distinct_group_on_key (1000) | 49.00| 17.00|
count_distinct_group_on_key_parts (1| 157.00| 108.00|
order_by_big (10) | 197.00| 89.00|
order_by_big_key (10) | 170.00| 82.00|
order_by_big_key2 (10) | 163.00| 73.00|
order_by_big_key_desc (10) | 172.00| 84.00|
order_by_big_key_diff (10) | 193.00| 89.00|
order_by_big_key_prefix (10) | 165.00| 72.00|
Why is the following slow on NT:
NT Linux
update_of_primary_key_many_keys (256| 560.00| 65.00|
...@@ -6249,7 +6249,7 @@ Can't be set to 1 if --log-slave-updates is used.", ...@@ -6249,7 +6249,7 @@ Can't be set to 1 if --log-slave-updates is used.",
GET_STR_ALLOC, REQUIRED_ARG, 0, 0, 0, 0, 0, 0}, GET_STR_ALLOC, REQUIRED_ARG, 0, 0, 0, 0, 0, 0},
{"server-id", OPT_SERVER_ID, {"server-id", OPT_SERVER_ID,
"Uniquely identifies the server instance in the community of replication partners.", "Uniquely identifies the server instance in the community of replication partners.",
(uchar**) &server_id, (uchar**) &server_id, 0, GET_ULONG, REQUIRED_ARG, 0, 0, 0, (uchar**) &server_id, (uchar**) &server_id, 0, GET_ULONG, REQUIRED_ARG, 0, 0, UINT_MAX32,
0, 0, 0}, 0, 0, 0},
{"set-variable", 'O', {"set-variable", 'O',
"Change the value of a variable. Please note that this option is deprecated;you can set variables directly with --variable-name=value.", "Change the value of a variable. Please note that this option is deprecated;you can set variables directly with --variable-name=value.",
......
...@@ -1105,12 +1105,20 @@ btr_search_drop_page_hash_when_freed( ...@@ -1105,12 +1105,20 @@ btr_search_drop_page_hash_when_freed(
page = buf_page_get_gen(space, page_no, RW_S_LATCH, NULL, page = buf_page_get_gen(space, page_no, RW_S_LATCH, NULL,
BUF_GET_IF_IN_POOL, __FILE__, __LINE__, BUF_GET_IF_IN_POOL, __FILE__, __LINE__,
&mtr); &mtr);
/* Because the buffer pool mutex was released by
buf_page_peek_if_search_hashed(), it is possible that the
block was removed from the buffer pool by another thread
before buf_page_get_gen() got a chance to acquire the buffer
pool mutex again. Thus, we must check for a NULL return. */
if (UNIV_LIKELY(page != NULL)) {
#ifdef UNIV_SYNC_DEBUG #ifdef UNIV_SYNC_DEBUG
buf_page_dbg_add_level(page, SYNC_TREE_NODE_FROM_HASH); buf_page_dbg_add_level(page, SYNC_TREE_NODE_FROM_HASH);
#endif /* UNIV_SYNC_DEBUG */ #endif /* UNIV_SYNC_DEBUG */
btr_search_drop_page_hash_index(page); btr_search_drop_page_hash_index(page);
}
mtr_commit(&mtr); mtr_commit(&mtr);
} }
......
...@@ -953,6 +953,12 @@ innobase_next_autoinc( ...@@ -953,6 +953,12 @@ innobase_next_autoinc(
/* Should never be 0. */ /* Should never be 0. */
ut_a(increment > 0); ut_a(increment > 0);
/* According to MySQL documentation, if the offset is greater than
the increment then the offset is ignored. */
if (offset > increment) {
offset = 0;
}
if (max_value <= current) { if (max_value <= current) {
next_value = max_value; next_value = max_value;
} else if (offset <= 1) { } else if (offset <= 1) {
...@@ -3312,8 +3318,8 @@ build_template( ...@@ -3312,8 +3318,8 @@ build_template(
goto include_field; goto include_field;
} }
if (bitmap_is_set(table->read_set, i) || if (bitmap_is_set(table->read_set, i) ||
bitmap_is_set(table->write_set, i)) { bitmap_is_set(table->write_set, i)) {
/* This field is needed in the query */ /* This field is needed in the query */
goto include_field; goto include_field;
...@@ -3405,7 +3411,7 @@ build_template( ...@@ -3405,7 +3411,7 @@ build_template(
} }
/************************************************************************ /************************************************************************
Get the upper limit of the MySQL integral type. */ Get the upper limit of the MySQL integral and floating-point type. */
ulonglong ulonglong
ha_innobase::innobase_get_int_col_max_value( ha_innobase::innobase_get_int_col_max_value(
...@@ -3416,7 +3422,7 @@ ha_innobase::innobase_get_int_col_max_value( ...@@ -3416,7 +3422,7 @@ ha_innobase::innobase_get_int_col_max_value(
switch(field->key_type()) { switch(field->key_type()) {
/* TINY */ /* TINY */
case HA_KEYTYPE_BINARY: case HA_KEYTYPE_BINARY:
max_value = 0xFFULL; max_value = 0xFFULL;
break; break;
case HA_KEYTYPE_INT8: case HA_KEYTYPE_INT8:
...@@ -3430,7 +3436,7 @@ ha_innobase::innobase_get_int_col_max_value( ...@@ -3430,7 +3436,7 @@ ha_innobase::innobase_get_int_col_max_value(
max_value = 0x7FFFULL; max_value = 0x7FFFULL;
break; break;
/* MEDIUM */ /* MEDIUM */
case HA_KEYTYPE_UINT24: case HA_KEYTYPE_UINT24:
max_value = 0xFFFFFFULL; max_value = 0xFFFFFFULL;
break; break;
case HA_KEYTYPE_INT24: case HA_KEYTYPE_INT24:
...@@ -3444,12 +3450,20 @@ ha_innobase::innobase_get_int_col_max_value( ...@@ -3444,12 +3450,20 @@ ha_innobase::innobase_get_int_col_max_value(
max_value = 0x7FFFFFFFULL; max_value = 0x7FFFFFFFULL;
break; break;
/* BIG */ /* BIG */
case HA_KEYTYPE_ULONGLONG: case HA_KEYTYPE_ULONGLONG:
max_value = 0xFFFFFFFFFFFFFFFFULL; max_value = 0xFFFFFFFFFFFFFFFFULL;
break; break;
case HA_KEYTYPE_LONGLONG: case HA_KEYTYPE_LONGLONG:
max_value = 0x7FFFFFFFFFFFFFFFULL; max_value = 0x7FFFFFFFFFFFFFFFULL;
break; break;
case HA_KEYTYPE_FLOAT:
/* We use the maximum as per IEEE754-2008 standard, 2^24 */
max_value = 0x1000000ULL;
break;
case HA_KEYTYPE_DOUBLE:
/* We use the maximum as per IEEE754-2008 standard, 2^53 */
max_value = 0x20000000000000ULL;
break;
default: default:
ut_error; ut_error;
} }
...@@ -3772,7 +3786,7 @@ ha_innobase::write_row( ...@@ -3772,7 +3786,7 @@ ha_innobase::write_row(
will be 0 if get_auto_increment() was not called.*/ will be 0 if get_auto_increment() was not called.*/
if (auto_inc <= col_max_value if (auto_inc <= col_max_value
&& auto_inc > prebuilt->autoinc_last_value) { && auto_inc >= prebuilt->autoinc_last_value) {
set_max_autoinc: set_max_autoinc:
ut_a(prebuilt->autoinc_increment > 0); ut_a(prebuilt->autoinc_increment > 0);
...@@ -7650,11 +7664,13 @@ ha_innobase::get_auto_increment( ...@@ -7650,11 +7664,13 @@ ha_innobase::get_auto_increment(
prebuilt->autoinc_last_value = next_value; prebuilt->autoinc_last_value = next_value;
ut_a(prebuilt->autoinc_last_value >= *first_value); if (prebuilt->autoinc_last_value < *first_value) {
*first_value = (~(ulonglong) 0);
/* Update the table autoinc variable */ } else {
dict_table_autoinc_update_if_greater( /* Update the table autoinc variable */
prebuilt->table, prebuilt->autoinc_last_value); dict_table_autoinc_update_if_greater(
prebuilt->table, prebuilt->autoinc_last_value);
}
} else { } else {
/* This will force write_row() into attempting an update /* This will force write_row() into attempting an update
of the table's AUTOINC counter. */ of the table's AUTOINC counter. */
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment