diff options
author | unknown <vva@eagle.mysql.r18.ru> | 2004-03-14 01:33:16 +0400 |
---|---|---|
committer | unknown <vva@eagle.mysql.r18.ru> | 2004-03-14 01:33:16 +0400 |
commit | 4db4cb6665a0ab88f531da1ad6b4727ba0c95377 (patch) | |
tree | c056a2cc038a9bb7e90b926bd98c44a4cfa0508b /mysql-test | |
parent | dcd3a0f2ea353fae2bab96888bccb8b3b2038ca0 (diff) | |
parent | b9793c5473f7a0b2a2b011d0897ba2667450a91c (diff) | |
download | mariadb-git-4db4cb6665a0ab88f531da1ad6b4727ba0c95377.tar.gz |
Merge vvagin@bk-internal.mysql.com:/home/bk/mysql-4.1
into eagle.mysql.r18.ru:/home/vva/work/BUG_856/mysql-4.1
mysql-test/r/create.result:
Auto merged
mysql-test/t/create.test:
Auto merged
sql/sql_table.cc:
Auto merged
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 fa44cbae0ee..b65c8b284b3 100644 --- a/mysql-test/r/create.result +++ b/mysql-test/r/create.result @@ -482,3 +482,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 516facb029e..bd629552924 100644 --- a/mysql-test/t/create.test +++ b/mysql-test/t/create.test @@ -368,3 +368,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; |