From 5317b07a9be08427f32f930acaedf83c20eea8ff Mon Sep 17 00:00:00 2001 From: marko Date: Fri, 10 Mar 2006 14:26:08 +0000 Subject: [PATCH] Merge changes from MySQL that were identified when merging r269 to MySQL. --- handler/ha_innodb.cc | 10 +++- mysql-test/innodb.result | 97 +++++++++++++++--------------------- mysql-test/innodb.test | 29 ++--------- mysql-test/innodb_gis.result | 58 +++++++++++---------- 4 files changed, 81 insertions(+), 113 deletions(-) diff --git a/handler/ha_innodb.cc b/handler/ha_innodb.cc index 80290a0de82..1f849f89272 100644 --- a/handler/ha_innodb.cc +++ b/handler/ha_innodb.cc @@ -231,7 +231,13 @@ handlerton innobase_hton = { innobase_start_trx_and_assign_read_view, /* Start Consistent Snapshot */ innobase_flush_logs, /* Flush logs */ innobase_show_status, /* Show status */ - HTON_NO_FLAGS + NULL, /* Partition flags */ + NULL, /* Alter table flags */ + NULL, /* alter_tablespace */ + NULL, /* Fill FILES table */ + HTON_NO_FLAGS, + NULL, /* binlog_func */ + NULL /* binlog_log_query */ }; @@ -5794,7 +5800,7 @@ ha_innobase::analyze( } /************************************************************************** -This is mapped to "ALTER TABLE tablename TYPE=InnoDB", which rebuilds +This is mapped to "ALTER TABLE tablename ENGINE=InnoDB", which rebuilds the table in MySQL. */ int diff --git a/mysql-test/innodb.result b/mysql-test/innodb.result index 564bf37015b..de2fbb3c295 100644 --- a/mysql-test/innodb.result +++ b/mysql-test/innodb.result @@ -856,7 +856,7 @@ create table t1 (a char(20), index (a(5))) engine=innodb; show create table t1; Table Create Table t1 CREATE TABLE `t1` ( - `a` char(20) default NULL, + `a` char(20) DEFAULT NULL, KEY `a` (`a`(5)) ) ENGINE=InnoDB DEFAULT CHARSET=latin1 drop table t1; @@ -1587,7 +1587,7 @@ create table t2 (id int(11) not null auto_increment, id2 int(11) not null, const show create table t2; Table Create Table t2 CREATE TABLE `t2` ( - `id` int(11) NOT NULL auto_increment, + `id` int(11) NOT NULL AUTO_INCREMENT, `id2` int(11) NOT NULL, PRIMARY KEY (`id`), KEY `id` (`id`,`id2`), @@ -1598,7 +1598,7 @@ create table t2 (id int(11) not null auto_increment, id2 int(11) not null, const show create table t2; Table Create Table t2 CREATE TABLE `t2` ( - `id` int(11) NOT NULL auto_increment, + `id` int(11) NOT NULL AUTO_INCREMENT, `id2` int(11) NOT NULL, KEY `t1_id_fk` (`id`), CONSTRAINT `t1_id_fk` FOREIGN KEY (`id`) REFERENCES `t1` (`id`) @@ -1607,7 +1607,7 @@ alter table t2 add index id_test (id), add index id_test2 (id,id2); show create table t2; Table Create Table t2 CREATE TABLE `t2` ( - `id` int(11) NOT NULL auto_increment, + `id` int(11) NOT NULL AUTO_INCREMENT, `id2` int(11) NOT NULL, KEY `id_test` (`id`), KEY `id_test2` (`id`,`id2`), @@ -1620,8 +1620,8 @@ create table t2 (a int auto_increment primary key, b int, index(b), foreign key show create table t2; Table Create Table t2 CREATE TABLE `t2` ( - `a` int(11) NOT NULL auto_increment, - `b` int(11) default NULL, + `a` int(11) NOT NULL AUTO_INCREMENT, + `b` int(11) DEFAULT NULL, PRIMARY KEY (`a`), UNIQUE KEY `b_2` (`b`), KEY `b` (`b`), @@ -1632,8 +1632,8 @@ create table t2 (a int auto_increment primary key, b int, foreign key (b) refere show create table t2; Table Create Table t2 CREATE TABLE `t2` ( - `a` int(11) NOT NULL auto_increment, - `b` int(11) default NULL, + `a` int(11) NOT NULL AUTO_INCREMENT, + `b` int(11) DEFAULT NULL, PRIMARY KEY (`a`), UNIQUE KEY `b` (`b`), CONSTRAINT `t2_ibfk_1` FOREIGN KEY (`b`) REFERENCES `t1` (`id`), @@ -1843,40 +1843,40 @@ concat('*',v,'*',c,'*',t,'*') show create table t1; Table Create Table t1 CREATE TABLE `t1` ( - `v` varchar(10) default NULL, - `c` char(10) default NULL, + `v` varchar(10) DEFAULT NULL, + `c` char(10) DEFAULT NULL, `t` text ) ENGINE=InnoDB DEFAULT CHARSET=latin1 create table t2 like t1; show create table t2; Table Create Table t2 CREATE TABLE `t2` ( - `v` varchar(10) default NULL, - `c` char(10) default NULL, + `v` varchar(10) DEFAULT NULL, + `c` char(10) DEFAULT NULL, `t` text ) ENGINE=InnoDB DEFAULT CHARSET=latin1 create table t3 select * from t1; show create table t3; Table Create Table t3 CREATE TABLE `t3` ( - `v` varchar(10) default NULL, - `c` char(10) default NULL, + `v` varchar(10) DEFAULT NULL, + `c` char(10) DEFAULT NULL, `t` text ) ENGINE=InnoDB DEFAULT CHARSET=latin1 alter table t1 modify c varchar(10); show create table t1; Table Create Table t1 CREATE TABLE `t1` ( - `v` varchar(10) default NULL, - `c` varchar(10) default NULL, + `v` varchar(10) DEFAULT NULL, + `c` varchar(10) DEFAULT NULL, `t` text ) ENGINE=InnoDB DEFAULT CHARSET=latin1 alter table t1 modify v char(10); show create table t1; Table Create Table t1 CREATE TABLE `t1` ( - `v` char(10) default NULL, - `c` varchar(10) default NULL, + `v` char(10) DEFAULT NULL, + `c` varchar(10) DEFAULT NULL, `t` text ) ENGINE=InnoDB DEFAULT CHARSET=latin1 alter table t1 modify t varchar(10); @@ -1885,9 +1885,9 @@ Note 1265 Data truncated for column 't' at row 2 show create table t1; Table Create Table t1 CREATE TABLE `t1` ( - `v` char(10) default NULL, - `c` varchar(10) default NULL, - `t` varchar(10) default NULL + `v` char(10) DEFAULT NULL, + `c` varchar(10) DEFAULT NULL, + `t` varchar(10) DEFAULT NULL ) ENGINE=InnoDB DEFAULT CHARSET=latin1 select concat('*',v,'*',c,'*',t,'*') from t1; concat('*',v,'*',c,'*',t,'*') @@ -1898,8 +1898,8 @@ create table t1 (v varchar(10), c char(10), t text, key(v), key(c), key(t(10))); show create table t1; Table Create Table t1 CREATE TABLE `t1` ( - `v` varchar(10) default NULL, - `c` char(10) default NULL, + `v` varchar(10) DEFAULT NULL, + `c` char(10) DEFAULT NULL, `t` text, KEY `v` (`v`), KEY `c` (`c`), @@ -2117,8 +2117,8 @@ alter table t1 modify v varchar(300), drop key v, drop key v_2, add key v (v); show create table t1; Table Create Table t1 CREATE TABLE `t1` ( - `v` varchar(300) default NULL, - `c` char(10) default NULL, + `v` varchar(300) DEFAULT NULL, + `c` char(10) DEFAULT NULL, `t` text, KEY `c` (`c`), KEY `t` (`t`(10)), @@ -2197,8 +2197,8 @@ alter table t1 drop key v, add key v (v(30)); show create table t1; Table Create Table t1 CREATE TABLE `t1` ( - `v` varchar(300) default NULL, - `c` char(10) default NULL, + `v` varchar(300) DEFAULT NULL, + `c` char(10) DEFAULT NULL, `t` text, KEY `c` (`c`), KEY `t` (`t`(10)), @@ -2277,8 +2277,8 @@ alter table t1 modify v varchar(600), drop key v, add key v (v); show create table t1; Table Create Table t1 CREATE TABLE `t1` ( - `v` varchar(600) default NULL, - `c` char(10) default NULL, + `v` varchar(600) DEFAULT NULL, + `c` char(10) DEFAULT NULL, `t` text, KEY `c` (`c`), KEY `t` (`t`(10)), @@ -2355,8 +2355,8 @@ create table t1 (v varchar(10), c char(10), t text, key(v(5)), key(c(5)), key(t( show create table t1; Table Create Table t1 CREATE TABLE `t1` ( - `v` varchar(10) default NULL, - `c` char(10) default NULL, + `v` varchar(10) DEFAULT NULL, + `c` char(10) DEFAULT NULL, `t` text, KEY `v` (`v`(5)), KEY `c` (`c`(5)), @@ -2367,15 +2367,15 @@ create table t1 (v char(10) character set utf8); show create table t1; Table Create Table t1 CREATE TABLE `t1` ( - `v` char(10) character set utf8 default NULL + `v` char(10) CHARACTER SET utf8 DEFAULT NULL ) ENGINE=InnoDB DEFAULT CHARSET=latin1 drop table t1; create table t1 (v varchar(10), c char(10)) row_format=fixed; show create table t1; Table Create Table t1 CREATE TABLE `t1` ( - `v` varchar(10) default NULL, - `c` char(10) default NULL + `v` varchar(10) DEFAULT NULL, + `c` char(10) DEFAULT NULL ) ENGINE=InnoDB DEFAULT CHARSET=latin1 ROW_FORMAT=FIXED insert into t1 values('a','a'),('a ','a '); select concat('*',v,'*',c,'*') from t1; @@ -2417,7 +2417,7 @@ Note 1246 Converting column 'v' from VARCHAR to TEXT show create table t1; Table Create Table t1 CREATE TABLE `t1` ( - `v` mediumtext character set utf8 + `v` mediumtext CHARACTER SET utf8 ) ENGINE=InnoDB DEFAULT CHARSET=latin1 drop table t1; set storage_engine=MyISAM; @@ -2544,8 +2544,8 @@ character set = latin1 engine = innodb; show create table t9; Table Create Table t9 CREATE TABLE `t9` ( - `col1` varchar(512) default NULL, - `col2` varchar(512) default NULL, + `col1` varchar(512) DEFAULT NULL, + `col2` varchar(512) DEFAULT NULL, KEY `col1` (`col1`,`col2`) ) ENGINE=InnoDB DEFAULT CHARSET=latin1 drop table t1, t2, t3, t4, t5, t6, t7, t8, t9; @@ -2568,7 +2568,7 @@ Warning 1071 Specified key was too long; max key length is 767 bytes show create table t1; Table Create Table t1 CREATE TABLE `t1` ( - `col1` varchar(768) default NULL, + `col1` varchar(768) DEFAULT NULL, KEY `col1` (`col1`(767)) ) ENGINE=InnoDB DEFAULT CHARSET=latin1 drop table t1, t2, t3, t4; @@ -2635,25 +2635,6 @@ checksum table t1; Table Checksum test.t1 2050879373 drop table t1; -create table t1 (col1 integer primary key, col2 integer) engine=innodb; -insert t1 values (1,100); -create function f1 () returns integer begin -declare var1 int; -select col2 into var1 from t1 where col1=1 for update; -return var1; -end| -start transaction; -select f1(); -f1() -100 - update t1 set col2=0 where col1=1; -select * from t1; -col1 col2 -1 100 -rollback; -rollback; -drop table t1; -drop function f1; create table t1 ( a int, b char(10), c char(10), filler char(10), primary key(a, b(2)), unique key (a, c(2)) ) character set utf8 engine = innodb; @@ -3151,7 +3132,7 @@ ALTER TABLE t2 DROP FOREIGN KEY t2_ibfk_0; SHOW CREATE TABLE t2; Table Create Table t2 CREATE TABLE `t2` ( - `a` int(11) default NULL, + `a` int(11) DEFAULT NULL, KEY `t2_ibfk_0` (`a`), CONSTRAINT `t2_ibfk_0` FOREIGN KEY (`a`) REFERENCES `t1` (`a`), CONSTRAINT `t2_ibfk_1` FOREIGN KEY (`a`) REFERENCES `t1` (`a`) diff --git a/mysql-test/innodb.test b/mysql-test/innodb.test index e38effd774e..27d9814404d 100644 --- a/mysql-test/innodb.test +++ b/mysql-test/innodb.test @@ -1576,33 +1576,7 @@ connection a; checksum table t1; drop table t1; -# -# BUG#11238 - in prelocking mode SELECT .. FOR UPDATE is changed to -# non-blocking SELECT -# -create table t1 (col1 integer primary key, col2 integer) engine=innodb; -insert t1 values (1,100); -delimiter |; -create function f1 () returns integer begin -declare var1 int; -select col2 into var1 from t1 where col1=1 for update; -return var1; -end| -delimiter ;| -start transaction; -select f1(); -connection b; -send update t1 set col2=0 where col1=1; connection default; -select * from t1; -connection a; -rollback; -connection b; -reap; -rollback; -connection default; -drop table t1; -drop function f1; disconnect a; disconnect b; @@ -1745,6 +1719,7 @@ commit; set foreign_key_checks=0; create table t2 (a int primary key, b int, foreign key (b) references t1(a)) engine = innodb; +--replace_result $MYSQLTEST_VARDIR . master-data/ '' -- error 1005 create table t1(a char(10) primary key, b varchar(20)) engine = innodb; set foreign_key_checks=1; @@ -1755,6 +1730,7 @@ drop table t2; set foreign_key_checks=0; create table t1(a varchar(10) primary key) engine = innodb DEFAULT CHARSET=latin1; +--replace_result $MYSQLTEST_VARDIR . master-data/ '' -- error 1005 create table t2 (a varchar(10), foreign key (a) references t1(a)) engine = innodb DEFAULT CHARSET=utf8; set foreign_key_checks=1; @@ -1784,6 +1760,7 @@ drop table t2,t1; set foreign_key_checks=0; create table t2 (a varchar(10), foreign key (a) references t1(a)) engine = innodb DEFAULT CHARSET=latin1; create table t3(a varchar(10) primary key) engine = innodb DEFAULT CHARSET=utf8; +--replace_result $MYSQLTEST_VARDIR . master-data/ '' -- error 1025 rename table t3 to t1; set foreign_key_checks=1; diff --git a/mysql-test/innodb_gis.result b/mysql-test/innodb_gis.result index 826a17cb60d..0222c462923 100644 --- a/mysql-test/innodb_gis.result +++ b/mysql-test/innodb_gis.result @@ -1,50 +1,51 @@ SET storage_engine=innodb; DROP TABLE IF EXISTS t1, gis_point, gis_line, gis_polygon, gis_multi_point, gis_multi_line, gis_multi_polygon, gis_geometrycollection, gis_geometry; -CREATE TABLE gis_point (fid INTEGER, g POINT); -CREATE TABLE gis_line (fid INTEGER, g LINESTRING); -CREATE TABLE gis_polygon (fid INTEGER, g POLYGON); -CREATE TABLE gis_multi_point (fid INTEGER, g MULTIPOINT); -CREATE TABLE gis_multi_line (fid INTEGER, g MULTILINESTRING); -CREATE TABLE gis_multi_polygon (fid INTEGER, g MULTIPOLYGON); -CREATE TABLE gis_geometrycollection (fid INTEGER, g GEOMETRYCOLLECTION); -CREATE TABLE gis_geometry (fid INTEGER, g GEOMETRY); +CREATE TABLE gis_point (fid INTEGER PRIMARY KEY AUTO_INCREMENT, g POINT); +CREATE TABLE gis_line (fid INTEGER PRIMARY KEY AUTO_INCREMENT, g LINESTRING); +CREATE TABLE gis_polygon (fid INTEGER PRIMARY KEY AUTO_INCREMENT, g POLYGON); +CREATE TABLE gis_multi_point (fid INTEGER PRIMARY KEY AUTO_INCREMENT, g MULTIPOINT); +CREATE TABLE gis_multi_line (fid INTEGER PRIMARY KEY AUTO_INCREMENT, g MULTILINESTRING); +CREATE TABLE gis_multi_polygon (fid INTEGER PRIMARY KEY AUTO_INCREMENT, g MULTIPOLYGON); +CREATE TABLE gis_geometrycollection (fid INTEGER PRIMARY KEY AUTO_INCREMENT, g GEOMETRYCOLLECTION); +CREATE TABLE gis_geometry (fid INTEGER PRIMARY KEY AUTO_INCREMENT, g GEOMETRY); SHOW CREATE TABLE gis_point; Table Create Table gis_point CREATE TABLE `gis_point` ( - `fid` int(11) default NULL, - `g` point default NULL + `fid` int(11) NOT NULL AUTO_INCREMENT, + `g` point DEFAULT NULL, + PRIMARY KEY (`fid`) ) ENGINE=InnoDB DEFAULT CHARSET=latin1 SHOW FIELDS FROM gis_point; Field Type Null Key Default Extra -fid int(11) YES NULL +fid int(11) NO PRI NULL auto_increment g point YES NULL SHOW FIELDS FROM gis_line; Field Type Null Key Default Extra -fid int(11) YES NULL +fid int(11) NO PRI NULL auto_increment g linestring YES NULL SHOW FIELDS FROM gis_polygon; Field Type Null Key Default Extra -fid int(11) YES NULL +fid int(11) NO PRI NULL auto_increment g polygon YES NULL SHOW FIELDS FROM gis_multi_point; Field Type Null Key Default Extra -fid int(11) YES NULL +fid int(11) NO PRI NULL auto_increment g multipoint YES NULL SHOW FIELDS FROM gis_multi_line; Field Type Null Key Default Extra -fid int(11) YES NULL +fid int(11) NO PRI NULL auto_increment g multilinestring YES NULL SHOW FIELDS FROM gis_multi_polygon; Field Type Null Key Default Extra -fid int(11) YES NULL +fid int(11) NO PRI NULL auto_increment g multipolygon YES NULL SHOW FIELDS FROM gis_geometrycollection; Field Type Null Key Default Extra -fid int(11) YES NULL +fid int(11) NO PRI NULL auto_increment g geometrycollection YES NULL SHOW FIELDS FROM gis_geometry; Field Type Null Key Default Extra -fid int(11) YES NULL +fid int(11) NO PRI NULL auto_increment g geometry YES NULL INSERT INTO gis_point VALUES (101, PointFromText('POINT(10 10)')), @@ -407,6 +408,7 @@ Warnings: Note 1003 select `test`.`g1`.`fid` AS `first`,`test`.`g2`.`fid` AS `second`,within(`test`.`g1`.`g`,`test`.`g2`.`g`) AS `w`,contains(`test`.`g1`.`g`,`test`.`g2`.`g`) AS `c`,overlaps(`test`.`g1`.`g`,`test`.`g2`.`g`) AS `o`,equals(`test`.`g1`.`g`,`test`.`g2`.`g`) AS `e`,disjoint(`test`.`g1`.`g`,`test`.`g2`.`g`) AS `d`,touches(`test`.`g1`.`g`,`test`.`g2`.`g`) AS `t`,intersects(`test`.`g1`.`g`,`test`.`g2`.`g`) AS `i`,crosses(`test`.`g1`.`g`,`test`.`g2`.`g`) AS `r` from `test`.`gis_geometrycollection` `g1` join `test`.`gis_geometrycollection` `g2` order by `test`.`g1`.`fid`,`test`.`g2`.`fid` DROP TABLE gis_point, gis_line, gis_polygon, gis_multi_point, gis_multi_line, gis_multi_polygon, gis_geometrycollection, gis_geometry; CREATE TABLE t1 ( +a INTEGER PRIMARY KEY AUTO_INCREMENT, gp point, ln linestring, pg polygon, @@ -418,6 +420,7 @@ gm geometry ); SHOW FIELDS FROM t1; Field Type Null Key Default Extra +a int(11) NO PRI NULL auto_increment gp point YES NULL ln linestring YES NULL pg polygon YES NULL @@ -429,6 +432,7 @@ gm geometry YES NULL ALTER TABLE t1 ADD fid INT; SHOW FIELDS FROM t1; Field Type Null Key Default Extra +a int(11) NO PRI NULL auto_increment gp point YES NULL ln linestring YES NULL pg polygon YES NULL @@ -439,20 +443,20 @@ gc geometrycollection YES NULL gm geometry YES NULL fid int(11) YES NULL DROP TABLE t1; -create table t1 (a geometry not null); -insert into t1 values (GeomFromText('Point(1 2)')); -insert into t1 values ('Garbage'); +create table t1 (pk integer primary key auto_increment, a geometry not null); +insert into t1 (a) values (GeomFromText('Point(1 2)')); +insert into t1 (a) values ('Garbage'); ERROR 22003: Cannot get geometry object from data you send to the GEOMETRY field -insert IGNORE into t1 values ('Garbage'); +insert IGNORE into t1 (a) values ('Garbage'); ERROR 22003: Cannot get geometry object from data you send to the GEOMETRY field drop table t1; -create table t1 (fl geometry); -insert into t1 values (1); +create table t1 (pk integer primary key auto_increment, fl geometry); +insert into t1 (fl) values (1); ERROR 22003: Cannot get geometry object from data you send to the GEOMETRY field -insert into t1 values (1.11); +insert into t1 (fl) values (1.11); ERROR 22003: Cannot get geometry object from data you send to the GEOMETRY field -insert into t1 values ("qwerty"); +insert into t1 (fl) values ("qwerty"); ERROR 22003: Cannot get geometry object from data you send to the GEOMETRY field -insert into t1 values (pointfromtext('point(1,1)')); +insert into t1 (fl) values (pointfromtext('point(1,1)')); ERROR 22003: Cannot get geometry object from data you send to the GEOMETRY field drop table t1;