1 SIMPLE t2 NULL ref PRIMARY PRIMARY 4 test.t1.a 1 100.00 Using index
1 SIMPLE t3 NULL eq_ref PRIMARY PRIMARY 8 test.t2.b,test.t1.b 1 100.00 Using index
Warnings:
Note 1003 /* select#1 */ select `test`.`t1`.`a` AS `a`,`test`.`t1`.`b` AS `b`,`test`.`t2`.`a` AS `a`,`test`.`t2`.`b` AS `b`,`test`.`t3`.`a` AS `a`,`test`.`t3`.`b` AS `b` from `test`.`t1` join `test`.`t2` join `test`.`t3` where ((`test`.`t3`.`b` = `test`.`t1`.`b`) and (`test`.`t3`.`a` = `test`.`t2`.`b`) and (`test`.`t2`.`a` = `test`.`t1`.`a`))
delete t2.*,t3.* from t1,t2,t3 where t1.a=t2.a AND t2.b=t3.a and t1.b=t3.b;
select * from t3;
a b
drop table t1,t2,t3;
create table t1(a date not null);
insert ignore into t1 values (0);
Warnings:
Warning 1264 Out of range value for column 'a' at row 1
select * from t1 where a is null;
a
0000-00-00
delete from t1 where a is null;
select count(*) from t1;
count(*)
0
drop table t1;
#
# Adds some test cases for unicode. such as insert unicode chars, in values, table name, or etc.
#
CREATE TABLE `abc def` (i int)engine=tianmu;
INSERT INTO `abc def` VALUES (1);
delete from `abc def` where i=1;
drop table `abc def`;
CREATE TABLE t1 (`abc def1` int, `abc def2` int);
INSERT INTO t1 VALUES (1,1);
DELETE from t1 where `abc def1` = 1;
LOCK TABLE t1 write;
INSERT INTO t1 VALUES (1,2);
DELETE from t1 where `abc def1` = 1;
UNLOCK TABLES;
INSERT INTO t1 VALUES (1,2);
SET AUTOCOMMIT=0;
DELETE from t1 where `abc def2` = 2;
SET AUTOCOMMIT=1;
drop table t1;
#
# deleting rows from a temporary tables
#
CREATE TABLE t1 (c int not null, d char (10) not null);
insert into t1 values(1,""),(2,"a"),(3,"b");
CREATE TEMPORARY TABLE t1 (a int not null, b char (10) not null);
# DELETE FROM TABLE_NAME for select/insert/Aggregate query
#
insert into column_type_test(c_tinyint,c_smallint,c_mediumint,c_int,c_bigint,c_float,c_double,c_decimal,c_date,c_datetime,c_timestamp,c_time,c_char,c_varchar,c_text)
create table t1 (id int not null auto_increment primary key, username varchar(32) not null, unique (username));
create table t1 (id int not null auto_increment primary key, username varchar(32) not null,
unique (username));
insert into t1 values (0,"mysql");
insert into t1 values (0,"mysql ab");
insert into t1 values (0,"mysql a");
...
...
@@ -73,7 +74,10 @@ drop table t1;
#
# Test insert syntax
#
create table t1 (a int not null auto_increment, primary key (a), t timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP, c char(10) default "hello", i int)engine=tianmu;
create table t1 (a int not null auto_increment,
primary key (a),
t timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP,
c char(10) default "hello", i int)engine=tianmu;
insert into t1 values (default,default,default,default), (default,default,default,default), (4,0,"a",5),(default,default,default,default);
select a,t>0,c,i from t1;
a t>0 c i
...
...
@@ -96,26 +100,6 @@ a t>0 c i
6 1 hello NULL
drop table t1;
#
# Test problem with bulk insert and auto_increment on second part keys
#
create table t1 (sid char(20), id int(2) NOT NULL auto_increment, key(sid, id)) engine=myisam;
insert into t1 values ('skr',NULL),('skr',NULL),('test',NULL);
select * from t1;
sid id
skr 1
skr 2
test 1
insert into t1 values ('rts',NULL),('rts',NULL),('test',NULL);
Warning 3135 'NO_ZERO_DATE', 'NO_ZERO_IN_DATE' and 'ERROR_FOR_DIVISION_BY_ZERO' sql modes should be used with strict mode. They will be merged with strict mode in a future release.
Warning 3090 Changing sql mode 'NO_AUTO_CREATE_USER' is deprecated. It will be removed in a future release.
INSERT INTO t_latin1 values(x'f242', x'f242', x'f242');
UPDATE t_latin1 SET a=x'f343' where a=x'f242';
INSERT INTO t_gb2312 values(x'e5ac', x'e5ac', x'e5ac');
UPDATE t_gb2312 SET a=x'e6af' where a=x'e5ac';
INSERT INTO t_utf8 values(x'e4b8ad', x'e4b8ad', x'e4b8ad');
INSERT INTO t_utf8 values(x'f4b8ad', x'f4b8ad', x'f4b8ad');
ERROR HY000: Incorrect string value: '\xF4\xB8\xAD' for column 'a' at row 1
create table t1 (a int auto_increment , primary key (a))engine=tianmu;
insert into t1 values (NULL),(NULL),(NULL),(NULL),(NULL),(NULL),(NULL),(NULL),(NULL),(NULL),(NULL),(NULL),(NULL),(NULL),(NULL),(NULL),(NULL),(NULL),(NULL),(NULL),(NULL),(NULL),(NULL),(NULL),(NULL),(NULL),(NULL),(NULL),(NULL),(NULL),(NULL),(NULL),(NULL),(NULL),(NULL),(NULL);
update t1 set a=a+10 where a > 34;
update t1 set a=a+100 where a > 0;
update t1 set a=a+100 where a=1 and a=2;
update t1 set a=b+100 where a=1 and a=2;
ERROR 42S22: Unknown column 'b' in 'field list'
update t1 set a=b+100 where c=1 and a=2;
ERROR 42S22: Unknown column 'c' in 'where clause'
update t1 set d=a+100 where a=1;
ERROR 42S22: Unknown column 'd' in 'field list'
select * from t1;
a
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
145
146
drop table t1;
CREATE TABLE t1
(
place_id int (10) NOT NULL,
shows int(10) DEFAULT '0' NOT NULL,
ishows int(10) DEFAULT '0' NOT NULL,
ushows int(10) DEFAULT '0' NOT NULL,
clicks int(10) DEFAULT '0' NOT NULL,
iclicks int(10) DEFAULT '0' NOT NULL,
uclicks int(10) DEFAULT '0' NOT NULL,
ts timestamp,
PRIMARY KEY (place_id,ts)
);
INSERT INTO t1 (place_id,shows,ishows,ushows,clicks,iclicks,uclicks,ts)
VALUES (1,0,0,0,0,0,0,20000928174434);
UPDATE t1 SET shows=shows+1,ishows=ishows+1,ushows=ushows+1,clicks=clicks+1,iclicks=iclicks+1,uclicks=uclicks+1 WHERE place_id=1 AND ts>="2000-09-28 00:00:00";
select place_id,shows from t1;
place_id shows
1 1
drop table t1;
#
# Test bug with update reported by Jan Legenhausen
#
CREATE TABLE t1 (
lfdnr int(10) NOT NULL default '0',
ticket int(10) NOT NULL default '0',
client varchar(255) NOT NULL default '',
replyto varchar(255) NOT NULL default '',
subject varchar(100) NOT NULL default '',
timestamp int(10) NOT NULL default '0',
tstamp timestamp NOT NULL,
status int(3) NOT NULL default '0',
type varchar(15) NOT NULL default '',
assignment int(10) NOT NULL default '0',
fupcount int(4) NOT NULL default '0',
parent int(10) NOT NULL default '0',
activity int(10) NOT NULL default '0',
priority tinyint(1) NOT NULL default '1',
cc varchar(255) NOT NULL default '',
bcc varchar(255) NOT NULL default '',
body text NOT NULL,
comment text,
header text,
PRIMARY KEY (lfdnr),
KEY k1 (timestamp),
KEY k2 (type),
KEY k3 (parent),
KEY k4 (assignment),
KEY ticket (ticket)
) ENGINE=tianmu;
INSERT INTO t1 VALUES (773,773,'','','',980257344,20010318180652,0,'Open',10,0,0,0,1,'','','','','');
update t1 set status=1 where type='Open';
select status from t1;
status
1
drop table t1;
#
# Test with limit (Bug #393)
#
CREATE TABLE t1 (
`id_param` smallint(3) NOT NULL default '0',
`nom_option` char(40) NOT NULL default '',
`valid` tinyint(1) NOT NULL default '0',
KEY `id_param` (`id_param`,`nom_option`)
) ENGINE=tianmu;
INSERT INTO t1 (id_param,nom_option,valid) VALUES (185,'600x1200',1);
UPDATE t1 SET nom_option='test' WHERE id_param=185 AND nom_option='600x1200' AND valid=1 LIMIT 1;