mirror of
https://github.com/MariaDB/server.git
synced 2025-02-01 11:31:51 +01:00
branches/zip: Add changes that accidentally omitted from r1698:
innodb-index.test, innodb-index.result: Add a test for creating a PRIMARY KEY on a column that contains a NULL value.
This commit is contained in:
parent
99fbb51034
commit
56c41b1386
2 changed files with 10 additions and 0 deletions
|
@ -940,6 +940,7 @@ drop table t1;
|
|||
create table t1(a int, b blob, c text, d text not null) engine=innodb default charset = utf8;
|
||||
insert into t1 values (22,repeat('jejdkrun87',220),repeat('jejdkrun87',440),'jejdkrun87');
|
||||
insert into t1 values (44,repeat('adfd72nh9k',440),repeat('adfd72nh9k',880),'adfd72nh9k');
|
||||
insert into t1 values (null,null,null,'null');
|
||||
select count(*) from t1 where a=44;
|
||||
count(*)
|
||||
1
|
||||
|
@ -947,10 +948,15 @@ select a,b=repeat(d,10*a),c=repeat(d,20*a) from t1;
|
|||
a b=repeat(d,10*a) c=repeat(d,20*a)
|
||||
22 1 1
|
||||
44 1 1
|
||||
NULL NULL NULL
|
||||
select a,length(b),length(c),d from t1;
|
||||
a length(b) length(c) d
|
||||
22 2200 4400 jejdkrun87
|
||||
44 4400 8800 adfd72nh9k
|
||||
NULL NULL NULL null
|
||||
alter table t1 add primary key (a), add key (b(20));
|
||||
ERROR 42000: All parts of a PRIMARY KEY must be NOT NULL; if you need NULL in a key, use UNIQUE instead
|
||||
delete from t1 where d='null';
|
||||
alter table t1 add primary key (a), add key (b(20));
|
||||
select count(*) from t1 where a=44;
|
||||
count(*)
|
||||
|
|
|
@ -270,10 +270,14 @@ drop table t1;
|
|||
create table t1(a int, b blob, c text, d text not null) engine=innodb default charset = utf8;
|
||||
insert into t1 values (22,repeat('jejdkrun87',220),repeat('jejdkrun87',440),'jejdkrun87');
|
||||
insert into t1 values (44,repeat('adfd72nh9k',440),repeat('adfd72nh9k',880),'adfd72nh9k');
|
||||
insert into t1 values (null,null,null,'null');
|
||||
|
||||
select count(*) from t1 where a=44;
|
||||
select a,b=repeat(d,10*a),c=repeat(d,20*a) from t1;
|
||||
select a,length(b),length(c),d from t1;
|
||||
--error ER_PRIMARY_CANT_HAVE_NULL
|
||||
alter table t1 add primary key (a), add key (b(20));
|
||||
delete from t1 where d='null';
|
||||
alter table t1 add primary key (a), add key (b(20));
|
||||
select count(*) from t1 where a=44;
|
||||
select a,b=repeat(d,10*a),c=repeat(d,20*a) from t1;
|
||||
|
|
Loading…
Add table
Reference in a new issue