mirror of
https://github.com/MariaDB/server.git
synced 2025-08-01 03:47:19 +03:00
Merge
sql/sql_select.cc: Auto merged sql/sql_update.cc: Auto merged mysql-test/r/multi_update.result: SCCS merged mysql-test/t/multi_update.test: SCCS merged
This commit is contained in:
@ -105,3 +105,29 @@ Table Op Msg_type Msg_text
|
||||
test.t1 check warning Found row where the auto_increment column has the value 0
|
||||
test.t1 check status OK
|
||||
drop table t1;
|
||||
create table t1 (a int not null auto_increment primary key);
|
||||
insert into t1 values (NULL);
|
||||
insert into t1 values (-1);
|
||||
select last_insert_id();
|
||||
last_insert_id()
|
||||
1
|
||||
insert into t1 values (NULL);
|
||||
select * from t1;
|
||||
a
|
||||
-1
|
||||
1
|
||||
2
|
||||
drop table t1;
|
||||
create table t1 (a int not null auto_increment primary key) /*!41002 type=heap */;
|
||||
insert into t1 values (NULL);
|
||||
insert into t1 values (-1);
|
||||
select last_insert_id();
|
||||
last_insert_id()
|
||||
1
|
||||
insert into t1 values (NULL);
|
||||
select * from t1;
|
||||
a
|
||||
-1
|
||||
1
|
||||
2
|
||||
drop table t1;
|
||||
|
@ -65,6 +65,7 @@ a b
|
||||
alter table t1 modify b tinytext not null, drop key b, add key (b(100));
|
||||
select * from t1 where b="hello ";
|
||||
a b
|
||||
hello hello
|
||||
select * from t1 ignore index (b) where b="hello ";
|
||||
a b
|
||||
hello hello
|
||||
|
@ -164,6 +164,9 @@ NULL '\0\Z'
|
||||
select length(quote(concat(char(0),"test")));
|
||||
length(quote(concat(char(0),"test")))
|
||||
8
|
||||
select hex(quote(concat(char(224),char(227),char(230),char(231),char(232),char(234),char(235))));
|
||||
hex(quote(concat(char(224),char(227),char(230),char(231),char(232),char(234),char(235))))
|
||||
27E0E3E6E7E8EAEB27
|
||||
select reverse("");
|
||||
reverse("")
|
||||
|
||||
|
@ -431,3 +431,12 @@ select * from t1, t3 where t1.start between t3.ctime1 and t3.ctime2;
|
||||
start ctime1 ctime2
|
||||
2002-11-04 00:00:00 2002-10-29 16:51:06 2002-11-05 16:47:31
|
||||
drop table t1,t2,t3;
|
||||
select @a:=FROM_UNIXTIME(1);
|
||||
@a:=FROM_UNIXTIME(1)
|
||||
1970-01-01 03:00:01
|
||||
select unix_timestamp(@a);
|
||||
unix_timestamp(@a)
|
||||
1
|
||||
select unix_timestamp('1969-12-01 19:00:01');
|
||||
unix_timestamp('1969-12-01 19:00:01')
|
||||
0
|
||||
|
@ -1,2 +1,2 @@
|
||||
Variable_name Value
|
||||
timezone MEST
|
||||
timezone MET
|
@ -1233,3 +1233,13 @@ create table t2 (c char(8) not null, b char(8) not null, a char(8) not null, pri
|
||||
insert into t2 select * from t1;
|
||||
delete t1,t2 from t2,t1 where t1.a<'B' and t2.b=t1.b;
|
||||
drop table t1,t2;
|
||||
SET AUTOCOMMIT=1;
|
||||
create table t1 (a integer auto_increment primary key) type=innodb;
|
||||
insert into t1 (a) values (NULL),(NULL);
|
||||
truncate table t1;
|
||||
insert into t1 (a) values (NULL),(NULL);
|
||||
SELECT * from t1;
|
||||
a
|
||||
3
|
||||
4
|
||||
drop table t1;
|
||||
|
@ -327,6 +327,16 @@ select t1.a, t1.b,t2.a, t2.b from t1 left join t2 on t1.a=t2.a where t1.b=1 and
|
||||
a b a b
|
||||
2 2 NULL NULL
|
||||
drop table t1,t2;
|
||||
create table t1 (a int not null auto_increment primary key, b int not null);
|
||||
insert into t1 (b) values (1),(2),(3),(4);
|
||||
update t1, t1 as t2 set t1.b=t2.b+1 where t1.a=t2.a;
|
||||
select * from t1;
|
||||
a b
|
||||
1 2
|
||||
2 3
|
||||
3 4
|
||||
4 5
|
||||
drop table t1;
|
||||
drop table if exists t1, t2;
|
||||
create table t1(id1 smallint(5), field char(5));
|
||||
create table t2(id2 smallint(5), field char(5));
|
||||
|
@ -64,3 +64,23 @@ t9 CREATE TABLE `t9` (
|
||||
PRIMARY KEY (`a`)
|
||||
) TYPE=MyISAM DATA DIRECTORY='TEST_DIR/var/tmp/' INDEX DIRECTORY='TEST_DIR/var/run/'
|
||||
drop database mysqltest;
|
||||
create table t1 (a int not null) type=myisam;
|
||||
show create table t1;
|
||||
Table Create Table
|
||||
t1 CREATE TABLE `t1` (
|
||||
`a` int(11) NOT NULL default '0'
|
||||
) TYPE=MyISAM
|
||||
alter table t1 add b int;
|
||||
show create table t1;
|
||||
Table Create Table
|
||||
t1 CREATE TABLE `t1` (
|
||||
`a` int(11) NOT NULL default '0',
|
||||
`b` int(11) default NULL
|
||||
) TYPE=MyISAM
|
||||
show create table t1;
|
||||
Table Create Table
|
||||
t1 CREATE TABLE `t1` (
|
||||
`a` int(11) NOT NULL default '0',
|
||||
`b` int(11) default NULL
|
||||
) TYPE=MyISAM
|
||||
drop table t1;
|
||||
|
@ -23,3 +23,9 @@ ts from_unixtime(ts)
|
||||
1048989599 2003-03-30 03:59:59
|
||||
1048989601 2003-03-30 04:00:01
|
||||
DROP TABLE t1;
|
||||
select @a:=FROM_UNIXTIME(1);
|
||||
@a:=FROM_UNIXTIME(1)
|
||||
1970-01-01 01:00:01
|
||||
select unix_timestamp(@a);
|
||||
unix_timestamp(@a)
|
||||
1
|
||||
|
@ -23,3 +23,12 @@ n
|
||||
drop table t1;
|
||||
truncate non_existing_table;
|
||||
Table 'test.non_existing_table' doesn't exist
|
||||
create table t1 (a integer auto_increment primary key);
|
||||
insert into t1 (a) values (NULL),(NULL);
|
||||
truncate table t1;
|
||||
insert into t1 (a) values (NULL),(NULL);
|
||||
SELECT * from t1;
|
||||
a
|
||||
1
|
||||
2
|
||||
drop table t1;
|
||||
|
@ -455,3 +455,149 @@ select if(imagem is null, "ERROR", "OK"),length(imagem) from t1 where id = 1;
|
||||
if(imagem is null, "ERROR", "OK") length(imagem)
|
||||
OK 581
|
||||
drop table t1;
|
||||
create table t1 (id integer primary key auto_increment, txt text not null, unique index txt_index (txt (20)));
|
||||
insert into t1 (txt) values ('Chevy'), ('Chevy ');
|
||||
select * from t1 where txt='Chevy';
|
||||
id txt
|
||||
1 Chevy
|
||||
2 Chevy
|
||||
select * from t1 where txt='Chevy ';
|
||||
id txt
|
||||
1 Chevy
|
||||
2 Chevy
|
||||
select * from t1 where txt='Chevy ' or txt='Chevy';
|
||||
id txt
|
||||
1 Chevy
|
||||
2 Chevy
|
||||
select * from t1 where txt='Chevy' or txt='Chevy ';
|
||||
id txt
|
||||
1 Chevy
|
||||
2 Chevy
|
||||
select * from t1 where id='1' or id='2';
|
||||
id txt
|
||||
1 Chevy
|
||||
2 Chevy
|
||||
insert into t1 (txt) values('Ford');
|
||||
select * from t1 where txt='Chevy' or txt='Chevy ' or txt='Ford';
|
||||
id txt
|
||||
1 Chevy
|
||||
2 Chevy
|
||||
3 Ford
|
||||
select * from t1 where txt='Chevy' or txt='Chevy ';
|
||||
id txt
|
||||
1 Chevy
|
||||
2 Chevy
|
||||
select * from t1 where txt='Chevy' or txt='Chevy ' or txt=' Chevy';
|
||||
id txt
|
||||
1 Chevy
|
||||
2 Chevy
|
||||
select * from t1 where txt in ('Chevy ','Chevy');
|
||||
id txt
|
||||
1 Chevy
|
||||
2 Chevy
|
||||
select * from t1 where txt in ('Chevy');
|
||||
id txt
|
||||
1 Chevy
|
||||
2 Chevy
|
||||
select * from t1 where txt between 'Chevy' and 'Chevy';
|
||||
id txt
|
||||
1 Chevy
|
||||
2 Chevy
|
||||
select * from t1 where txt between 'Chevy' and 'Chevy' or txt='Chevy ';
|
||||
id txt
|
||||
1 Chevy
|
||||
2 Chevy
|
||||
select * from t1 where txt between 'Chevy' and 'Chevy ';
|
||||
id txt
|
||||
1 Chevy
|
||||
2 Chevy
|
||||
select * from t1 where txt < 'Chevy ';
|
||||
id txt
|
||||
select * from t1 where txt <= 'Chevy';
|
||||
id txt
|
||||
1 Chevy
|
||||
2 Chevy
|
||||
select * from t1 where txt > 'Chevy';
|
||||
id txt
|
||||
3 Ford
|
||||
select * from t1 where txt >= 'Chevy';
|
||||
id txt
|
||||
1 Chevy
|
||||
2 Chevy
|
||||
3 Ford
|
||||
drop table t1;
|
||||
create table t1 (id integer primary key auto_increment, txt text, unique index txt_index (txt (20)));
|
||||
insert into t1 (txt) values ('Chevy'), ('Chevy '), (NULL);
|
||||
select * from t1 where txt='Chevy' or txt is NULL;
|
||||
id txt
|
||||
3 NULL
|
||||
1 Chevy
|
||||
2 Chevy
|
||||
select * from t1 where txt='Chevy ';
|
||||
id txt
|
||||
1 Chevy
|
||||
2 Chevy
|
||||
select * from t1 where txt='Chevy ' or txt='Chevy';
|
||||
id txt
|
||||
1 Chevy
|
||||
2 Chevy
|
||||
select * from t1 where txt='Chevy' or txt='Chevy ';
|
||||
id txt
|
||||
1 Chevy
|
||||
2 Chevy
|
||||
select * from t1 where id='1' or id='2';
|
||||
id txt
|
||||
1 Chevy
|
||||
2 Chevy
|
||||
insert into t1 (txt) values('Ford');
|
||||
select * from t1 where txt='Chevy' or txt='Chevy ' or txt='Ford';
|
||||
id txt
|
||||
1 Chevy
|
||||
2 Chevy
|
||||
4 Ford
|
||||
select * from t1 where txt='Chevy' or txt='Chevy ';
|
||||
id txt
|
||||
1 Chevy
|
||||
2 Chevy
|
||||
select * from t1 where txt='Chevy' or txt='Chevy ' or txt=' Chevy';
|
||||
id txt
|
||||
1 Chevy
|
||||
2 Chevy
|
||||
select * from t1 where txt in ('Chevy ','Chevy');
|
||||
id txt
|
||||
1 Chevy
|
||||
2 Chevy
|
||||
select * from t1 where txt in ('Chevy');
|
||||
id txt
|
||||
1 Chevy
|
||||
2 Chevy
|
||||
select * from t1 where txt between 'Chevy' and 'Chevy';
|
||||
id txt
|
||||
1 Chevy
|
||||
2 Chevy
|
||||
select * from t1 where txt between 'Chevy' and 'Chevy' or txt='Chevy ';
|
||||
id txt
|
||||
1 Chevy
|
||||
2 Chevy
|
||||
select * from t1 where txt between 'Chevy' and 'Chevy ';
|
||||
id txt
|
||||
1 Chevy
|
||||
2 Chevy
|
||||
select * from t1 where txt < 'Chevy ';
|
||||
id txt
|
||||
select * from t1 where txt < 'Chevy ' or txt is NULL;
|
||||
id txt
|
||||
3 NULL
|
||||
select * from t1 where txt <= 'Chevy';
|
||||
id txt
|
||||
1 Chevy
|
||||
2 Chevy
|
||||
select * from t1 where txt > 'Chevy';
|
||||
id txt
|
||||
4 Ford
|
||||
select * from t1 where txt >= 'Chevy';
|
||||
id txt
|
||||
1 Chevy
|
||||
2 Chevy
|
||||
4 Ford
|
||||
drop table t1;
|
||||
|
@ -70,3 +70,22 @@ select * from t1;
|
||||
check table t1;
|
||||
drop table t1;
|
||||
|
||||
#
|
||||
# Test negative values (Bug #1366)
|
||||
#
|
||||
|
||||
create table t1 (a int not null auto_increment primary key);
|
||||
insert into t1 values (NULL);
|
||||
insert into t1 values (-1);
|
||||
select last_insert_id();
|
||||
insert into t1 values (NULL);
|
||||
select * from t1;
|
||||
drop table t1;
|
||||
|
||||
create table t1 (a int not null auto_increment primary key) /*!41002 type=heap */;
|
||||
insert into t1 values (NULL);
|
||||
insert into t1 values (-1);
|
||||
select last_insert_id();
|
||||
insert into t1 values (NULL);
|
||||
select * from t1;
|
||||
drop table t1;
|
||||
|
@ -67,6 +67,7 @@ select quote('\'\"\\test');
|
||||
select quote(concat('abc\'', '\\cba'));
|
||||
select quote(1/0), quote('\0\Z');
|
||||
select length(quote(concat(char(0),"test")));
|
||||
select hex(quote(concat(char(224),char(227),char(230),char(231),char(232),char(234),char(235))));
|
||||
|
||||
#
|
||||
# Wrong usage of functions
|
||||
|
@ -201,3 +201,10 @@ select * from t1, t2 where t1.start between t2.ctime1 and t2.ctime2;
|
||||
select * from t1, t2 where t1.start >= t2.ctime1 and t1.start <= t2.ctime2;
|
||||
select * from t1, t3 where t1.start between t3.ctime1 and t3.ctime2;
|
||||
drop table t1,t2,t3;
|
||||
|
||||
#
|
||||
# Test unix timestamp
|
||||
#
|
||||
select @a:=FROM_UNIXTIME(1);
|
||||
select unix_timestamp(@a);
|
||||
select unix_timestamp('1969-12-01 19:00:01');
|
||||
|
@ -857,3 +857,15 @@ insert into t2 select * from t1;
|
||||
|
||||
delete t1,t2 from t2,t1 where t1.a<'B' and t2.b=t1.b;
|
||||
drop table t1,t2;
|
||||
|
||||
#
|
||||
# test autoincrement with TRUNCATE
|
||||
#
|
||||
|
||||
SET AUTOCOMMIT=1;
|
||||
create table t1 (a integer auto_increment primary key) type=innodb;
|
||||
insert into t1 (a) values (NULL),(NULL);
|
||||
truncate table t1;
|
||||
insert into t1 (a) values (NULL),(NULL);
|
||||
SELECT * from t1;
|
||||
drop table t1;
|
||||
|
@ -268,6 +268,16 @@ update t1 left join t2 on t1.a=t2.a set t1.b=2, t2.b=2 where t1.b=1 and t2.b=1
|
||||
select t1.a, t1.b,t2.a, t2.b from t1 left join t2 on t1.a=t2.a where t1.b=1 and t2.b=1 or t2.a is NULL;
|
||||
drop table t1,t2;
|
||||
|
||||
#
|
||||
# Test reuse of same table
|
||||
#
|
||||
|
||||
create table t1 (a int not null auto_increment primary key, b int not null);
|
||||
insert into t1 (b) values (1),(2),(3),(4);
|
||||
update t1, t1 as t2 set t1.b=t2.b+1 where t1.a=t2.a;
|
||||
select * from t1;
|
||||
drop table t1;
|
||||
|
||||
# Test multi-update and multi-delete with impossible where
|
||||
|
||||
drop table if exists t1, t2;
|
||||
|
@ -90,3 +90,25 @@ select count(*) from mysqltest.t9;
|
||||
--replace_result $MYSQL_TEST_DIR TEST_DIR
|
||||
show create table mysqltest.t9;
|
||||
drop database mysqltest;
|
||||
|
||||
#
|
||||
# Test changing data dir (Bug #1662)
|
||||
#
|
||||
|
||||
create table t1 (a int not null) type=myisam;
|
||||
disable_query_log;
|
||||
eval alter table t1 data directory="$MYSQL_TEST_DIR/var/tmp";
|
||||
enable_query_log;
|
||||
--replace_result $MYSQL_TEST_DIR TEST_DIR
|
||||
show create table t1;
|
||||
alter table t1 add b int;
|
||||
disable_query_log;
|
||||
eval alter table t1 data directory="$MYSQL_TEST_DIR/var/log";
|
||||
enable_query_log;
|
||||
--replace_result $MYSQL_TEST_DIR TEST_DIR
|
||||
show create table t1;
|
||||
disable_query_log;
|
||||
eval alter table t1 index directory="$MYSQL_TEST_DIR/var/log";
|
||||
enable_query_log;
|
||||
show create table t1;
|
||||
drop table t1;
|
||||
|
@ -1,7 +1,7 @@
|
||||
#
|
||||
# Test of timezone handling. This script must be run with TZ=MEST
|
||||
# Test of timezone handling. This script must be run with TZ=MET
|
||||
|
||||
-- require r/have_mest_timezone.require
|
||||
-- require r/have_met_timezone.require
|
||||
disable_query_log;
|
||||
show variables like "timezone";
|
||||
enable_query_log;
|
||||
@ -26,3 +26,9 @@ INSERT INTO t1 (ts) VALUES (Unix_timestamp('2003-03-30 04:00:01'));
|
||||
|
||||
SELECT ts,from_unixtime(ts) FROM t1;
|
||||
DROP TABLE t1;
|
||||
|
||||
#
|
||||
# Test unix timestamp
|
||||
#
|
||||
select @a:=FROM_UNIXTIME(1);
|
||||
select unix_timestamp(@a);
|
||||
|
@ -21,3 +21,15 @@ select * from t1;
|
||||
drop table t1;
|
||||
--error 1146
|
||||
truncate non_existing_table;
|
||||
|
||||
#
|
||||
# test autoincrement with TRUNCATE
|
||||
#
|
||||
|
||||
create table t1 (a integer auto_increment primary key);
|
||||
insert into t1 (a) values (NULL),(NULL);
|
||||
truncate table t1;
|
||||
insert into t1 (a) values (NULL),(NULL);
|
||||
SELECT * from t1;
|
||||
drop table t1;
|
||||
|
||||
|
@ -263,3 +263,52 @@ insert into t1 (id) values (1);
|
||||
update t1 set imagem=load_file('../../std_data/words.dat') where id=1;
|
||||
select if(imagem is null, "ERROR", "OK"),length(imagem) from t1 where id = 1;
|
||||
drop table t1;
|
||||
|
||||
#
|
||||
# Test blob's with end space (Bug #1651)
|
||||
#
|
||||
|
||||
create table t1 (id integer primary key auto_increment, txt text not null, unique index txt_index (txt (20)));
|
||||
insert into t1 (txt) values ('Chevy'), ('Chevy ');
|
||||
select * from t1 where txt='Chevy';
|
||||
select * from t1 where txt='Chevy ';
|
||||
select * from t1 where txt='Chevy ' or txt='Chevy';
|
||||
select * from t1 where txt='Chevy' or txt='Chevy ';
|
||||
select * from t1 where id='1' or id='2';
|
||||
insert into t1 (txt) values('Ford');
|
||||
select * from t1 where txt='Chevy' or txt='Chevy ' or txt='Ford';
|
||||
select * from t1 where txt='Chevy' or txt='Chevy ';
|
||||
select * from t1 where txt='Chevy' or txt='Chevy ' or txt=' Chevy';
|
||||
select * from t1 where txt in ('Chevy ','Chevy');
|
||||
select * from t1 where txt in ('Chevy');
|
||||
select * from t1 where txt between 'Chevy' and 'Chevy';
|
||||
select * from t1 where txt between 'Chevy' and 'Chevy' or txt='Chevy ';
|
||||
select * from t1 where txt between 'Chevy' and 'Chevy ';
|
||||
select * from t1 where txt < 'Chevy ';
|
||||
select * from t1 where txt <= 'Chevy';
|
||||
select * from t1 where txt > 'Chevy';
|
||||
select * from t1 where txt >= 'Chevy';
|
||||
drop table t1;
|
||||
|
||||
create table t1 (id integer primary key auto_increment, txt text, unique index txt_index (txt (20)));
|
||||
insert into t1 (txt) values ('Chevy'), ('Chevy '), (NULL);
|
||||
select * from t1 where txt='Chevy' or txt is NULL;
|
||||
select * from t1 where txt='Chevy ';
|
||||
select * from t1 where txt='Chevy ' or txt='Chevy';
|
||||
select * from t1 where txt='Chevy' or txt='Chevy ';
|
||||
select * from t1 where id='1' or id='2';
|
||||
insert into t1 (txt) values('Ford');
|
||||
select * from t1 where txt='Chevy' or txt='Chevy ' or txt='Ford';
|
||||
select * from t1 where txt='Chevy' or txt='Chevy ';
|
||||
select * from t1 where txt='Chevy' or txt='Chevy ' or txt=' Chevy';
|
||||
select * from t1 where txt in ('Chevy ','Chevy');
|
||||
select * from t1 where txt in ('Chevy');
|
||||
select * from t1 where txt between 'Chevy' and 'Chevy';
|
||||
select * from t1 where txt between 'Chevy' and 'Chevy' or txt='Chevy ';
|
||||
select * from t1 where txt between 'Chevy' and 'Chevy ';
|
||||
select * from t1 where txt < 'Chevy ';
|
||||
select * from t1 where txt < 'Chevy ' or txt is NULL;
|
||||
select * from t1 where txt <= 'Chevy';
|
||||
select * from t1 where txt > 'Chevy';
|
||||
select * from t1 where txt >= 'Chevy';
|
||||
drop table t1;
|
||||
|
Reference in New Issue
Block a user