diff options
author | unknown <vva@eagle.mysql.r18.ru> | 2004-03-14 01:31:30 +0400 |
---|---|---|
committer | unknown <vva@eagle.mysql.r18.ru> | 2004-03-14 01:31:30 +0400 |
commit | b9793c5473f7a0b2a2b011d0897ba2667450a91c (patch) | |
tree | fb0387ba3be89722d2976971f7b30de9a601a4b5 /mysql-test | |
parent | 8b11f1c10620b40c9fa654f3738daeab4369f8b6 (diff) | |
download | mariadb-git-b9793c5473f7a0b2a2b011d0897ba2667450a91c.tar.gz |
fixed bug #856 'Naming a key "Primary" causes trouble'
mysql-test/r/create.result:
added test for bug #856 'Naming a key "Primary" causes trouble'
mysql-test/t/create.test:
added test for bug #856 'Naming a key "Primary" causes trouble'
Diffstat (limited to 'mysql-test')
-rw-r--r-- | mysql-test/r/create.result | 41 | ||||
-rw-r--r-- | mysql-test/t/create.test | 30 |
2 files changed, 71 insertions, 0 deletions
diff --git a/mysql-test/r/create.result b/mysql-test/r/create.result index 4cb57a43cf3..d9eccbcf27e 100644 --- a/mysql-test/r/create.result +++ b/mysql-test/r/create.result @@ -468,3 +468,44 @@ NULL select database(); database() NULL +use test; +create table t1 (a int, index `primary` (a)); +ERROR 42000: Incorrect index name 'primary' +create table t1 (a int, index `PRIMARY` (a)); +ERROR 42000: Incorrect index name 'PRIMARY' +create table t1 (`primary` int, index(`primary`)); +show create table t1; +Table Create Table +t1 CREATE TABLE `t1` ( + `primary` int(11) default NULL, + KEY `primary_2` (`primary`) +) ENGINE=MyISAM DEFAULT CHARSET=latin1 +create table t2 (`PRIMARY` int, index(`PRIMARY`)); +show create table t2; +Table Create Table +t2 CREATE TABLE `t2` ( + `PRIMARY` int(11) default NULL, + KEY `PRIMARY_2` (`PRIMARY`) +) ENGINE=MyISAM DEFAULT CHARSET=latin1 +create table t3 (a int); +alter table t3 add index `primary` (a); +ERROR 42000: Incorrect index name 'primary' +alter table t3 add index `PRIMARY` (a); +ERROR 42000: Incorrect index name 'PRIMARY' +create table t4 (`primary` int); +alter table t4 add index(`primary`); +show create table t4; +Table Create Table +t4 CREATE TABLE `t4` ( + `primary` int(11) default NULL, + KEY `primary_2` (`primary`) +) ENGINE=MyISAM DEFAULT CHARSET=latin1 +create table t5 (`PRIMARY` int); +alter table t5 add index(`PRIMARY`); +show create table t5; +Table Create Table +t5 CREATE TABLE `t5` ( + `PRIMARY` int(11) default NULL, + KEY `PRIMARY_2` (`PRIMARY`) +) ENGINE=MyISAM DEFAULT CHARSET=latin1 +drop table t1, t2, t3, t4, t5; diff --git a/mysql-test/t/create.test b/mysql-test/t/create.test index 70fa4173c76..fedd82356f9 100644 --- a/mysql-test/t/create.test +++ b/mysql-test/t/create.test @@ -359,3 +359,33 @@ select database(); # Connect without a database connect (user4,localhost,mysqltest_1,,*NO-ONE*); select database(); + +# +# Test for Bug 856 'Naming a key "Primary" causes trouble' +# + +use test; +--error 1280 +create table t1 (a int, index `primary` (a)); +--error 1280 +create table t1 (a int, index `PRIMARY` (a)); + +create table t1 (`primary` int, index(`primary`)); +show create table t1; +create table t2 (`PRIMARY` int, index(`PRIMARY`)); +show create table t2; + +create table t3 (a int); +--error 1280 +alter table t3 add index `primary` (a); +--error 1280 +alter table t3 add index `PRIMARY` (a); + +create table t4 (`primary` int); +alter table t4 add index(`primary`); +show create table t4; +create table t5 (`PRIMARY` int); +alter table t5 add index(`PRIMARY`); +show create table t5; + +drop table t1, t2, t3, t4, t5; |