Commit a450d58a authored by Sergei Golubchik's avatar Sergei Golubchik

fix a copy-paste error

LEX_CSTRING table_name= { table->s->db.str, table->s->table_name.length };

and misc cleanups
parent e4d7886c
DROP TABLE IF EXISTS t1, t2, t3, t, tp, tsp, tmp;
#
# Bug#11894100: EXCHANGE PARTITION CAN'T BE EXECUTED IF
# ROW_FORMAT WAS SET EXPLICITLY
......@@ -6,25 +5,19 @@ DROP TABLE IF EXISTS t1, t2, t3, t, tp, tsp, tmp;
# Same definition (both have ROW_FORMAT set)
CREATE TABLE t1 (
id int(11) NOT NULL AUTO_INCREMENT,
year year(2) DEFAULT NULL,
year year DEFAULT NULL,
modified timestamp NOT NULL DEFAULT '0000-00-00 00:00:00',
PRIMARY KEY (id)
) ENGINE=InnoDB ROW_FORMAT=COMPACT
PARTITION BY HASH (id)
PARTITIONS 2;
Warnings:
Note 1287 'YEAR(2)' is deprecated and will be removed in a future release. Please use YEAR(4) instead
CREATE TABLE t2 LIKE t1;
Warnings:
Note 1287 'YEAR(2)' is deprecated and will be removed in a future release. Please use YEAR(4) instead
ALTER TABLE t2 REMOVE PARTITIONING;
Warnings:
Note 1287 'YEAR(2)' is deprecated and will be removed in a future release. Please use YEAR(4) instead
SHOW CREATE TABLE t1;
Table t1
Create Table CREATE TABLE `t1` (
`id` int(11) NOT NULL AUTO_INCREMENT,
`year` year(2) DEFAULT NULL,
`year` year(4) DEFAULT NULL,
`modified` timestamp NOT NULL DEFAULT '0000-00-00 00:00:00',
PRIMARY KEY (`id`)
) ENGINE=InnoDB DEFAULT CHARSET=latin1 ROW_FORMAT=COMPACT
......@@ -34,7 +27,7 @@ SHOW CREATE TABLE t2;
Table t2
Create Table CREATE TABLE `t2` (
`id` int(11) NOT NULL AUTO_INCREMENT,
`year` year(2) DEFAULT NULL,
`year` year(4) DEFAULT NULL,
`modified` timestamp NOT NULL DEFAULT '0000-00-00 00:00:00',
PRIMARY KEY (`id`)
) ENGINE=InnoDB DEFAULT CHARSET=latin1 ROW_FORMAT=COMPACT
......@@ -53,15 +46,11 @@ ENGINE InnoDB
ROW_FORMAT Compact
CREATE_OPTIONS row_format=COMPACT
ALTER TABLE t1 EXCHANGE PARTITION p1 WITH TABLE t2;
Warnings:
Level Note
Code 1287
Message 'YEAR(2)' is deprecated and will be removed in a future release. Please use YEAR(4) instead
SHOW CREATE TABLE t1;
Table t1
Create Table CREATE TABLE `t1` (
`id` int(11) NOT NULL AUTO_INCREMENT,
`year` year(2) DEFAULT NULL,
`year` year(4) DEFAULT NULL,
`modified` timestamp NOT NULL DEFAULT '0000-00-00 00:00:00',
PRIMARY KEY (`id`)
) ENGINE=InnoDB DEFAULT CHARSET=latin1 ROW_FORMAT=COMPACT
......@@ -71,7 +60,7 @@ SHOW CREATE TABLE t2;
Table t2
Create Table CREATE TABLE `t2` (
`id` int(11) NOT NULL AUTO_INCREMENT,
`year` year(2) DEFAULT NULL,
`year` year(4) DEFAULT NULL,
`modified` timestamp NOT NULL DEFAULT '0000-00-00 00:00:00',
PRIMARY KEY (`id`)
) ENGINE=InnoDB DEFAULT CHARSET=latin1 ROW_FORMAT=COMPACT
......@@ -93,24 +82,16 @@ DROP TABLE t2;
# Only the partitioned table have ROW_FORMAT set.
CREATE TABLE t2 (
id int(11) NOT NULL AUTO_INCREMENT,
year year(2) DEFAULT NULL,
year year DEFAULT NULL,
modified timestamp NOT NULL DEFAULT '0000-00-00 00:00:00',
PRIMARY KEY (id)
) ENGINE=InnoDB;
Warnings:
Level Note
Code 1287
Message 'YEAR(2)' is deprecated and will be removed in a future release. Please use YEAR(4) instead
ALTER TABLE t1 EXCHANGE PARTITION p1 WITH TABLE t2;
Warnings:
Level Note
Code 1287
Message 'YEAR(2)' is deprecated and will be removed in a future release. Please use YEAR(4) instead
SHOW CREATE TABLE t1;
Table t1
Create Table CREATE TABLE `t1` (
`id` int(11) NOT NULL AUTO_INCREMENT,
`year` year(2) DEFAULT NULL,
`year` year(4) DEFAULT NULL,
`modified` timestamp NOT NULL DEFAULT '0000-00-00 00:00:00',
PRIMARY KEY (`id`)
) ENGINE=InnoDB DEFAULT CHARSET=latin1 ROW_FORMAT=COMPACT
......@@ -120,7 +101,7 @@ SHOW CREATE TABLE t2;
Table t2
Create Table CREATE TABLE `t2` (
`id` int(11) NOT NULL AUTO_INCREMENT,
`year` year(2) DEFAULT NULL,
`year` year(4) DEFAULT NULL,
`modified` timestamp NOT NULL DEFAULT '0000-00-00 00:00:00',
PRIMARY KEY (`id`)
) ENGINE=InnoDB DEFAULT CHARSET=latin1
......@@ -142,36 +123,24 @@ CREATE_OPTIONS
DROP TABLE t1, t2;
CREATE TABLE t1 (
id int(11) NOT NULL AUTO_INCREMENT,
year year(2) DEFAULT NULL,
year year DEFAULT NULL,
modified timestamp NOT NULL DEFAULT '0000-00-00 00:00:00',
PRIMARY KEY (id)
) ENGINE=InnoDB
PARTITION BY HASH (id)
PARTITIONS 2;
Warnings:
Level Note
Code 1287
Message 'YEAR(2)' is deprecated and will be removed in a future release. Please use YEAR(4) instead
CREATE TABLE t2 (
id int(11) NOT NULL AUTO_INCREMENT,
year year(2) DEFAULT NULL,
year year DEFAULT NULL,
modified timestamp NOT NULL DEFAULT '0000-00-00 00:00:00',
PRIMARY KEY (id)
) ENGINE=InnoDB ROW_FORMAT = COMPACT;
Warnings:
Level Note
Code 1287
Message 'YEAR(2)' is deprecated and will be removed in a future release. Please use YEAR(4) instead
ALTER TABLE t1 EXCHANGE PARTITION p1 WITH TABLE t2;
Warnings:
Level Note
Code 1287
Message 'YEAR(2)' is deprecated and will be removed in a future release. Please use YEAR(4) instead
SHOW CREATE TABLE t1;
Table t1
Create Table CREATE TABLE `t1` (
`id` int(11) NOT NULL AUTO_INCREMENT,
`year` year(2) DEFAULT NULL,
`year` year(4) DEFAULT NULL,
`modified` timestamp NOT NULL DEFAULT '0000-00-00 00:00:00',
PRIMARY KEY (`id`)
) ENGINE=InnoDB DEFAULT CHARSET=latin1
......@@ -181,7 +150,7 @@ SHOW CREATE TABLE t2;
Table t2
Create Table CREATE TABLE `t2` (
`id` int(11) NOT NULL AUTO_INCREMENT,
`year` year(2) DEFAULT NULL,
`year` year(4) DEFAULT NULL,
`modified` timestamp NOT NULL DEFAULT '0000-00-00 00:00:00',
PRIMARY KEY (`id`)
) ENGINE=InnoDB DEFAULT CHARSET=latin1 ROW_FORMAT=COMPACT
......@@ -203,36 +172,24 @@ CREATE_OPTIONS row_format=COMPACT
DROP TABLE t1, t2;
CREATE TABLE t1 (
id int(11) NOT NULL AUTO_INCREMENT,
year year(2) DEFAULT NULL,
year year DEFAULT NULL,
modified timestamp NOT NULL DEFAULT '0000-00-00 00:00:00',
PRIMARY KEY (id)
) ENGINE=InnoDB
PARTITION BY HASH (id)
PARTITIONS 2;
Warnings:
Level Note
Code 1287
Message 'YEAR(2)' is deprecated and will be removed in a future release. Please use YEAR(4) instead
CREATE TABLE t2 (
id int(11) NOT NULL AUTO_INCREMENT,
year year(2) DEFAULT NULL,
year year DEFAULT NULL,
modified timestamp NOT NULL DEFAULT '0000-00-00 00:00:00',
PRIMARY KEY (id)
) ENGINE=InnoDB;
Warnings:
Level Note
Code 1287
Message 'YEAR(2)' is deprecated and will be removed in a future release. Please use YEAR(4) instead
ALTER TABLE t1 EXCHANGE PARTITION p1 WITH TABLE t2;
Warnings:
Level Note
Code 1287
Message 'YEAR(2)' is deprecated and will be removed in a future release. Please use YEAR(4) instead
SHOW CREATE TABLE t1;
Table t1
Create Table CREATE TABLE `t1` (
`id` int(11) NOT NULL AUTO_INCREMENT,
`year` year(2) DEFAULT NULL,
`year` year(4) DEFAULT NULL,
`modified` timestamp NOT NULL DEFAULT '0000-00-00 00:00:00',
PRIMARY KEY (`id`)
) ENGINE=InnoDB DEFAULT CHARSET=latin1
......@@ -242,7 +199,7 @@ SHOW CREATE TABLE t2;
Table t2
Create Table CREATE TABLE `t2` (
`id` int(11) NOT NULL AUTO_INCREMENT,
`year` year(2) DEFAULT NULL,
`year` year(4) DEFAULT NULL,
`modified` timestamp NOT NULL DEFAULT '0000-00-00 00:00:00',
PRIMARY KEY (`id`)
) ENGINE=InnoDB DEFAULT CHARSET=latin1
......@@ -264,36 +221,24 @@ CREATE_OPTIONS
DROP TABLE t1, t2;
CREATE TABLE t1 (
id int(11) NOT NULL AUTO_INCREMENT,
year year(2) DEFAULT NULL,
year year DEFAULT NULL,
modified timestamp NOT NULL DEFAULT '0000-00-00 00:00:00',
PRIMARY KEY (id)
) ENGINE=InnoDB ROW_FORMAT = REDUNDANT
PARTITION BY HASH (id)
PARTITIONS 2;
Warnings:
Level Note
Code 1287
Message 'YEAR(2)' is deprecated and will be removed in a future release. Please use YEAR(4) instead
CREATE TABLE t2 (
id int(11) NOT NULL AUTO_INCREMENT,
year year(2) DEFAULT NULL,
year year DEFAULT NULL,
modified timestamp NOT NULL DEFAULT '0000-00-00 00:00:00',
PRIMARY KEY (id)
) ENGINE=InnoDB ROW_FORMAT = REDUNDANT;
Warnings:
Level Note
Code 1287
Message 'YEAR(2)' is deprecated and will be removed in a future release. Please use YEAR(4) instead
ALTER TABLE t1 EXCHANGE PARTITION p1 WITH TABLE t2;
Warnings:
Level Note
Code 1287
Message 'YEAR(2)' is deprecated and will be removed in a future release. Please use YEAR(4) instead
SHOW CREATE TABLE t1;
Table t1
Create Table CREATE TABLE `t1` (
`id` int(11) NOT NULL AUTO_INCREMENT,
`year` year(2) DEFAULT NULL,
`year` year(4) DEFAULT NULL,
`modified` timestamp NOT NULL DEFAULT '0000-00-00 00:00:00',
PRIMARY KEY (`id`)
) ENGINE=InnoDB DEFAULT CHARSET=latin1 ROW_FORMAT=REDUNDANT
......@@ -303,7 +248,7 @@ SHOW CREATE TABLE t2;
Table t2
Create Table CREATE TABLE `t2` (
`id` int(11) NOT NULL AUTO_INCREMENT,
`year` year(2) DEFAULT NULL,
`year` year(4) DEFAULT NULL,
`modified` timestamp NOT NULL DEFAULT '0000-00-00 00:00:00',
PRIMARY KEY (`id`)
) ENGINE=InnoDB DEFAULT CHARSET=latin1 ROW_FORMAT=REDUNDANT
......@@ -325,33 +270,25 @@ CREATE_OPTIONS row_format=REDUNDANT
DROP TABLE t1, t2;
CREATE TABLE t1 (
id int(11) NOT NULL AUTO_INCREMENT,
year year(2) DEFAULT NULL,
year year DEFAULT NULL,
modified timestamp NOT NULL DEFAULT '0000-00-00 00:00:00',
PRIMARY KEY (id)
) ENGINE=InnoDB
PARTITION BY HASH (id)
PARTITIONS 2;
Warnings:
Level Note
Code 1287
Message 'YEAR(2)' is deprecated and will be removed in a future release. Please use YEAR(4) instead
CREATE TABLE t2 (
id int(11) NOT NULL AUTO_INCREMENT,
year year(2) DEFAULT NULL,
year year DEFAULT NULL,
modified timestamp NOT NULL DEFAULT '0000-00-00 00:00:00',
PRIMARY KEY (id)
) ENGINE=InnoDB ROW_FORMAT = REDUNDANT;
Warnings:
Level Note
Code 1287
Message 'YEAR(2)' is deprecated and will be removed in a future release. Please use YEAR(4) instead
ALTER TABLE t1 EXCHANGE PARTITION p1 WITH TABLE t2;
ERROR HY000: Non matching attribute 'ROW_FORMAT' between partition and table
SHOW CREATE TABLE t1;
Table t1
Create Table CREATE TABLE `t1` (
`id` int(11) NOT NULL AUTO_INCREMENT,
`year` year(2) DEFAULT NULL,
`year` year(4) DEFAULT NULL,
`modified` timestamp NOT NULL DEFAULT '0000-00-00 00:00:00',
PRIMARY KEY (`id`)
) ENGINE=InnoDB DEFAULT CHARSET=latin1
......@@ -361,7 +298,7 @@ SHOW CREATE TABLE t2;
Table t2
Create Table CREATE TABLE `t2` (
`id` int(11) NOT NULL AUTO_INCREMENT,
`year` year(2) DEFAULT NULL,
`year` year(4) DEFAULT NULL,
`modified` timestamp NOT NULL DEFAULT '0000-00-00 00:00:00',
PRIMARY KEY (`id`)
) ENGINE=InnoDB DEFAULT CHARSET=latin1 ROW_FORMAT=REDUNDANT
......@@ -383,33 +320,25 @@ CREATE_OPTIONS row_format=REDUNDANT
DROP TABLE t1, t2;
CREATE TABLE t1 (
id int(11) NOT NULL AUTO_INCREMENT,
year year(2) DEFAULT NULL,
year year DEFAULT NULL,
modified timestamp NOT NULL DEFAULT '0000-00-00 00:00:00',
PRIMARY KEY (id)
) ENGINE=InnoDB ROW_FORMAT = COMPACT
PARTITION BY HASH (id)
PARTITIONS 2;
Warnings:
Level Note
Code 1287
Message 'YEAR(2)' is deprecated and will be removed in a future release. Please use YEAR(4) instead
CREATE TABLE t2 (
id int(11) NOT NULL AUTO_INCREMENT,
year year(2) DEFAULT NULL,
year year DEFAULT NULL,
modified timestamp NOT NULL DEFAULT '0000-00-00 00:00:00',
PRIMARY KEY (id)
) ENGINE=InnoDB ROW_FORMAT = REDUNDANT;
Warnings:
Level Note
Code 1287
Message 'YEAR(2)' is deprecated and will be removed in a future release. Please use YEAR(4) instead
ALTER TABLE t1 EXCHANGE PARTITION p1 WITH TABLE t2;
ERROR HY000: Non matching attribute 'ROW_FORMAT' between partition and table
SHOW CREATE TABLE t1;
Table t1
Create Table CREATE TABLE `t1` (
`id` int(11) NOT NULL AUTO_INCREMENT,
`year` year(2) DEFAULT NULL,
`year` year(4) DEFAULT NULL,
`modified` timestamp NOT NULL DEFAULT '0000-00-00 00:00:00',
PRIMARY KEY (`id`)
) ENGINE=InnoDB DEFAULT CHARSET=latin1 ROW_FORMAT=COMPACT
......@@ -419,7 +348,7 @@ SHOW CREATE TABLE t2;
Table t2
Create Table CREATE TABLE `t2` (
`id` int(11) NOT NULL AUTO_INCREMENT,
`year` year(2) DEFAULT NULL,
`year` year(4) DEFAULT NULL,
`modified` timestamp NOT NULL DEFAULT '0000-00-00 00:00:00',
PRIMARY KEY (`id`)
) ENGINE=InnoDB DEFAULT CHARSET=latin1 ROW_FORMAT=REDUNDANT
......@@ -1307,3 +1236,6 @@ CREATE TABLE t2 like t1;
ALTER TABLE t2 REMOVE PARTITIONING;
ALTER TABLE t1 EXCHANGE PARTITION pm WITH TABLE t2;
DROP TABLE t1, t2;
#
# End of 10.3 tests
#
--source include/have_innodb.inc
--source include/have_partition.inc
--disable_warnings
DROP TABLE IF EXISTS t1, t2, t3, t, tp, tsp, tmp;
--enable_warnings
--enable_prepare_warnings
--echo #
--echo # Bug#11894100: EXCHANGE PARTITION CAN'T BE EXECUTED IF
--echo # ROW_FORMAT WAS SET EXPLICITLY
......@@ -14,7 +9,7 @@ DROP TABLE IF EXISTS t1, t2, t3, t, tp, tsp, tmp;
--echo # Same definition (both have ROW_FORMAT set)
CREATE TABLE t1 (
id int(11) NOT NULL AUTO_INCREMENT,
year year(2) DEFAULT NULL,
year year DEFAULT NULL,
modified timestamp NOT NULL DEFAULT '0000-00-00 00:00:00',
PRIMARY KEY (id)
) ENGINE=InnoDB ROW_FORMAT=COMPACT
......@@ -46,7 +41,7 @@ DROP TABLE t2;
--echo # Only the partitioned table have ROW_FORMAT set.
CREATE TABLE t2 (
id int(11) NOT NULL AUTO_INCREMENT,
year year(2) DEFAULT NULL,
year year DEFAULT NULL,
modified timestamp NOT NULL DEFAULT '0000-00-00 00:00:00',
PRIMARY KEY (id)
) ENGINE=InnoDB;
......@@ -63,7 +58,7 @@ ORDER BY TABLE_NAME;
DROP TABLE t1, t2;
CREATE TABLE t1 (
id int(11) NOT NULL AUTO_INCREMENT,
year year(2) DEFAULT NULL,
year year DEFAULT NULL,
modified timestamp NOT NULL DEFAULT '0000-00-00 00:00:00',
PRIMARY KEY (id)
) ENGINE=InnoDB
......@@ -71,7 +66,7 @@ PARTITION BY HASH (id)
PARTITIONS 2;
CREATE TABLE t2 (
id int(11) NOT NULL AUTO_INCREMENT,
year year(2) DEFAULT NULL,
year year DEFAULT NULL,
modified timestamp NOT NULL DEFAULT '0000-00-00 00:00:00',
PRIMARY KEY (id)
) ENGINE=InnoDB ROW_FORMAT = COMPACT;
......@@ -88,7 +83,7 @@ ORDER BY TABLE_NAME;
DROP TABLE t1, t2;
CREATE TABLE t1 (
id int(11) NOT NULL AUTO_INCREMENT,
year year(2) DEFAULT NULL,
year year DEFAULT NULL,
modified timestamp NOT NULL DEFAULT '0000-00-00 00:00:00',
PRIMARY KEY (id)
) ENGINE=InnoDB
......@@ -96,7 +91,7 @@ PARTITION BY HASH (id)
PARTITIONS 2;
CREATE TABLE t2 (
id int(11) NOT NULL AUTO_INCREMENT,
year year(2) DEFAULT NULL,
year year DEFAULT NULL,
modified timestamp NOT NULL DEFAULT '0000-00-00 00:00:00',
PRIMARY KEY (id)
) ENGINE=InnoDB;
......@@ -113,7 +108,7 @@ ORDER BY TABLE_NAME;
DROP TABLE t1, t2;
CREATE TABLE t1 (
id int(11) NOT NULL AUTO_INCREMENT,
year year(2) DEFAULT NULL,
year year DEFAULT NULL,
modified timestamp NOT NULL DEFAULT '0000-00-00 00:00:00',
PRIMARY KEY (id)
) ENGINE=InnoDB ROW_FORMAT = REDUNDANT
......@@ -121,7 +116,7 @@ PARTITION BY HASH (id)
PARTITIONS 2;
CREATE TABLE t2 (
id int(11) NOT NULL AUTO_INCREMENT,
year year(2) DEFAULT NULL,
year year DEFAULT NULL,
modified timestamp NOT NULL DEFAULT '0000-00-00 00:00:00',
PRIMARY KEY (id)
) ENGINE=InnoDB ROW_FORMAT = REDUNDANT;
......@@ -138,7 +133,7 @@ ORDER BY TABLE_NAME;
DROP TABLE t1, t2;
CREATE TABLE t1 (
id int(11) NOT NULL AUTO_INCREMENT,
year year(2) DEFAULT NULL,
year year DEFAULT NULL,
modified timestamp NOT NULL DEFAULT '0000-00-00 00:00:00',
PRIMARY KEY (id)
) ENGINE=InnoDB
......@@ -146,7 +141,7 @@ PARTITION BY HASH (id)
PARTITIONS 2;
CREATE TABLE t2 (
id int(11) NOT NULL AUTO_INCREMENT,
year year(2) DEFAULT NULL,
year year DEFAULT NULL,
modified timestamp NOT NULL DEFAULT '0000-00-00 00:00:00',
PRIMARY KEY (id)
) ENGINE=InnoDB ROW_FORMAT = REDUNDANT;
......@@ -164,7 +159,7 @@ ORDER BY TABLE_NAME;
DROP TABLE t1, t2;
CREATE TABLE t1 (
id int(11) NOT NULL AUTO_INCREMENT,
year year(2) DEFAULT NULL,
year year DEFAULT NULL,
modified timestamp NOT NULL DEFAULT '0000-00-00 00:00:00',
PRIMARY KEY (id)
) ENGINE=InnoDB ROW_FORMAT = COMPACT
......@@ -172,7 +167,7 @@ PARTITION BY HASH (id)
PARTITIONS 2;
CREATE TABLE t2 (
id int(11) NOT NULL AUTO_INCREMENT,
year year(2) DEFAULT NULL,
year year DEFAULT NULL,
modified timestamp NOT NULL DEFAULT '0000-00-00 00:00:00',
PRIMARY KEY (id)
) ENGINE=InnoDB ROW_FORMAT = REDUNDANT;
......@@ -537,4 +532,6 @@ ALTER TABLE t2 REMOVE PARTITIONING;
ALTER TABLE t1 EXCHANGE PARTITION pm WITH TABLE t2;
DROP TABLE t1, t2;
--disable_prepare_warnings
--echo #
--echo # End of 10.3 tests
--echo #
......@@ -7019,10 +7019,8 @@ static void update_altered_table(const Alter_inplace_info &ha_alter_info,
@retval false success
*/
bool mysql_compare_tables(TABLE *table,
Alter_info *alter_info,
HA_CREATE_INFO *create_info,
bool *metadata_equal)
bool mysql_compare_tables(TABLE *table, Alter_info *alter_info,
HA_CREATE_INFO *create_info, bool *metadata_equal)
{
DBUG_ENTER("mysql_compare_tables");
......@@ -7047,15 +7045,14 @@ bool mysql_compare_tables(TABLE *table,
Alter_info tmp_alter_info(*alter_info, thd->mem_root);
uint db_options= 0; /* not used */
KEY *key_info_buffer= NULL;
LEX_CSTRING db= { table->s->db.str, table->s->db.length };
LEX_CSTRING table_name= { table->s->db.str, table->s->table_name.length };
/* Create the prepared information. */
int create_table_mode= table->s->tmp_table == NO_TMP_TABLE ?
C_ORDINARY_CREATE : C_ALTER_TABLE;
if (mysql_prepare_create_table(thd, create_info, &tmp_alter_info,
&db_options, table->file, &key_info_buffer,
&key_count, create_table_mode, db, table_name))
&key_count, create_table_mode,
table->s->db, table->s->table_name))
DBUG_RETURN(1);
/* Some very basic checks. */
......
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