mirror of
https://github.com/MariaDB/server.git
synced 2025-07-30 16:24:05 +03:00
Merge mysql.com:/home/pz/mysql/mysql-4.1-root
into mysql.com:/home/pz/mysql/mysql-4.1 sql/mysql_priv.h: Auto merged
This commit is contained in:
@ -139,14 +139,14 @@ id parent_id level
|
||||
1015 102 2
|
||||
1010 102 2
|
||||
explain select level from t1 where level=1;
|
||||
table type possible_keys key key_len ref rows Extra
|
||||
t1 ref level level 1 const 1 where used; Using index
|
||||
id select_type table type possible_keys key key_len ref rows Extra
|
||||
1 SIMPLE t1 ref level level 1 const 1 where used; Using index
|
||||
explain select level,id from t1 where level=1;
|
||||
table type possible_keys key key_len ref rows Extra
|
||||
t1 ref level level 1 const 1 where used; Using index
|
||||
id select_type table type possible_keys key key_len ref rows Extra
|
||||
1 SIMPLE t1 ref level level 1 const 1 where used; Using index
|
||||
explain select level,id,parent_id from t1 where level=1;
|
||||
table type possible_keys key key_len ref rows Extra
|
||||
t1 ref level level 1 const 1 where used
|
||||
id select_type table type possible_keys key key_len ref rows Extra
|
||||
1 SIMPLE t1 ref level level 1 const 1 where used
|
||||
select level,id from t1 where level=1;
|
||||
level id
|
||||
1 1002
|
||||
@ -624,8 +624,8 @@ id parent_id level
|
||||
1025 102 2
|
||||
1016 102 2
|
||||
explain select level from t1 where level=1;
|
||||
table type possible_keys key key_len ref rows Extra
|
||||
t1 ref level level 1 const 1 where used; Using index
|
||||
id select_type table type possible_keys key key_len ref rows Extra
|
||||
1 SIMPLE t1 ref level level 1 const 1 where used; Using index
|
||||
select level,id from t1 where level=1;
|
||||
level id
|
||||
1 1004
|
||||
|
@ -22,14 +22,13 @@ drop table if exists t1,t2;
|
||||
create table t1 (b char(0) not null, index(b));
|
||||
The used table handler can't index column 'b'
|
||||
create table t1 (a int not null auto_increment,primary key (a)) type=heap;
|
||||
The used table type doesn't support AUTO_INCREMENT columns
|
||||
create table t1 (a int not null,b text) type=heap;
|
||||
The used table type doesn't support BLOB/TEXT columns
|
||||
create table t1 (a int ,primary key(a)) type=heap;
|
||||
All parts of a PRIMARY KEY must be NOT NULL; If you need NULL in a key, use UNIQUE instead
|
||||
drop table if exists t1;
|
||||
create table t1 (ordid int(8) not null auto_increment, ord varchar(50) not null, primary key (ord,ordid)) type=heap;
|
||||
The used table type doesn't support AUTO_INCREMENT columns
|
||||
Incorrect table definition; There can only be one auto column and it must be defined as a key
|
||||
create table t1 (ordid int(8), primary key (ordid));
|
||||
All parts of a PRIMARY KEY must be NOT NULL; If you need NULL in a key, use UNIQUE instead
|
||||
create table not_existing_database.test (a int);
|
||||
|
41
mysql-test/r/heap_auto_increment.result
Normal file
41
mysql-test/r/heap_auto_increment.result
Normal file
@ -0,0 +1,41 @@
|
||||
drop table if exists t1;
|
||||
create table t1 (a int not null auto_increment,b int, primary key (a)) type=heap auto_increment=3;
|
||||
insert into t1 values (1,1),(NULL,3),(NULL,4);
|
||||
delete from t1 where a=4;
|
||||
insert into t1 values (NULL,5),(NULL,6);
|
||||
select * from t1;
|
||||
a b
|
||||
1 1
|
||||
3 3
|
||||
5 5
|
||||
6 6
|
||||
delete from t1 where a=6;
|
||||
replace t1 values (3,1);
|
||||
ALTER TABLE t1 add c int;
|
||||
replace t1 values (3,3,3);
|
||||
insert into t1 values (NULL,7,7);
|
||||
update t1 set a=8,b=b+1,c=c+1 where a=7;
|
||||
insert into t1 values (NULL,9,9);
|
||||
select * from t1;
|
||||
a b c
|
||||
1 1 NULL
|
||||
3 3 3
|
||||
5 5 NULL
|
||||
8 8 8
|
||||
9 9 9
|
||||
drop table t1;
|
||||
create table t1 (
|
||||
skey tinyint unsigned NOT NULL auto_increment PRIMARY KEY,
|
||||
sval char(20)
|
||||
) type=heap;
|
||||
insert into t1 values (NULL, "hello");
|
||||
insert into t1 values (NULL, "hey");
|
||||
select * from t1;
|
||||
skey sval
|
||||
1 hello
|
||||
2 hey
|
||||
select _rowid,t1._rowid,skey,sval from t1;
|
||||
_rowid _rowid skey sval
|
||||
1 1 1 hello
|
||||
2 2 2 hey
|
||||
drop table t1;
|
@ -1,7 +1,7 @@
|
||||
select (select 2);
|
||||
(select 2)
|
||||
2
|
||||
drop table if exists t1,t2,t3,t4,t5,attend,clinic;
|
||||
drop table if exists t1,t2,t3,t4,t5,attend,clinic,inscrit;
|
||||
create table t1 (a int);
|
||||
create table t2 (a int, b int);
|
||||
create table t3 (a int);
|
||||
@ -131,6 +131,8 @@ patient_uq clinic_uq
|
||||
1 1
|
||||
1 2
|
||||
2 2
|
||||
select * from t1 where a= (select a from t2,t4 where t2.b=t4.b);
|
||||
Column: 'a' in field list is ambiguous
|
||||
drop table if exists t1,t2,t3;
|
||||
CREATE TABLE t3 (a varchar(20),b char(1) NOT NULL default '0');
|
||||
INSERT INTO t3 VALUES ('W','a'),('A','c'),('J','b');
|
||||
@ -147,4 +149,16 @@ W 1
|
||||
SELECT * FROM t3 WHERE b = (SELECT MIN(b) FROM t3);
|
||||
a b
|
||||
W a
|
||||
drop table t1,t2,t3,t4,t5,attend,clinic;
|
||||
drop table if exists inscrit;
|
||||
CREATE TABLE `inscrit` (
|
||||
`pseudo` varchar(35) character set latin1 NOT NULL default '',
|
||||
`email` varchar(60) character set latin1 NOT NULL default '',
|
||||
PRIMARY KEY (`pseudo`),
|
||||
UNIQUE KEY `email` (`email`)
|
||||
) TYPE=MyISAM CHARSET=latin1 ROW_FORMAT=DYNAMIC;
|
||||
INSERT INTO inscrit (pseudo,email) VALUES ('joce','test');
|
||||
INSERT INTO inscrit (pseudo,email) VALUES ('joce1','test1');
|
||||
INSERT INTO inscrit (pseudo,email) VALUES ('2joce1','2test1');
|
||||
SELECT pseudo FROM inscrit WHERE pseudo=(SELECT pseudo FROM inscrit WHERE pseudo LIKE '%joce%');
|
||||
Subselect returns more than 1 record
|
||||
drop table if exists t1,t2,t3,t4,t5,attend,clinic,inscrit;
|
||||
|
@ -22,12 +22,12 @@ drop table if exists t1;
|
||||
!$1146 create table t2 select auto+1 from t1;
|
||||
drop table if exists t1,t2;
|
||||
!$1167 create table t1 (b char(0) not null, index(b));
|
||||
!$1164 create table t1 (a int not null auto_increment,primary key (a)) type=heap;
|
||||
create table t1 (a int not null auto_increment,primary key (a)) type=heap;
|
||||
!$1163 create table t1 (a int not null,b text) type=heap;
|
||||
!$1171 create table t1 (a int ,primary key(a)) type=heap;
|
||||
drop table if exists t1;
|
||||
|
||||
!$1164 create table t1 (ordid int(8) not null auto_increment, ord varchar(50) not null, primary key (ord,ordid)) type=heap;
|
||||
!$1075 create table t1 (ordid int(8) not null auto_increment, ord varchar(50) not null, primary key (ord,ordid)) type=heap;
|
||||
!$1171 create table t1 (ordid int(8), primary key (ordid));
|
||||
|
||||
-- error 1044,1
|
||||
|
30
mysql-test/t/heap_auto_increment.test
Normal file
30
mysql-test/t/heap_auto_increment.test
Normal file
@ -0,0 +1,30 @@
|
||||
#
|
||||
# Test of auto_increment; The test for BDB tables is in bdb.test
|
||||
#
|
||||
|
||||
drop table if exists t1;
|
||||
create table t1 (a int not null auto_increment,b int, primary key (a)) type=heap auto_increment=3;
|
||||
insert into t1 values (1,1),(NULL,3),(NULL,4);
|
||||
delete from t1 where a=4;
|
||||
insert into t1 values (NULL,5),(NULL,6);
|
||||
select * from t1;
|
||||
delete from t1 where a=6;
|
||||
#show table status like "t1";
|
||||
replace t1 values (3,1);
|
||||
ALTER TABLE t1 add c int;
|
||||
replace t1 values (3,3,3);
|
||||
insert into t1 values (NULL,7,7);
|
||||
update t1 set a=8,b=b+1,c=c+1 where a=7;
|
||||
insert into t1 values (NULL,9,9);
|
||||
select * from t1;
|
||||
drop table t1;
|
||||
|
||||
create table t1 (
|
||||
skey tinyint unsigned NOT NULL auto_increment PRIMARY KEY,
|
||||
sval char(20)
|
||||
) type=heap;
|
||||
insert into t1 values (NULL, "hello");
|
||||
insert into t1 values (NULL, "hey");
|
||||
select * from t1;
|
||||
select _rowid,t1._rowid,skey,sval from t1;
|
||||
drop table t1;
|
@ -1,6 +1,6 @@
|
||||
|
||||
select (select 2);
|
||||
drop table if exists t1,t2,t3,t4,t5,attend,clinic;
|
||||
drop table if exists t1,t2,t3,t4,t5,attend,clinic,inscrit;
|
||||
create table t1 (a int);
|
||||
create table t2 (a int, b int);
|
||||
create table t3 (a int);
|
||||
@ -53,6 +53,10 @@ insert into clinic values(1,"Oblastnaia bolnitsa"),(2,"Bolnitsa Krasnogo Kresta"
|
||||
insert into attend values (1,1),(1,2),(2,2),(1,3);
|
||||
select * from attend where exists (select * from clinic where uq = clinic_uq);
|
||||
|
||||
# not unique fields
|
||||
-- error 1052
|
||||
select * from t1 where a= (select a from t2,t4 where t2.b=t4.b);
|
||||
|
||||
# different tipes & group functions
|
||||
drop table if exists t1,t2,t3;
|
||||
|
||||
@ -66,4 +70,19 @@ SELECT * FROM t1 WHERE b = (SELECT MIN(b) FROM t1);
|
||||
SELECT * FROM t2 WHERE b = (SELECT MIN(b) FROM t2);
|
||||
SELECT * FROM t3 WHERE b = (SELECT MIN(b) FROM t3);
|
||||
|
||||
drop table t1,t2,t3,t4,t5,attend,clinic;
|
||||
drop table if exists inscrit;
|
||||
|
||||
CREATE TABLE `inscrit` (
|
||||
`pseudo` varchar(35) character set latin1 NOT NULL default '',
|
||||
`email` varchar(60) character set latin1 NOT NULL default '',
|
||||
PRIMARY KEY (`pseudo`),
|
||||
UNIQUE KEY `email` (`email`)
|
||||
) TYPE=MyISAM CHARSET=latin1 ROW_FORMAT=DYNAMIC;
|
||||
|
||||
INSERT INTO inscrit (pseudo,email) VALUES ('joce','test');
|
||||
INSERT INTO inscrit (pseudo,email) VALUES ('joce1','test1');
|
||||
INSERT INTO inscrit (pseudo,email) VALUES ('2joce1','2test1');
|
||||
-- error 1240
|
||||
SELECT pseudo FROM inscrit WHERE pseudo=(SELECT pseudo FROM inscrit WHERE pseudo LIKE '%joce%');
|
||||
|
||||
drop table if exists t1,t2,t3,t4,t5,attend,clinic,inscrit;
|
Reference in New Issue
Block a user