mirror of
https://github.com/MariaDB/server.git
synced 2025-07-30 16:24:05 +03:00
Merge mskold@bk-internal.mysql.com:/home/bk/mysql-5.0
into mysql.com:/usr/local/home/marty/MySQL/mysql-5.0
This commit is contained in:
@ -50,6 +50,9 @@ CREATE TABLE host (
|
||||
Lock_tables_priv enum('N','Y') COLLATE utf8_general_ci DEFAULT 'N' NOT NULL,
|
||||
Create_view_priv enum('N','Y') COLLATE utf8_general_ci DEFAULT 'N' NOT NULL,
|
||||
Show_view_priv enum('N','Y') COLLATE utf8_general_ci DEFAULT 'N' NOT NULL,
|
||||
Create_routine_priv enum('N','Y') COLLATE utf8_general_ci DEFAULT 'N' NOT NULL,
|
||||
Alter_routine_priv enum('N','Y') COLLATE utf8_general_ci DEFAULT 'N' NOT NULL,
|
||||
Execute_priv enum('N','Y') COLLATE utf8_general_ci DEFAULT 'N' NOT NULL,
|
||||
PRIMARY KEY Host (Host,Db)
|
||||
) engine=MyISAM
|
||||
CHARACTER SET utf8 COLLATE utf8_bin
|
||||
@ -489,10 +492,11 @@ CREATE TABLE procs_priv (
|
||||
Db char(64) binary DEFAULT '' NOT NULL,
|
||||
User char(16) binary DEFAULT '' NOT NULL,
|
||||
Routine_name char(64) binary DEFAULT '' NOT NULL,
|
||||
Routine_type enum('FUNCTION','PROCEDURE') NOT NULL,
|
||||
Grantor char(77) DEFAULT '' NOT NULL,
|
||||
Timestamp timestamp(14),
|
||||
Proc_priv set('Execute','Alter Routine','Grant') COLLATE utf8_general_ci DEFAULT '' NOT NULL,
|
||||
PRIMARY KEY (Host,Db,User,Routine_name),
|
||||
Timestamp timestamp(14),
|
||||
PRIMARY KEY (Host,Db,User,Routine_name,Routine_type),
|
||||
KEY Grantor (Grantor)
|
||||
) engine=MyISAM
|
||||
CHARACTER SET utf8 COLLATE utf8_bin
|
||||
|
@ -1212,8 +1212,8 @@ start_master()
|
||||
$NOT_FIRST_MASTER_EXTRA_OPTS"
|
||||
fi
|
||||
|
||||
CUR_MYERR=$MASTER_MYERR
|
||||
CUR_MYSOCK=$MASTER_MYSOCK
|
||||
CUR_MYERR=$MASTER_MYERR$1
|
||||
CUR_MYSOCK=$MASTER_MYSOCK$1
|
||||
|
||||
# For embedded server we collect the server flags and return
|
||||
if [ "x$USE_EMBEDDED_SERVER" = "x1" ] ; then
|
||||
|
@ -60,3 +60,9 @@ count(distinct a)
|
||||
1
|
||||
1
|
||||
drop table t1;
|
||||
create table t1 (f1 int, f2 int);
|
||||
insert into t1 values (0,1),(1,2);
|
||||
select count(distinct if(f1,3,f2)) from t1;
|
||||
count(distinct if(f1,3,f2))
|
||||
2
|
||||
drop table t1;
|
||||
|
@ -579,3 +579,21 @@ select * from t2;
|
||||
b
|
||||
1
|
||||
drop table t1,t2;
|
||||
use test;
|
||||
create table t1 (a int);
|
||||
create table t1 select * from t1;
|
||||
ERROR HY000: You can't specify target table 't1' for update in FROM clause
|
||||
create table t2 union = (t1) select * from t1;
|
||||
ERROR HY000: You can't specify target table 't1' for update in FROM clause
|
||||
flush tables with read lock;
|
||||
unlock tables;
|
||||
drop table t1;
|
||||
create table t1(column.name int);
|
||||
ERROR 42000: Incorrect table name 'column'
|
||||
create table t1(test.column.name int);
|
||||
ERROR 42000: Incorrect table name 'column'
|
||||
create table t1(xyz.t1.name int);
|
||||
ERROR 42000: Incorrect database name 'xyz'
|
||||
create table t1(t1.name int);
|
||||
create table t2(test.t2.name int);
|
||||
drop table t1,t2;
|
||||
|
138
mysql-test/r/default.result
Normal file
138
mysql-test/r/default.result
Normal file
@ -0,0 +1,138 @@
|
||||
drop table if exists t1,t2,t3,t4,t5,t6;
|
||||
drop database if exists mysqltest;
|
||||
CREATE TABLE t1 (a varchar(30) binary NOT NULL DEFAULT ' ',
|
||||
b varchar(1) binary NOT NULL DEFAULT ' ',
|
||||
c varchar(4) binary NOT NULL DEFAULT '0000',
|
||||
d tinyblob NULL,
|
||||
e tinyblob NULL,
|
||||
f tinyblob NULL,
|
||||
g tinyblob NULL,
|
||||
h tinyblob NULL,
|
||||
i tinyblob NULL,
|
||||
j tinyblob NULL,
|
||||
k tinyblob NULL,
|
||||
l tinyblob NULL,
|
||||
m tinyblob NULL,
|
||||
n tinyblob NULL,
|
||||
o tinyblob NULL,
|
||||
p tinyblob NULL,
|
||||
q varchar(30) binary NOT NULL DEFAULT ' ',
|
||||
r varchar(30) binary NOT NULL DEFAULT ' ',
|
||||
s tinyblob NULL,
|
||||
t varchar(4) binary NOT NULL DEFAULT ' ',
|
||||
u varchar(1) binary NOT NULL DEFAULT ' ',
|
||||
v varchar(30) binary NOT NULL DEFAULT ' ',
|
||||
w varchar(30) binary NOT NULL DEFAULT ' ',
|
||||
x tinyblob NULL,
|
||||
y varchar(5) binary NOT NULL DEFAULT ' ',
|
||||
z varchar(20) binary NOT NULL DEFAULT ' ',
|
||||
a1 varchar(30) binary NOT NULL DEFAULT ' ',
|
||||
b1 tinyblob NULL)
|
||||
ENGINE=InnoDB DEFAULT CHARACTER SET = latin1 COLLATE latin1_bin;
|
||||
SHOW CREATE TABLE t1;
|
||||
Table Create Table
|
||||
t1 CREATE TABLE `t1` (
|
||||
`a` varchar(30) collate latin1_bin NOT NULL default ' ',
|
||||
`b` varchar(1) collate latin1_bin NOT NULL default ' ',
|
||||
`c` varchar(4) collate latin1_bin NOT NULL default '0000',
|
||||
`d` tinyblob,
|
||||
`e` tinyblob,
|
||||
`f` tinyblob,
|
||||
`g` tinyblob,
|
||||
`h` tinyblob,
|
||||
`i` tinyblob,
|
||||
`j` tinyblob,
|
||||
`k` tinyblob,
|
||||
`l` tinyblob,
|
||||
`m` tinyblob,
|
||||
`n` tinyblob,
|
||||
`o` tinyblob,
|
||||
`p` tinyblob,
|
||||
`q` varchar(30) collate latin1_bin NOT NULL default ' ',
|
||||
`r` varchar(30) collate latin1_bin NOT NULL default ' ',
|
||||
`s` tinyblob,
|
||||
`t` varchar(4) collate latin1_bin NOT NULL default ' ',
|
||||
`u` varchar(1) collate latin1_bin NOT NULL default ' ',
|
||||
`v` varchar(30) collate latin1_bin NOT NULL default ' ',
|
||||
`w` varchar(30) collate latin1_bin NOT NULL default ' ',
|
||||
`x` tinyblob,
|
||||
`y` varchar(5) collate latin1_bin NOT NULL default ' ',
|
||||
`z` varchar(20) collate latin1_bin NOT NULL default ' ',
|
||||
`a1` varchar(30) collate latin1_bin NOT NULL default ' ',
|
||||
`b1` tinyblob
|
||||
) ENGINE=InnoDB DEFAULT CHARSET=latin1 COLLATE=latin1_bin
|
||||
INSERT into t1 (b) values ('1');
|
||||
SHOW WARNINGS;
|
||||
Level Code Message
|
||||
SELECT * from t1;
|
||||
a b c d e f g h i j k l m n o p q r s t u v w x y z a1 b1
|
||||
1 0000 NULL NULL NULL NULL NULL NULL NULL NULL NULL NULL NULL NULL NULL NULL NULL NULL
|
||||
CREATE TABLE t2 (a varchar(30) binary NOT NULL DEFAULT ' ',
|
||||
b varchar(1) binary NOT NULL DEFAULT ' ',
|
||||
c varchar(4) binary NOT NULL DEFAULT '0000',
|
||||
d tinyblob NULL,
|
||||
e tinyblob NULL,
|
||||
f tinyblob NULL,
|
||||
g tinyblob NULL,
|
||||
h tinyblob NULL,
|
||||
i tinyblob NULL,
|
||||
j tinyblob NULL,
|
||||
k tinyblob NULL,
|
||||
l tinyblob NULL,
|
||||
m tinyblob NULL,
|
||||
n tinyblob NULL,
|
||||
o tinyblob NULL,
|
||||
p tinyblob NULL,
|
||||
q varchar(30) binary NOT NULL DEFAULT ' ',
|
||||
r varchar(30) binary NOT NULL DEFAULT ' ',
|
||||
s tinyblob NULL,
|
||||
t varchar(4) binary NOT NULL DEFAULT ' ',
|
||||
u varchar(1) binary NOT NULL DEFAULT ' ',
|
||||
v varchar(30) binary NOT NULL DEFAULT ' ',
|
||||
w varchar(30) binary NOT NULL DEFAULT ' ',
|
||||
x tinyblob NULL,
|
||||
y varchar(5) binary NOT NULL DEFAULT ' ',
|
||||
z varchar(20) binary NOT NULL DEFAULT ' ',
|
||||
a1 varchar(30) binary NOT NULL DEFAULT ' ',
|
||||
b1 tinyblob NULL)
|
||||
ENGINE=MyISAM DEFAULT CHARACTER SET = latin1 COLLATE latin1_bin;
|
||||
SHOW CREATE TABLE t2;
|
||||
Table Create Table
|
||||
t2 CREATE TABLE `t2` (
|
||||
`a` varchar(30) collate latin1_bin NOT NULL default ' ',
|
||||
`b` varchar(1) collate latin1_bin NOT NULL default ' ',
|
||||
`c` varchar(4) collate latin1_bin NOT NULL default '0000',
|
||||
`d` tinyblob,
|
||||
`e` tinyblob,
|
||||
`f` tinyblob,
|
||||
`g` tinyblob,
|
||||
`h` tinyblob,
|
||||
`i` tinyblob,
|
||||
`j` tinyblob,
|
||||
`k` tinyblob,
|
||||
`l` tinyblob,
|
||||
`m` tinyblob,
|
||||
`n` tinyblob,
|
||||
`o` tinyblob,
|
||||
`p` tinyblob,
|
||||
`q` varchar(30) collate latin1_bin NOT NULL default ' ',
|
||||
`r` varchar(30) collate latin1_bin NOT NULL default ' ',
|
||||
`s` tinyblob,
|
||||
`t` varchar(4) collate latin1_bin NOT NULL default ' ',
|
||||
`u` varchar(1) collate latin1_bin NOT NULL default ' ',
|
||||
`v` varchar(30) collate latin1_bin NOT NULL default ' ',
|
||||
`w` varchar(30) collate latin1_bin NOT NULL default ' ',
|
||||
`x` tinyblob,
|
||||
`y` varchar(5) collate latin1_bin NOT NULL default ' ',
|
||||
`z` varchar(20) collate latin1_bin NOT NULL default ' ',
|
||||
`a1` varchar(30) collate latin1_bin NOT NULL default ' ',
|
||||
`b1` tinyblob
|
||||
) ENGINE=MyISAM DEFAULT CHARSET=latin1 COLLATE=latin1_bin
|
||||
INSERT into t2 (b) values ('1');
|
||||
SHOW WARNINGS;
|
||||
Level Code Message
|
||||
SELECT * from t2;
|
||||
a b c d e f g h i j k l m n o p q r s t u v w x y z a1 b1
|
||||
1 0000 NULL NULL NULL NULL NULL NULL NULL NULL NULL NULL NULL NULL NULL NULL NULL NULL
|
||||
drop table t1;
|
||||
drop table t2;
|
@ -906,9 +906,100 @@ INSERT INTO federated.t1 (name, country_id, other) VALUES ('Lenz', 2, 22222);
|
||||
INSERT INTO federated.t1 (name, country_id, other) VALUES ('Marizio', 3, 33333);
|
||||
INSERT INTO federated.t1 (name, country_id, other) VALUES ('Monty', 4, 33333);
|
||||
INSERT INTO federated.t1 (name, country_id, other) VALUES ('Sanja', 5, 33333);
|
||||
EXPLAIN SELECT federated.t1.name AS name, federated.t1.country_id AS country_id,
|
||||
federated.t1.other AS other, federated.countries.country AS country
|
||||
FROM federated.t1, federated.countries WHERE
|
||||
federated.t1.country_id = federated.countries.id;
|
||||
id select_type table type possible_keys key key_len ref rows Extra
|
||||
1 SIMPLE countries ALL PRIMARY NULL NULL NULL 5
|
||||
1 SIMPLE t1 ref country_id country_id 4 federated.countries.id 120
|
||||
SELECT federated.t1.name AS name, federated.t1.country_id AS country_id,
|
||||
federated.t1.other AS other, federated.countries.country AS country
|
||||
FROM federated.t1, federated.countries WHERE
|
||||
federated.t1.country_id = federated.countries.id;
|
||||
name country_id other country
|
||||
Kumar 1 11111 India
|
||||
Lenz 2 22222 Germany
|
||||
Marizio 3 33333 Italy
|
||||
Monty 4 33333 Finland
|
||||
Sanja 5 33333 Ukraine
|
||||
EXPLAIN SELECT federated.t1.name AS name, federated.t1.country_id AS country_id,
|
||||
federated.t1.other AS other, federated.countries.country AS country
|
||||
FROM federated.t1 INNER JOIN federated.countries ON
|
||||
federated.t1.country_id = federated.countries.id;
|
||||
id select_type table type possible_keys key key_len ref rows Extra
|
||||
1 SIMPLE countries ALL PRIMARY NULL NULL NULL 5
|
||||
1 SIMPLE t1 ref country_id country_id 4 federated.countries.id 120
|
||||
SELECT federated.t1.name AS name, federated.t1.country_id AS country_id,
|
||||
federated.t1.other AS other, federated.countries.country AS country
|
||||
FROM federated.t1 INNER JOIN federated.countries ON
|
||||
federated.t1.country_id = federated.countries.id;
|
||||
name country_id other country
|
||||
Kumar 1 11111 India
|
||||
Lenz 2 22222 Germany
|
||||
Marizio 3 33333 Italy
|
||||
Monty 4 33333 Finland
|
||||
Sanja 5 33333 Ukraine
|
||||
EXPLAIN SELECT federated.t1.name AS name, federated.t1.country_id AS country_id,
|
||||
federated.t1.other AS other, federated.countries.country AS country
|
||||
FROM federated.t1 INNER JOIN federated.countries ON
|
||||
federated.t1.country_id = federated.countries.id
|
||||
WHERE federated.t1.name = 'Monty';
|
||||
id select_type table type possible_keys key key_len ref rows Extra
|
||||
1 SIMPLE countries ALL PRIMARY NULL NULL NULL 5
|
||||
1 SIMPLE t1 ref country_id country_id 4 federated.countries.id 120 Using where
|
||||
SELECT federated.t1.name AS name, federated.t1.country_id AS country_id,
|
||||
federated.t1.other AS other, federated.countries.country AS country
|
||||
FROM federated.t1 INNER JOIN federated.countries ON
|
||||
federated.t1.country_id = federated.countries.id
|
||||
WHERE federated.t1.name = 'Monty';
|
||||
name country_id other country
|
||||
Monty 4 33333 Finland
|
||||
EXPLAIN SELECT federated.t1.*, federated.countries.country
|
||||
FROM federated.t1 LEFT JOIN federated.countries
|
||||
ON federated.t1.country_id = federated.countries.id
|
||||
ORDER BY federated.countries.id;
|
||||
id select_type table type possible_keys key key_len ref rows Extra
|
||||
1 SIMPLE t1 ALL NULL NULL NULL NULL 10000 Using temporary; Using filesort
|
||||
1 SIMPLE countries eq_ref PRIMARY PRIMARY 4 federated.t1.country_id 1
|
||||
SELECT federated.t1.*, federated.countries.country
|
||||
FROM federated.t1 left join federated.countries
|
||||
ON federated.t1.country_id = federated.countries.id;
|
||||
FROM federated.t1 LEFT JOIN federated.countries
|
||||
ON federated.t1.country_id = federated.countries.id
|
||||
ORDER BY federated.countries.id;
|
||||
id country_id name other country
|
||||
1 1 Kumar 11111 India
|
||||
2 2 Lenz 22222 Germany
|
||||
3 3 Marizio 33333 Italy
|
||||
4 4 Monty 33333 Finland
|
||||
5 5 Sanja 33333 Ukraine
|
||||
EXPLAIN SELECT federated.t1.*, federated.countries.country
|
||||
FROM federated.t1 LEFT JOIN federated.countries
|
||||
ON federated.t1.country_id = federated.countries.id
|
||||
ORDER BY federated.countries.country;
|
||||
id select_type table type possible_keys key key_len ref rows Extra
|
||||
1 SIMPLE t1 ALL NULL NULL NULL NULL 10000 Using temporary; Using filesort
|
||||
1 SIMPLE countries eq_ref PRIMARY PRIMARY 4 federated.t1.country_id 1
|
||||
SELECT federated.t1.*, federated.countries.country
|
||||
FROM federated.t1 LEFT JOIN federated.countries
|
||||
ON federated.t1.country_id = federated.countries.id
|
||||
ORDER BY federated.countries.country;
|
||||
id country_id name other country
|
||||
4 4 Monty 33333 Finland
|
||||
2 2 Lenz 22222 Germany
|
||||
1 1 Kumar 11111 India
|
||||
3 3 Marizio 33333 Italy
|
||||
5 5 Sanja 33333 Ukraine
|
||||
EXPLAIN SELECT federated.t1.*, federated.countries.country
|
||||
FROM federated.t1 RIGHT JOIN federated.countries
|
||||
ON federated.t1.country_id = federated.countries.id
|
||||
ORDER BY federated.t1.country_id;
|
||||
id select_type table type possible_keys key key_len ref rows Extra
|
||||
1 SIMPLE countries ALL NULL NULL NULL NULL 5 Using temporary; Using filesort
|
||||
1 SIMPLE t1 ref country_id country_id 4 federated.countries.id 120
|
||||
SELECT federated.t1.*, federated.countries.country
|
||||
FROM federated.t1 RIGHT JOIN federated.countries
|
||||
ON federated.t1.country_id = federated.countries.id
|
||||
ORDER BY federated.t1.country_id;
|
||||
id country_id name other country
|
||||
1 1 Kumar 11111 India
|
||||
2 2 Lenz 22222 Germany
|
||||
|
@ -91,3 +91,20 @@ drop table t1;
|
||||
SELECT NULLIF(5,5) IS NULL, NULLIF(5,5) IS NOT NULL;
|
||||
NULLIF(5,5) IS NULL NULLIF(5,5) IS NOT NULL
|
||||
1 0
|
||||
CREATE TABLE `t1` (
|
||||
`id` int(11) NOT NULL ,
|
||||
`date` int(10) default NULL,
|
||||
`text` varchar(32) NOT NULL
|
||||
);
|
||||
INSERT INTO t1 VALUES (1,1110000000,'Day 1'),(2,1111000000,'Day 2'),(3,1112000000,'Day 3');
|
||||
SELECT id, IF(date IS NULL, '-', FROM_UNIXTIME(date, '%d-%m-%Y')) AS date_ord, text FROM t1 ORDER BY date_ord ASC;
|
||||
id date_ord text
|
||||
1 05-03-2005 Day 1
|
||||
2 16-03-2005 Day 2
|
||||
3 28-03-2005 Day 3
|
||||
SELECT id, IF(date IS NULL, '-', FROM_UNIXTIME(date, '%d-%m-%Y')) AS date_ord, text FROM t1 ORDER BY date_ord DESC;
|
||||
id date_ord text
|
||||
3 28-03-2005 Day 3
|
||||
2 16-03-2005 Day 2
|
||||
1 05-03-2005 Day 1
|
||||
DROP TABLE t1;
|
||||
|
@ -794,3 +794,9 @@ id aes_decrypt(str, 'bar')
|
||||
1 foo
|
||||
2 NULL
|
||||
DROP TABLE t1, t2;
|
||||
select field(0,NULL,1,0), field("",NULL,"bar",""), field(0.0,NULL,1.0,0.0);
|
||||
field(0,NULL,1,0) field("",NULL,"bar","") field(0.0,NULL,1.0,0.0)
|
||||
3 3 3
|
||||
select field(NULL,1,2,NULL), field(NULL,1,2,0);
|
||||
field(NULL,1,2,NULL) field(NULL,1,2,0)
|
||||
0 0
|
||||
|
@ -133,13 +133,13 @@ Table Op Msg_type Msg_text
|
||||
test.t3 analyze status Table is already up to date
|
||||
explain select a1, min(a2) from t1 group by a1;
|
||||
id select_type table type possible_keys key key_len ref rows Extra
|
||||
1 SIMPLE t1 range NULL idx_t1_1 65 NULL 5 Using index for group-by
|
||||
1 SIMPLE t1 range NULL idx_t1_1 130 NULL 5 Using index for group-by
|
||||
explain select a1, max(a2) from t1 group by a1;
|
||||
id select_type table type possible_keys key key_len ref rows Extra
|
||||
1 SIMPLE t1 range NULL idx_t1_1 65 NULL 5 Using index for group-by
|
||||
explain select a1, min(a2), max(a2) from t1 group by a1;
|
||||
id select_type table type possible_keys key key_len ref rows Extra
|
||||
1 SIMPLE t1 range NULL idx_t1_1 65 NULL 5 Using index for group-by
|
||||
1 SIMPLE t1 range NULL idx_t1_1 130 NULL 5 Using index for group-by
|
||||
explain select a1, a2, b, min(c), max(c) from t1 group by a1,a2,b;
|
||||
id select_type table type possible_keys key key_len ref rows Extra
|
||||
1 SIMPLE t1 range NULL idx_t1_1 147 NULL 17 Using index for group-by
|
||||
@ -151,13 +151,13 @@ id select_type table type possible_keys key key_len ref rows Extra
|
||||
1 SIMPLE t2 range NULL idx_t2_1 # NULL # Using index for group-by
|
||||
explain select min(a2), a1, max(a2), min(a2), a1 from t1 group by a1;
|
||||
id select_type table type possible_keys key key_len ref rows Extra
|
||||
1 SIMPLE t1 range NULL idx_t1_1 65 NULL 5 Using index for group-by
|
||||
1 SIMPLE t1 range NULL idx_t1_1 130 NULL 5 Using index for group-by
|
||||
explain select a1, b, min(c), a1, max(c), b, a2, max(c), max(c) from t1 group by a1, a2, b;
|
||||
id select_type table type possible_keys key key_len ref rows Extra
|
||||
1 SIMPLE t1 range NULL idx_t1_1 147 NULL 17 Using index for group-by
|
||||
explain select min(a2) from t1 group by a1;
|
||||
id select_type table type possible_keys key key_len ref rows Extra
|
||||
1 SIMPLE t1 range NULL idx_t1_1 65 NULL 5 Using index for group-by
|
||||
1 SIMPLE t1 range NULL idx_t1_1 130 NULL 5 Using index for group-by
|
||||
explain select a2, min(c), max(c) from t1 group by a1,a2,b;
|
||||
id select_type table type possible_keys key key_len ref rows Extra
|
||||
1 SIMPLE t1 range NULL idx_t1_1 147 NULL 17 Using index for group-by
|
||||
@ -1404,7 +1404,7 @@ id select_type table type possible_keys key key_len ref rows Extra
|
||||
1 SIMPLE t2 range idx_t2_0,idx_t2_1,idx_t2_2 idx_t2_1 163 NULL # Using where; Using index for group-by
|
||||
explain select a1,a2,b,min(c) from t2 where (a1 > 'a') and (a2 > 'a') and (b = 'c') group by a1,a2,b;
|
||||
id select_type table type possible_keys key key_len ref rows Extra
|
||||
1 SIMPLE t2 range idx_t2_0,idx_t2_1,idx_t2_2 idx_t2_1 146 NULL # Using where; Using index for group-by
|
||||
1 SIMPLE t2 range idx_t2_0,idx_t2_1,idx_t2_2 idx_t2_1 163 NULL # Using where; Using index for group-by
|
||||
select a1,a2,b,min(c),max(c) from t1 where (a1 >= 'c' or a2 < 'b') and (b > 'a') group by a1,a2,b;
|
||||
a1 a2 b min(c) max(c)
|
||||
a a b e112 h112
|
||||
@ -1838,7 +1838,7 @@ id select_type table type possible_keys key key_len ref rows Extra
|
||||
1 SIMPLE t1 range idx_t1_0,idx_t1_1,idx_t1_2 idx_t1_1 147 NULL 10 Using where; Using index for group-by
|
||||
explain select concat(ord(min(b)),ord(max(b))),min(b),max(b) from t1 group by a1,a2;
|
||||
id select_type table type possible_keys key key_len ref rows Extra
|
||||
1 SIMPLE t1 range NULL idx_t1_1 130 NULL 9 Using index for group-by
|
||||
1 SIMPLE t1 range NULL idx_t1_1 147 NULL 9 Using index for group-by
|
||||
select a1,a2,b, concat(min(c), max(c)) from t1 where a1 < 'd' group by a1,a2,b;
|
||||
a1 a2 b concat(min(c), max(c))
|
||||
a a a a111d111
|
||||
|
@ -470,7 +470,7 @@ s1
|
||||
drop table t1;
|
||||
SHOW CREATE TABLE INFORMATION_SCHEMA.character_sets;
|
||||
Table Create Table
|
||||
character_sets CREATE TEMPORARY TABLE `character_sets` (
|
||||
CHARACTER_SETS CREATE TEMPORARY TABLE `CHARACTER_SETS` (
|
||||
`CHARACTER_SET_NAME` varchar(64) NOT NULL default '',
|
||||
`DEFAULT_COLLATE_NAME` varchar(64) NOT NULL default '',
|
||||
`DESCRIPTION` varchar(60) NOT NULL default '',
|
||||
@ -479,7 +479,7 @@ character_sets CREATE TEMPORARY TABLE `character_sets` (
|
||||
set names latin2;
|
||||
SHOW CREATE TABLE INFORMATION_SCHEMA.character_sets;
|
||||
Table Create Table
|
||||
character_sets CREATE TEMPORARY TABLE `character_sets` (
|
||||
CHARACTER_SETS CREATE TEMPORARY TABLE `CHARACTER_SETS` (
|
||||
`CHARACTER_SET_NAME` varchar(64) NOT NULL default '',
|
||||
`DEFAULT_COLLATE_NAME` varchar(64) NOT NULL default '',
|
||||
`DESCRIPTION` varchar(60) NOT NULL default '',
|
||||
|
@ -47,3 +47,13 @@ unlock tables;
|
||||
lock tables t1 write, t1 as t1_alias read;
|
||||
insert into t1 select index1,nr from t1 as t1_alias;
|
||||
drop table t1,t2;
|
||||
create table t1 ( a int(11) not null auto_increment, primary key(a));
|
||||
create table t2 ( a int(11) not null auto_increment, primary key(a));
|
||||
lock tables t1 write, t2 read;
|
||||
delete from t1 using t1,t2 where t1.a=t2.a;
|
||||
delete t1 from t1,t2 where t1.a=t2.a;
|
||||
delete from t2 using t1,t2 where t1.a=t2.a;
|
||||
ERROR HY000: Table 't2' was locked with a READ lock and can't be updated
|
||||
delete t2 from t1,t2 where t1.a=t2.a;
|
||||
ERROR HY000: Table 't2' was locked with a READ lock and can't be updated
|
||||
drop table t1,t2;
|
||||
|
@ -72,7 +72,7 @@ T1 CREATE TABLE `T1` (
|
||||
RENAME TABLE T1 TO T2;
|
||||
SHOW TABLES LIKE "T2";
|
||||
Tables_in_test (T2)
|
||||
t2
|
||||
T2
|
||||
SELECT * FROM t2;
|
||||
a
|
||||
1
|
||||
@ -83,25 +83,25 @@ t3
|
||||
RENAME TABLE T3 TO T1;
|
||||
SHOW TABLES LIKE "T1";
|
||||
Tables_in_test (T1)
|
||||
t1
|
||||
T1
|
||||
ALTER TABLE T1 add b int;
|
||||
SHOW TABLES LIKE "T1";
|
||||
Tables_in_test (T1)
|
||||
t1
|
||||
T1
|
||||
ALTER TABLE T1 RENAME T2;
|
||||
SHOW TABLES LIKE "T2";
|
||||
Tables_in_test (T2)
|
||||
t2
|
||||
T2
|
||||
LOCK TABLE T2 WRITE;
|
||||
ALTER TABLE T2 drop b;
|
||||
SHOW TABLES LIKE "T2";
|
||||
Tables_in_test (T2)
|
||||
t2
|
||||
T2
|
||||
UNLOCK TABLES;
|
||||
RENAME TABLE T2 TO T1;
|
||||
SHOW TABLES LIKE "T1";
|
||||
Tables_in_test (T1)
|
||||
t1
|
||||
T1
|
||||
SELECT * from T1;
|
||||
a
|
||||
1
|
||||
|
50
mysql-test/r/mysql.result
Normal file
50
mysql-test/r/mysql.result
Normal file
@ -0,0 +1,50 @@
|
||||
drop table if exists t1;
|
||||
create table t1(a int);
|
||||
insert into t1 values(1);
|
||||
|
||||
Test default delimiter ;
|
||||
a
|
||||
1
|
||||
|
||||
Test delimiter without arg
|
||||
|
||||
Test delimiter :
|
||||
a
|
||||
1
|
||||
|
||||
Test delimiter :
|
||||
a
|
||||
1
|
||||
|
||||
Test delimiter :;
|
||||
a
|
||||
1
|
||||
|
||||
Test delimiter //
|
||||
a
|
||||
1
|
||||
|
||||
Test delimiter MySQL
|
||||
a
|
||||
1
|
||||
|
||||
Test delimiter delimiter
|
||||
a
|
||||
1
|
||||
|
||||
Test delimiter : from command line
|
||||
a
|
||||
1
|
||||
|
||||
Test delimiter :; from command line
|
||||
a
|
||||
1
|
||||
|
||||
Test 'go' command(vertical output) G
|
||||
*************************** 1. row ***************************
|
||||
a: 1
|
||||
|
||||
Test 'go' command g
|
||||
a
|
||||
1
|
||||
drop table t1;
|
@ -1384,3 +1384,41 @@ UNLOCK TABLES;
|
||||
/*!40111 SET SQL_NOTES=@OLD_SQL_NOTES */;
|
||||
|
||||
drop table t1;
|
||||
CREATE TABLE t1 (a int);
|
||||
INSERT INTO t1 VALUES (1),(2),(3);
|
||||
|
||||
/*!40101 SET @OLD_CHARACTER_SET_CLIENT=@@CHARACTER_SET_CLIENT */;
|
||||
/*!40101 SET @OLD_CHARACTER_SET_RESULTS=@@CHARACTER_SET_RESULTS */;
|
||||
/*!40101 SET @OLD_COLLATION_CONNECTION=@@COLLATION_CONNECTION */;
|
||||
/*!40101 SET NAMES utf8 */;
|
||||
/*!40014 SET @OLD_UNIQUE_CHECKS=@@UNIQUE_CHECKS, UNIQUE_CHECKS=0 */;
|
||||
/*!40014 SET @OLD_FOREIGN_KEY_CHECKS=@@FOREIGN_KEY_CHECKS, FOREIGN_KEY_CHECKS=0 */;
|
||||
/*!40101 SET @OLD_SQL_MODE=@@SQL_MODE, SQL_MODE='NO_AUTO_VALUE_ON_ZERO' */;
|
||||
/*!40111 SET @OLD_SQL_NOTES=@@SQL_NOTES, SQL_NOTES=0 */;
|
||||
|
||||
/*!40000 DROP DATABASE IF EXISTS `test`*/;
|
||||
|
||||
CREATE DATABASE /*!32312 IF NOT EXISTS*/ `test` /*!40100 DEFAULT CHARACTER SET latin1 */;
|
||||
|
||||
USE `test`;
|
||||
DROP TABLE IF EXISTS `t1`;
|
||||
CREATE TABLE `t1` (
|
||||
`a` int(11) default NULL
|
||||
) ENGINE=MyISAM DEFAULT CHARSET=latin1;
|
||||
|
||||
|
||||
/*!40000 ALTER TABLE `t1` DISABLE KEYS */;
|
||||
LOCK TABLES `t1` WRITE;
|
||||
INSERT INTO `t1` VALUES (1),(2),(3);
|
||||
UNLOCK TABLES;
|
||||
/*!40000 ALTER TABLE `t1` ENABLE KEYS */;
|
||||
|
||||
/*!40101 SET SQL_MODE=@OLD_SQL_MODE */;
|
||||
/*!40014 SET FOREIGN_KEY_CHECKS=@OLD_FOREIGN_KEY_CHECKS */;
|
||||
/*!40014 SET UNIQUE_CHECKS=@OLD_UNIQUE_CHECKS */;
|
||||
/*!40101 SET CHARACTER_SET_CLIENT=@OLD_CHARACTER_SET_CLIENT */;
|
||||
/*!40101 SET CHARACTER_SET_RESULTS=@OLD_CHARACTER_SET_RESULTS */;
|
||||
/*!40101 SET COLLATION_CONNECTION=@OLD_COLLATION_CONNECTION */;
|
||||
/*!40111 SET SQL_NOTES=@OLD_SQL_NOTES */;
|
||||
|
||||
DROP TABLE t1;
|
||||
|
@ -253,7 +253,7 @@ concat(':',product,':') sum(profit) avg(profit)
|
||||
:Computer: 6900 1380.00000
|
||||
:Phone: 10 10.00000
|
||||
:TV: 600 120.00000
|
||||
:TV: 7785 519.00000
|
||||
NULL 7785 519.00000
|
||||
select product, country_id , year, sum(profit) from t1 group by product, country_id, year with cube;
|
||||
ERROR 42000: This version of MySQL doesn't yet support 'CUBE'
|
||||
explain select product, country_id , year, sum(profit) from t1 group by product, country_id, year with cube;
|
||||
@ -489,3 +489,69 @@ a SUM(a) SUM(a)+1 CONCAT(SUM(a),'x') SUM(a)+SUM(a) SUM(a)
|
||||
5 5 6 5x 10 5
|
||||
NULL 8 9 8x 16 8
|
||||
DROP TABLE t1;
|
||||
CREATE TABLE t1 (a int(11));
|
||||
INSERT INTO t1 VALUES (1),(2);
|
||||
SELECT a, a+1, SUM(a) FROM t1 GROUP BY a WITH ROLLUP;
|
||||
a a+1 SUM(a)
|
||||
1 2 1
|
||||
2 3 2
|
||||
NULL NULL 3
|
||||
SELECT a+1 FROM t1 GROUP BY a WITH ROLLUP;
|
||||
a+1
|
||||
2
|
||||
3
|
||||
NULL
|
||||
SELECT a+SUM(a) FROM t1 GROUP BY a WITH ROLLUP;
|
||||
a+SUM(a)
|
||||
2
|
||||
4
|
||||
NULL
|
||||
SELECT a, a+1 as b FROM t1 GROUP BY a WITH ROLLUP HAVING b > 2;
|
||||
a b
|
||||
2 3
|
||||
SELECT a, a+1 as b FROM t1 GROUP BY a WITH ROLLUP HAVING a IS NULL;
|
||||
a b
|
||||
NULL NULL
|
||||
SELECT a, a+1 as b FROM t1 GROUP BY a WITH ROLLUP HAVING b IS NULL;
|
||||
a b
|
||||
NULL NULL
|
||||
SELECT IFNULL(a, 'TEST') FROM t1 GROUP BY a WITH ROLLUP;
|
||||
IFNULL(a, 'TEST')
|
||||
1
|
||||
2
|
||||
TEST
|
||||
CREATE TABLE t2 (a int, b int);
|
||||
INSERT INTO t2 VALUES
|
||||
(1,4),
|
||||
(2,2), (2,2),
|
||||
(4,1), (4,1), (4,1), (4,1),
|
||||
(2,1), (2,1);
|
||||
SELECT a,b,SUM(b) FROM t2 GROUP BY a,b WITH ROLLUP;
|
||||
a b SUM(b)
|
||||
1 4 4
|
||||
1 NULL 4
|
||||
2 1 2
|
||||
2 2 4
|
||||
2 NULL 6
|
||||
4 1 4
|
||||
4 NULL 4
|
||||
NULL NULL 14
|
||||
SELECT a,b,SUM(b), a+b as c FROM t2
|
||||
GROUP BY a,b WITH ROLLUP HAVING c IS NULL;
|
||||
a b SUM(b) c
|
||||
1 NULL 4 NULL
|
||||
2 NULL 6 NULL
|
||||
4 NULL 4 NULL
|
||||
NULL NULL 14 NULL
|
||||
SELECT IFNULL(a, 'TEST'), COALESCE(b, 'TEST') FROM t2
|
||||
GROUP BY a, b WITH ROLLUP;
|
||||
IFNULL(a, 'TEST') COALESCE(b, 'TEST')
|
||||
1 4
|
||||
1 TEST
|
||||
2 1
|
||||
2 2
|
||||
2 TEST
|
||||
4 1
|
||||
4 TEST
|
||||
TEST TEST
|
||||
DROP TABLE t1,t2;
|
||||
|
@ -1,2 +0,0 @@
|
||||
Variable_name Value
|
||||
lower_case_table_names 1
|
@ -1,7 +0,0 @@
|
||||
use COM1;
|
||||
ERROR 42000: Unknown database 'com1'
|
||||
use LPT1;
|
||||
ERROR 42000: Unknown database 'lpt1'
|
||||
use PRN;
|
||||
ERROR 42000: Unknown database 'prn'
|
||||
|
@ -9,6 +9,7 @@ BEGIN;
|
||||
INSERT INTO t1 VALUES (1);
|
||||
OPTIMIZE TABLE t1;
|
||||
Table Op Msg_type Msg_text
|
||||
test.t1 optimize error Lock wait timeout exceeded; try restarting transaction
|
||||
test.t1 optimize status Operation failed
|
||||
Warnings:
|
||||
Error 1205 Lock wait timeout exceeded; try restarting transaction
|
||||
|
@ -68,14 +68,14 @@ master-bin.000002 260 Query 1 346 use `test`; create table t1 (n int)
|
||||
master-bin.000002 346 Query 1 434 use `test`; insert into t1 values (1)
|
||||
master-bin.000002 434 Query 1 510 use `test`; drop table t1
|
||||
show binary logs;
|
||||
Log_name
|
||||
master-bin.000001
|
||||
master-bin.000002
|
||||
Log_name File_size
|
||||
master-bin.000001 0
|
||||
master-bin.000002 510
|
||||
start slave;
|
||||
show binary logs;
|
||||
Log_name
|
||||
slave-bin.000001
|
||||
slave-bin.000002
|
||||
Log_name File_size
|
||||
slave-bin.000001 0
|
||||
slave-bin.000002 348
|
||||
show binlog events in 'slave-bin.000001' from 4;
|
||||
Log_name Pos Event_type Server_id End_log_pos Info
|
||||
slave-bin.000001 4 Format_desc 2 98 Server ver: VERSION, Binlog ver: 4
|
||||
|
@ -26,10 +26,10 @@ create table t2(m int not null auto_increment primary key);
|
||||
insert into t2 values (34),(67),(123);
|
||||
flush logs;
|
||||
show binary logs;
|
||||
Log_name
|
||||
master-bin.000001
|
||||
master-bin.000002
|
||||
master-bin.000003
|
||||
Log_name File_size
|
||||
master-bin.000001 0
|
||||
master-bin.000002 0
|
||||
master-bin.000003 98
|
||||
create table t3 select * from temp_table;
|
||||
select * from t3;
|
||||
a
|
||||
@ -42,18 +42,18 @@ set global sql_slave_skip_counter=1;
|
||||
start slave;
|
||||
purge master logs to 'master-bin.000002';
|
||||
show master logs;
|
||||
Log_name
|
||||
master-bin.000002
|
||||
master-bin.000003
|
||||
Log_name File_size
|
||||
master-bin.000002 0
|
||||
master-bin.000003 407
|
||||
purge binary logs to 'master-bin.000002';
|
||||
show binary logs;
|
||||
Log_name
|
||||
master-bin.000002
|
||||
master-bin.000003
|
||||
Log_name File_size
|
||||
master-bin.000002 0
|
||||
master-bin.000003 407
|
||||
purge master logs before now();
|
||||
show binary logs;
|
||||
Log_name
|
||||
master-bin.000003
|
||||
Log_name File_size
|
||||
master-bin.000003 407
|
||||
insert into t2 values (65);
|
||||
show slave status;
|
||||
Slave_IO_State Master_Host Master_User Master_Port Connect_Retry Master_Log_File Read_Master_Log_Pos Relay_Log_File Relay_Log_Pos Relay_Master_Log_File Slave_IO_Running Slave_SQL_Running Replicate_Do_DB Replicate_Ignore_DB Replicate_Do_Table Replicate_Ignore_Table Replicate_Wild_Do_Table Replicate_Wild_Ignore_Table Last_Errno Last_Error Skip_Counter Exec_Master_Log_Pos Relay_Log_Space Until_Condition Until_Log_File Until_Log_Pos Master_SSL_Allowed Master_SSL_CA_File Master_SSL_CA_Path Master_SSL_Cert Master_SSL_Cipher Master_SSL_Key Seconds_Behind_Master
|
||||
@ -73,10 +73,10 @@ count(*)
|
||||
100
|
||||
create table t4 select * from temp_table;
|
||||
show binary logs;
|
||||
Log_name
|
||||
master-bin.000003
|
||||
master-bin.000004
|
||||
master-bin.000005
|
||||
Log_name File_size
|
||||
master-bin.000003 0
|
||||
master-bin.000004 0
|
||||
master-bin.000005 2032
|
||||
show master status;
|
||||
File Position Binlog_Do_DB Binlog_Ignore_DB
|
||||
master-bin.000005 2032
|
||||
|
@ -2423,6 +2423,12 @@ ERROR HY000: Incorrect usage of ALL and DISTINCT
|
||||
select distinct all * from t1;
|
||||
ERROR HY000: Incorrect usage of ALL and DISTINCT
|
||||
drop table t1;
|
||||
CREATE TABLE t1 (b BIGINT(20) UNSIGNED NOT NULL, PRIMARY KEY (b));
|
||||
INSERT INTO t1 VALUES (0x8000000000000000);
|
||||
SELECT b FROM t1 WHERE b=0x8000000000000000;
|
||||
b
|
||||
9223372036854775808
|
||||
DROP TABLE t1;
|
||||
CREATE TABLE t1 (
|
||||
K2C4 varchar(4) character set latin1 collate latin1_bin NOT NULL default '',
|
||||
K4N4 varchar(4) character set latin1 collate latin1_bin NOT NULL default '0000',
|
||||
|
@ -1,6 +1,10 @@
|
||||
drop table if exists t1,v1;
|
||||
drop view if exists t1,v1;
|
||||
drop procedure if exists f1;
|
||||
use test;
|
||||
create table t1 (field1 INT);
|
||||
CREATE VIEW v1 AS SELECT field1 FROM t1;
|
||||
drop view v1;
|
||||
drop table t1;
|
||||
create procedure f1() select 1;
|
||||
drop procedure f1;
|
@ -646,4 +646,29 @@ drop procedure if exists bug10537|
|
||||
create procedure bug10537()
|
||||
load data local infile '/tmp/somefile' into table t1|
|
||||
ERROR 0A000: LOAD DATA is not allowed in stored procedures
|
||||
drop function if exists bug8409|
|
||||
create function bug8409()
|
||||
returns int
|
||||
begin
|
||||
flush tables;
|
||||
return 5;
|
||||
end|
|
||||
ERROR 0A000: FLUSH is not allowed in stored procedures
|
||||
create procedure bug9529_90123456789012345678901234567890123456789012345678901234567890()
|
||||
begin
|
||||
end|
|
||||
ERROR 42000: Identifier name 'bug9529_90123456789012345678901234567890123456789012345678901234567890' is too long
|
||||
drop procedure if exists bug10969|
|
||||
create procedure bug10969()
|
||||
begin
|
||||
declare s1 int default 0;
|
||||
select default(s1) from t30;
|
||||
end|
|
||||
ERROR 42000: Incorrect column name 's1'
|
||||
create procedure bug10969()
|
||||
begin
|
||||
declare s1 int default 0;
|
||||
select default(t30.s1) from t30;
|
||||
end|
|
||||
drop procedure bug10969|
|
||||
drop table t1|
|
||||
|
@ -3098,4 +3098,44 @@ call bug5963_2(1)|
|
||||
call bug5963_2(1)|
|
||||
drop procedure bug5963_2|
|
||||
drop table t3|
|
||||
drop function if exists bug9559|
|
||||
create function bug9559()
|
||||
returns int
|
||||
begin
|
||||
set @y = -6/2;
|
||||
return @y;
|
||||
end|
|
||||
select bug9559()|
|
||||
bug9559()
|
||||
-3
|
||||
drop function bug9559|
|
||||
drop procedure if exists bug10961|
|
||||
create procedure bug10961()
|
||||
begin
|
||||
declare v char;
|
||||
declare x int;
|
||||
declare c cursor for select * from dual;
|
||||
declare continue handler for sqlexception select x;
|
||||
set x = 1;
|
||||
open c;
|
||||
set x = 2;
|
||||
fetch c into v;
|
||||
set x = 3;
|
||||
close c;
|
||||
end|
|
||||
call bug10961()|
|
||||
x
|
||||
1
|
||||
x
|
||||
2
|
||||
x
|
||||
3
|
||||
call bug10961()|
|
||||
x
|
||||
1
|
||||
x
|
||||
2
|
||||
x
|
||||
3
|
||||
drop procedure bug10961|
|
||||
drop table t1,t2;
|
||||
|
@ -140,6 +140,48 @@ drop trigger t1.trg1;
|
||||
drop trigger t1.trg2;
|
||||
drop trigger t1.trg3;
|
||||
drop table t1;
|
||||
create table t1 (id int not null primary key, data int);
|
||||
create trigger t1_bi before insert on t1 for each row
|
||||
set @log:= concat(@log, "(BEFORE_INSERT: new=(id=", new.id, ", data=", new.data,"))");
|
||||
create trigger t1_ai after insert on t1 for each row
|
||||
set @log:= concat(@log, "(AFTER_INSERT: new=(id=", new.id, ", data=", new.data,"))");
|
||||
create trigger t1_bu before update on t1 for each row
|
||||
set @log:= concat(@log, "(BEFORE_UPDATE: old=(id=", old.id, ", data=", old.data,
|
||||
") new=(id=", new.id, ", data=", new.data,"))");
|
||||
create trigger t1_au after update on t1 for each row
|
||||
set @log:= concat(@log, "(AFTER_UPDATE: old=(id=", old.id, ", data=", old.data,
|
||||
") new=(id=", new.id, ", data=", new.data,"))");
|
||||
create trigger t1_bd before delete on t1 for each row
|
||||
set @log:= concat(@log, "(BEFORE_DELETE: old=(id=", old.id, ", data=", old.data,"))");
|
||||
create trigger t1_ad after delete on t1 for each row
|
||||
set @log:= concat(@log, "(AFTER_DELETE: old=(id=", old.id, ", data=", old.data,"))");
|
||||
set @log:= "";
|
||||
insert into t1 values (1, 1);
|
||||
select @log;
|
||||
@log
|
||||
(BEFORE_INSERT: new=(id=1, data=1))(AFTER_INSERT: new=(id=1, data=1))
|
||||
set @log:= "";
|
||||
insert ignore t1 values (1, 2);
|
||||
select @log;
|
||||
@log
|
||||
(BEFORE_INSERT: new=(id=1, data=2))
|
||||
set @log:= "";
|
||||
replace t1 values (1, 3), (2, 2);
|
||||
select @log;
|
||||
@log
|
||||
(BEFORE_INSERT: new=(id=1, data=3))(BEFORE_UPDATE: old=(id=1, data=1) new=(id=1, data=3))(AFTER_UPDATE: old=(id=1, data=1) new=(id=1, data=3))(BEFORE_INSERT: new=(id=2, data=2))(AFTER_INSERT: new=(id=2, data=2))
|
||||
alter table t1 add ts timestamp default now();
|
||||
set @log:= "";
|
||||
replace t1 (id, data) values (1, 4);
|
||||
select @log;
|
||||
@log
|
||||
(BEFORE_INSERT: new=(id=1, data=4))(BEFORE_DELETE: old=(id=1, data=3))(AFTER_DELETE: old=(id=1, data=3))(AFTER_INSERT: new=(id=1, data=4))
|
||||
set @log:= "";
|
||||
insert into t1 (id, data) values (1, 5), (3, 3) on duplicate key update data= data + 2;
|
||||
select @log;
|
||||
@log
|
||||
(BEFORE_INSERT: new=(id=1, data=5))(BEFORE_UPDATE: old=(id=1, data=4) new=(id=1, data=6))(AFTER_UPDATE: old=(id=1, data=4) new=(id=1, data=6))(BEFORE_INSERT: new=(id=3, data=3))(AFTER_INSERT: new=(id=3, data=3))
|
||||
drop table t1;
|
||||
create table t1 (i int);
|
||||
create trigger trg before insert on t1 for each row set @a:= old.i;
|
||||
ERROR HY000: There is no OLD row in on INSERT trigger
|
||||
@ -206,3 +248,237 @@ create table t1 (i int);
|
||||
create trigger trg1 before insert on t1 for each row set @a:= 1;
|
||||
drop database mysqltest;
|
||||
use test;
|
||||
create table t1 (i int, j int default 10, k int not null, key (k));
|
||||
create table t2 (i int);
|
||||
insert into t1 (i, k) values (1, 1);
|
||||
insert into t2 values (1);
|
||||
create trigger trg1 before update on t1 for each row set @a:= @a + new.j - old.j;
|
||||
create trigger trg2 after update on t1 for each row set @b:= "Fired";
|
||||
set @a:= 0, @b:= "";
|
||||
update t1, t2 set j = j + 10 where t1.i = t2.i;
|
||||
select @a, @b;
|
||||
@a @b
|
||||
10 Fired
|
||||
insert into t1 values (2, 13, 2);
|
||||
insert into t2 values (2);
|
||||
set @a:= 0, @b:= "";
|
||||
update t1, t2 set j = j + 15 where t1.i = t2.i and t1.k >= 2;
|
||||
select @a, @b;
|
||||
@a @b
|
||||
15 Fired
|
||||
create trigger trg3 before delete on t1 for each row set @c:= @c + old.j;
|
||||
create trigger trg4 before delete on t2 for each row set @d:= @d + old.i;
|
||||
create trigger trg5 after delete on t1 for each row set @e:= "After delete t1 fired";
|
||||
create trigger trg6 after delete on t2 for each row set @f:= "After delete t2 fired";
|
||||
set @c:= 0, @d:= 0, @e:= "", @f:= "";
|
||||
delete t1, t2 from t1, t2 where t1.i = t2.i;
|
||||
select @c, @d, @e, @f;
|
||||
@c @d @e @f
|
||||
48 3 After delete t1 fired After delete t2 fired
|
||||
drop table t1, t2;
|
||||
create table t1 (i int, j int default 10)|
|
||||
create table t2 (i int)|
|
||||
insert into t2 values (1), (2)|
|
||||
create trigger trg1 before insert on t1 for each row
|
||||
begin
|
||||
if new.i = 1 then
|
||||
set new.j := 1;
|
||||
end if;
|
||||
end|
|
||||
create trigger trg2 after insert on t1 for each row set @a:= 1|
|
||||
set @a:= 0|
|
||||
insert into t1 (i) select * from t2|
|
||||
select * from t1|
|
||||
i j
|
||||
1 1
|
||||
2 10
|
||||
select @a|
|
||||
@a
|
||||
1
|
||||
drop table t1, t2|
|
||||
create table t1 (i int, j int, k int);
|
||||
create trigger trg1 before insert on t1 for each row set new.k = new.i;
|
||||
create trigger trg2 after insert on t1 for each row set @b:= "Fired";
|
||||
set @b:="";
|
||||
load data infile '../../std_data/rpl_loaddata.dat' into table t1 (@a, i);
|
||||
select *, @b from t1;
|
||||
i j k @b
|
||||
10 NULL 10 Fired
|
||||
15 NULL 15 Fired
|
||||
set @b:="";
|
||||
load data infile '../../std_data/loaddata5.dat' into table t1 fields terminated by '' enclosed by '' (i, j);
|
||||
select *, @b from t1;
|
||||
i j k @b
|
||||
10 NULL 10 Fired
|
||||
15 NULL 15 Fired
|
||||
1 2 1 Fired
|
||||
3 4 3 Fired
|
||||
5 6 5 Fired
|
||||
drop table t1;
|
||||
create table t1 (i int, at int, k int, key(k)) engine=myisam;
|
||||
create table t2 (i int);
|
||||
insert into t1 values (1, 1, 1);
|
||||
insert into t2 values (1), (2), (3);
|
||||
create trigger ai after insert on t1 for each row set @a:= new.at;
|
||||
create trigger au after update on t1 for each row set @a:= new.at;
|
||||
create trigger ad after delete on t1 for each row set @a:= old.at;
|
||||
alter table t1 drop column at;
|
||||
select * from t1;
|
||||
i k
|
||||
1 1
|
||||
insert into t1 values (2, 1);
|
||||
ERROR 42S22: Unknown column 'at' in 'NEW'
|
||||
select * from t1;
|
||||
i k
|
||||
1 1
|
||||
2 1
|
||||
update t1 set k = 2 where i = 2;
|
||||
ERROR 42S22: Unknown column 'at' in 'NEW'
|
||||
select * from t1;
|
||||
i k
|
||||
1 1
|
||||
2 2
|
||||
delete from t1 where i = 2;
|
||||
ERROR 42S22: Unknown column 'at' in 'OLD'
|
||||
select * from t1;
|
||||
i k
|
||||
1 1
|
||||
load data infile '../../std_data/loaddata5.dat' into table t1 fields terminated by '' enclosed by '' (i, k);
|
||||
ERROR 42S22: Unknown column 'at' in 'NEW'
|
||||
select * from t1;
|
||||
i k
|
||||
1 1
|
||||
1 2
|
||||
insert into t1 select 3, 3;
|
||||
ERROR 42S22: Unknown column 'at' in 'NEW'
|
||||
select * from t1;
|
||||
i k
|
||||
1 1
|
||||
1 2
|
||||
3 3
|
||||
update t1, t2 set k = k + 10 where t1.i = t2.i;
|
||||
ERROR 42S22: Unknown column 'at' in 'NEW'
|
||||
select * from t1;
|
||||
i k
|
||||
1 11
|
||||
1 2
|
||||
3 3
|
||||
update t1, t2 set k = k + 10 where t1.i = t2.i and k < 3;
|
||||
ERROR 42S22: Unknown column 'at' in 'NEW'
|
||||
select * from t1;
|
||||
i k
|
||||
1 11
|
||||
1 12
|
||||
3 3
|
||||
delete t1, t2 from t1 straight_join t2 where t1.i = t2.i;
|
||||
ERROR 42S22: Unknown column 'at' in 'OLD'
|
||||
select * from t1;
|
||||
i k
|
||||
1 12
|
||||
3 3
|
||||
delete t2, t1 from t2 straight_join t1 where t1.i = t2.i;
|
||||
ERROR 42S22: Unknown column 'at' in 'OLD'
|
||||
select * from t1;
|
||||
i k
|
||||
3 3
|
||||
alter table t1 add primary key (i);
|
||||
insert into t1 values (3, 4) on duplicate key update k= k + 10;
|
||||
ERROR 42S22: Unknown column 'at' in 'NEW'
|
||||
select * from t1;
|
||||
i k
|
||||
3 13
|
||||
replace into t1 values (3, 3);
|
||||
ERROR 42S22: Unknown column 'at' in 'NEW'
|
||||
select * from t1;
|
||||
i k
|
||||
3 3
|
||||
alter table t1 add ts timestamp default now();
|
||||
replace into t1 (i, k) values (3, 13);
|
||||
ERROR 42S22: Unknown column 'at' in 'OLD'
|
||||
select * from t1;
|
||||
i k ts
|
||||
drop table t1, t2;
|
||||
create table t1 (i int, bt int, k int, key(k)) engine=myisam;
|
||||
create table t2 (i int);
|
||||
insert into t1 values (1, 1, 1), (2, 2, 2);
|
||||
insert into t2 values (1), (2), (3);
|
||||
create trigger bi before insert on t1 for each row set @a:= new.bt;
|
||||
create trigger bu before update on t1 for each row set @a:= new.bt;
|
||||
create trigger bd before delete on t1 for each row set @a:= old.bt;
|
||||
alter table t1 drop column bt;
|
||||
insert into t1 values (3, 3);
|
||||
ERROR 42S22: Unknown column 'bt' in 'NEW'
|
||||
select * from t1;
|
||||
i k
|
||||
1 1
|
||||
2 2
|
||||
update t1 set i = 2;
|
||||
ERROR 42S22: Unknown column 'bt' in 'NEW'
|
||||
select * from t1;
|
||||
i k
|
||||
1 1
|
||||
2 2
|
||||
delete from t1;
|
||||
ERROR 42S22: Unknown column 'bt' in 'OLD'
|
||||
select * from t1;
|
||||
i k
|
||||
1 1
|
||||
2 2
|
||||
load data infile '../../std_data/loaddata5.dat' into table t1 fields terminated by '' enclosed by '' (i, k);
|
||||
ERROR 42S22: Unknown column 'bt' in 'NEW'
|
||||
select * from t1;
|
||||
i k
|
||||
1 1
|
||||
2 2
|
||||
insert into t1 select 3, 3;
|
||||
ERROR 42S22: Unknown column 'bt' in 'NEW'
|
||||
select * from t1;
|
||||
i k
|
||||
1 1
|
||||
2 2
|
||||
update t1, t2 set k = k + 10 where t1.i = t2.i;
|
||||
ERROR 42S22: Unknown column 'bt' in 'NEW'
|
||||
select * from t1;
|
||||
i k
|
||||
1 1
|
||||
2 2
|
||||
update t1, t2 set k = k + 10 where t1.i = t2.i and k < 2;
|
||||
ERROR 42S22: Unknown column 'bt' in 'NEW'
|
||||
select * from t1;
|
||||
i k
|
||||
1 1
|
||||
2 2
|
||||
delete t1, t2 from t1 straight_join t2 where t1.i = t2.i;
|
||||
ERROR 42S22: Unknown column 'bt' in 'OLD'
|
||||
select * from t1;
|
||||
i k
|
||||
1 1
|
||||
2 2
|
||||
delete t2, t1 from t2 straight_join t1 where t1.i = t2.i;
|
||||
ERROR 42S22: Unknown column 'bt' in 'OLD'
|
||||
select * from t1;
|
||||
i k
|
||||
1 1
|
||||
2 2
|
||||
alter table t1 add primary key (i);
|
||||
drop trigger t1.bi;
|
||||
insert into t1 values (2, 4) on duplicate key update k= k + 10;
|
||||
ERROR 42S22: Unknown column 'bt' in 'NEW'
|
||||
select * from t1;
|
||||
i k
|
||||
1 1
|
||||
2 2
|
||||
replace into t1 values (2, 4);
|
||||
ERROR 42S22: Unknown column 'bt' in 'NEW'
|
||||
select * from t1;
|
||||
i k
|
||||
1 1
|
||||
2 2
|
||||
alter table t1 add ts timestamp default now();
|
||||
replace into t1 (i, k) values (2, 11);
|
||||
ERROR 42S22: Unknown column 'bt' in 'OLD'
|
||||
select * from t1;
|
||||
i k ts
|
||||
1 1 0000-00-00 00:00:00
|
||||
2 2 0000-00-00 00:00:00
|
||||
drop table t1, t2;
|
||||
|
@ -1252,3 +1252,36 @@ t2 CREATE TABLE `t2` (
|
||||
`a` varchar(12) default NULL
|
||||
) ENGINE=MyISAM DEFAULT CHARSET=latin1 ROW_FORMAT=FIXED
|
||||
drop table t1,t2;
|
||||
CREATE TABLE t1 (a mediumtext);
|
||||
CREATE TABLE t2 (b varchar(20));
|
||||
INSERT INTO t1 VALUES ('a'),('b');
|
||||
SELECT left(a,100000000) FROM t1 UNION SELECT b FROM t2;
|
||||
left(a,100000000)
|
||||
a
|
||||
b
|
||||
create table t3 SELECT left(a,100000000) FROM t1 UNION SELECT b FROM t2;
|
||||
show create table t3;
|
||||
Table Create Table
|
||||
t3 CREATE TABLE `t3` (
|
||||
`left(a,100000000)` longtext
|
||||
) ENGINE=MyISAM DEFAULT CHARSET=latin1
|
||||
drop tables t1,t2,t3;
|
||||
create table t1 ( id int not null auto_increment, primary key (id), col1 int);
|
||||
insert into t1 (col1) values (2),(3),(4),(5),(6);
|
||||
select 99 union all select id from t1 order by 1;
|
||||
99
|
||||
1
|
||||
2
|
||||
3
|
||||
4
|
||||
5
|
||||
99
|
||||
select id from t1 union all select 99 order by 1;
|
||||
id
|
||||
1
|
||||
2
|
||||
3
|
||||
4
|
||||
5
|
||||
99
|
||||
drop table t1;
|
||||
|
@ -236,6 +236,12 @@ query_prealloc_size 8192
|
||||
range_alloc_block_size 2048
|
||||
transaction_alloc_block_size 8192
|
||||
transaction_prealloc_size 4096
|
||||
SELECT @@version LIKE 'non-existent';
|
||||
@@version LIKE 'non-existent'
|
||||
0
|
||||
SELECT @@version_compile_os LIKE 'non-existent';
|
||||
@@version_compile_os LIKE 'non-existent'
|
||||
0
|
||||
set big_tables=OFFF;
|
||||
ERROR 42000: Variable 'big_tables' can't be set to the value of 'OFFF'
|
||||
set big_tables="OFFF";
|
||||
|
@ -63,3 +63,15 @@ create table t1 (a char(3), b char(20), primary key (a, b));
|
||||
insert into t1 values ('ABW', 'Dutch'), ('ABW', 'English');
|
||||
select count(distinct a) from t1 group by b;
|
||||
drop table t1;
|
||||
|
||||
#
|
||||
# Bug #9593 "The combination of COUNT, DISTINCT and CONCAT
|
||||
# seems to lock the server"
|
||||
# Bug appears only on Windows system
|
||||
#
|
||||
|
||||
create table t1 (f1 int, f2 int);
|
||||
insert into t1 values (0,1),(1,2);
|
||||
select count(distinct if(f1,3,f2)) from t1;
|
||||
drop table t1;
|
||||
|
||||
|
@ -471,3 +471,33 @@ insert into t2 values ();
|
||||
select * from t1;
|
||||
select * from t2;
|
||||
drop table t1,t2;
|
||||
|
||||
#
|
||||
# Bug#10224 - ANALYZE TABLE crashing with simultaneous
|
||||
# CREATE ... SELECT statement.
|
||||
# This tests two additional possible errors and a hang if
|
||||
# an improper fix is present.
|
||||
#
|
||||
connection default;
|
||||
use test;
|
||||
create table t1 (a int);
|
||||
--error 1093
|
||||
create table t1 select * from t1;
|
||||
--error 1093
|
||||
create table t2 union = (t1) select * from t1;
|
||||
flush tables with read lock;
|
||||
unlock tables;
|
||||
drop table t1;
|
||||
|
||||
#
|
||||
# Bug#10413: Invalid column name is not rejected
|
||||
#
|
||||
--error 1103
|
||||
create table t1(column.name int);
|
||||
--error 1103
|
||||
create table t1(test.column.name int);
|
||||
--error 1102
|
||||
create table t1(xyz.t1.name int);
|
||||
create table t1(t1.name int);
|
||||
create table t2(test.t2.name int);
|
||||
drop table t1,t2;
|
||||
|
85
mysql-test/t/default.test
Normal file
85
mysql-test/t/default.test
Normal file
@ -0,0 +1,85 @@
|
||||
#
|
||||
# test of already fixed bugs
|
||||
#
|
||||
--disable_warnings
|
||||
drop table if exists t1,t2,t3,t4,t5,t6;
|
||||
drop database if exists mysqltest;
|
||||
|
||||
#
|
||||
# Bug 10838
|
||||
# Insert causes warnings for no default values and corrupts tables
|
||||
#
|
||||
CREATE TABLE t1 (a varchar(30) binary NOT NULL DEFAULT ' ',
|
||||
b varchar(1) binary NOT NULL DEFAULT ' ',
|
||||
c varchar(4) binary NOT NULL DEFAULT '0000',
|
||||
d tinyblob NULL,
|
||||
e tinyblob NULL,
|
||||
f tinyblob NULL,
|
||||
g tinyblob NULL,
|
||||
h tinyblob NULL,
|
||||
i tinyblob NULL,
|
||||
j tinyblob NULL,
|
||||
k tinyblob NULL,
|
||||
l tinyblob NULL,
|
||||
m tinyblob NULL,
|
||||
n tinyblob NULL,
|
||||
o tinyblob NULL,
|
||||
p tinyblob NULL,
|
||||
q varchar(30) binary NOT NULL DEFAULT ' ',
|
||||
r varchar(30) binary NOT NULL DEFAULT ' ',
|
||||
s tinyblob NULL,
|
||||
t varchar(4) binary NOT NULL DEFAULT ' ',
|
||||
u varchar(1) binary NOT NULL DEFAULT ' ',
|
||||
v varchar(30) binary NOT NULL DEFAULT ' ',
|
||||
w varchar(30) binary NOT NULL DEFAULT ' ',
|
||||
x tinyblob NULL,
|
||||
y varchar(5) binary NOT NULL DEFAULT ' ',
|
||||
z varchar(20) binary NOT NULL DEFAULT ' ',
|
||||
a1 varchar(30) binary NOT NULL DEFAULT ' ',
|
||||
b1 tinyblob NULL)
|
||||
ENGINE=InnoDB DEFAULT CHARACTER SET = latin1 COLLATE latin1_bin;
|
||||
--enable_warnings
|
||||
|
||||
SHOW CREATE TABLE t1;
|
||||
INSERT into t1 (b) values ('1');
|
||||
SHOW WARNINGS;
|
||||
SELECT * from t1;
|
||||
|
||||
CREATE TABLE t2 (a varchar(30) binary NOT NULL DEFAULT ' ',
|
||||
b varchar(1) binary NOT NULL DEFAULT ' ',
|
||||
c varchar(4) binary NOT NULL DEFAULT '0000',
|
||||
d tinyblob NULL,
|
||||
e tinyblob NULL,
|
||||
f tinyblob NULL,
|
||||
g tinyblob NULL,
|
||||
h tinyblob NULL,
|
||||
i tinyblob NULL,
|
||||
j tinyblob NULL,
|
||||
k tinyblob NULL,
|
||||
l tinyblob NULL,
|
||||
m tinyblob NULL,
|
||||
n tinyblob NULL,
|
||||
o tinyblob NULL,
|
||||
p tinyblob NULL,
|
||||
q varchar(30) binary NOT NULL DEFAULT ' ',
|
||||
r varchar(30) binary NOT NULL DEFAULT ' ',
|
||||
s tinyblob NULL,
|
||||
t varchar(4) binary NOT NULL DEFAULT ' ',
|
||||
u varchar(1) binary NOT NULL DEFAULT ' ',
|
||||
v varchar(30) binary NOT NULL DEFAULT ' ',
|
||||
w varchar(30) binary NOT NULL DEFAULT ' ',
|
||||
x tinyblob NULL,
|
||||
y varchar(5) binary NOT NULL DEFAULT ' ',
|
||||
z varchar(20) binary NOT NULL DEFAULT ' ',
|
||||
a1 varchar(30) binary NOT NULL DEFAULT ' ',
|
||||
b1 tinyblob NULL)
|
||||
ENGINE=MyISAM DEFAULT CHARACTER SET = latin1 COLLATE latin1_bin;
|
||||
|
||||
SHOW CREATE TABLE t2;
|
||||
INSERT into t2 (b) values ('1');
|
||||
SHOW WARNINGS;
|
||||
SELECT * from t2;
|
||||
|
||||
drop table t1;
|
||||
drop table t2;
|
||||
|
@ -861,9 +861,70 @@ INSERT INTO federated.t1 (name, country_id, other) VALUES ('Marizio', 3, 33333);
|
||||
INSERT INTO federated.t1 (name, country_id, other) VALUES ('Monty', 4, 33333);
|
||||
INSERT INTO federated.t1 (name, country_id, other) VALUES ('Sanja', 5, 33333);
|
||||
|
||||
#inner join
|
||||
EXPLAIN SELECT federated.t1.name AS name, federated.t1.country_id AS country_id,
|
||||
federated.t1.other AS other, federated.countries.country AS country
|
||||
FROM federated.t1, federated.countries WHERE
|
||||
federated.t1.country_id = federated.countries.id;
|
||||
|
||||
SELECT federated.t1.name AS name, federated.t1.country_id AS country_id,
|
||||
federated.t1.other AS other, federated.countries.country AS country
|
||||
FROM federated.t1, federated.countries WHERE
|
||||
federated.t1.country_id = federated.countries.id;
|
||||
|
||||
EXPLAIN SELECT federated.t1.name AS name, federated.t1.country_id AS country_id,
|
||||
federated.t1.other AS other, federated.countries.country AS country
|
||||
FROM federated.t1 INNER JOIN federated.countries ON
|
||||
federated.t1.country_id = federated.countries.id;
|
||||
|
||||
SELECT federated.t1.name AS name, federated.t1.country_id AS country_id,
|
||||
federated.t1.other AS other, federated.countries.country AS country
|
||||
FROM federated.t1 INNER JOIN federated.countries ON
|
||||
federated.t1.country_id = federated.countries.id;
|
||||
|
||||
EXPLAIN SELECT federated.t1.name AS name, federated.t1.country_id AS country_id,
|
||||
federated.t1.other AS other, federated.countries.country AS country
|
||||
FROM federated.t1 INNER JOIN federated.countries ON
|
||||
federated.t1.country_id = federated.countries.id
|
||||
WHERE federated.t1.name = 'Monty';
|
||||
|
||||
SELECT federated.t1.name AS name, federated.t1.country_id AS country_id,
|
||||
federated.t1.other AS other, federated.countries.country AS country
|
||||
FROM federated.t1 INNER JOIN federated.countries ON
|
||||
federated.t1.country_id = federated.countries.id
|
||||
WHERE federated.t1.name = 'Monty';
|
||||
|
||||
#left join
|
||||
EXPLAIN SELECT federated.t1.*, federated.countries.country
|
||||
FROM federated.t1 LEFT JOIN federated.countries
|
||||
ON federated.t1.country_id = federated.countries.id
|
||||
ORDER BY federated.countries.id;
|
||||
|
||||
SELECT federated.t1.*, federated.countries.country
|
||||
FROM federated.t1 left join federated.countries
|
||||
ON federated.t1.country_id = federated.countries.id;
|
||||
FROM federated.t1 LEFT JOIN federated.countries
|
||||
ON federated.t1.country_id = federated.countries.id
|
||||
ORDER BY federated.countries.id;
|
||||
|
||||
EXPLAIN SELECT federated.t1.*, federated.countries.country
|
||||
FROM federated.t1 LEFT JOIN federated.countries
|
||||
ON federated.t1.country_id = federated.countries.id
|
||||
ORDER BY federated.countries.country;
|
||||
|
||||
SELECT federated.t1.*, federated.countries.country
|
||||
FROM federated.t1 LEFT JOIN federated.countries
|
||||
ON federated.t1.country_id = federated.countries.id
|
||||
ORDER BY federated.countries.country;
|
||||
|
||||
#right join
|
||||
EXPLAIN SELECT federated.t1.*, federated.countries.country
|
||||
FROM federated.t1 RIGHT JOIN federated.countries
|
||||
ON federated.t1.country_id = federated.countries.id
|
||||
ORDER BY federated.t1.country_id;
|
||||
|
||||
SELECT federated.t1.*, federated.countries.country
|
||||
FROM federated.t1 RIGHT JOIN federated.countries
|
||||
ON federated.t1.country_id = federated.countries.id
|
||||
ORDER BY federated.t1.country_id;
|
||||
|
||||
DROP TABLE federated.countries;
|
||||
|
||||
|
@ -61,3 +61,17 @@ drop table t1;
|
||||
# Bug #5595 NULLIF() IS NULL returns false if NULLIF() returns NULL
|
||||
#
|
||||
SELECT NULLIF(5,5) IS NULL, NULLIF(5,5) IS NOT NULL;
|
||||
|
||||
#
|
||||
# Bug #9669 Ordering on IF function with FROM_UNIXTIME function fails
|
||||
#
|
||||
CREATE TABLE `t1` (
|
||||
`id` int(11) NOT NULL ,
|
||||
`date` int(10) default NULL,
|
||||
`text` varchar(32) NOT NULL
|
||||
);
|
||||
INSERT INTO t1 VALUES (1,1110000000,'Day 1'),(2,1111000000,'Day 2'),(3,1112000000,'Day 3');
|
||||
SELECT id, IF(date IS NULL, '-', FROM_UNIXTIME(date, '%d-%m-%Y')) AS date_ord, text FROM t1 ORDER BY date_ord ASC;
|
||||
SELECT id, IF(date IS NULL, '-', FROM_UNIXTIME(date, '%d-%m-%Y')) AS date_ord, text FROM t1 ORDER BY date_ord DESC;
|
||||
DROP TABLE t1;
|
||||
|
||||
|
@ -523,3 +523,9 @@ SELECT t1.id, aes_decrypt(str, 'bar') FROM t1, t2 WHERE t1.id = t2.id
|
||||
ORDER BY t1.id;
|
||||
|
||||
DROP TABLE t1, t2;
|
||||
|
||||
#
|
||||
# Bug #10944: Mishandling of NULL arguments in FIELD()
|
||||
#
|
||||
select field(0,NULL,1,0), field("",NULL,"bar",""), field(0.0,NULL,1.0,0.0);
|
||||
select field(NULL,1,2,NULL), field(NULL,1,2,0);
|
||||
|
@ -59,3 +59,17 @@ unlock tables;
|
||||
lock tables t1 write, t1 as t1_alias read;
|
||||
insert into t1 select index1,nr from t1 as t1_alias;
|
||||
drop table t1,t2;
|
||||
|
||||
#
|
||||
# Bug7241 - Invalid response when DELETE .. USING and LOCK TABLES used.
|
||||
#
|
||||
create table t1 ( a int(11) not null auto_increment, primary key(a));
|
||||
create table t2 ( a int(11) not null auto_increment, primary key(a));
|
||||
lock tables t1 write, t2 read;
|
||||
delete from t1 using t1,t2 where t1.a=t2.a;
|
||||
delete t1 from t1,t2 where t1.a=t2.a;
|
||||
--error 1099
|
||||
delete from t2 using t1,t2 where t1.a=t2.a;
|
||||
--error 1099
|
||||
delete t2 from t1,t2 where t1.a=t2.a;
|
||||
drop table t1,t2;
|
||||
|
34
mysql-test/t/mysql.test
Normal file
34
mysql-test/t/mysql.test
Normal file
@ -0,0 +1,34 @@
|
||||
#
|
||||
# Testing the MySQL command line client(mysql)
|
||||
#
|
||||
|
||||
--disable_warnings
|
||||
drop table if exists t1;
|
||||
--enable_warnings
|
||||
|
||||
#
|
||||
# Test the "delimiter" functionality
|
||||
# Bug#9879
|
||||
#
|
||||
create table t1(a int);
|
||||
insert into t1 values(1);
|
||||
|
||||
# Test delimiters
|
||||
--exec $MYSQL test < "./t/mysql_delimiter.sql"
|
||||
|
||||
--disable_query_log
|
||||
# Test delimiter : supplied on the command line
|
||||
select "Test delimiter : from command line" as " ";
|
||||
--exec $MYSQL test --delimiter=':' -e 'select * from t1:'
|
||||
# Test delimiter :; supplied on the command line
|
||||
select "Test delimiter :; from command line" as " ";
|
||||
--exec $MYSQL test --delimiter=':;' -e 'select * from t1:;'
|
||||
# Test 'go' command (vertical output) \G
|
||||
select "Test 'go' command(vertical output) \G" as " ";
|
||||
--exec $MYSQL test -e 'select * from t1\G'
|
||||
# Test 'go' command \g
|
||||
select "Test 'go' command \g" as " ";
|
||||
--exec $MYSQL test -e 'select * from t1\g'
|
||||
--enable_query_log
|
||||
|
||||
drop table t1;
|
48
mysql-test/t/mysql_delimiter.sql
Normal file
48
mysql-test/t/mysql_delimiter.sql
Normal file
@ -0,0 +1,48 @@
|
||||
|
||||
# Test default delimiter ;
|
||||
select "Test default delimiter ;" as " ";
|
||||
select * from t1;
|
||||
|
||||
# Test delimiter without argument
|
||||
select "Test delimiter without arg" as " ";
|
||||
# Nothing should be displayed, error is returned
|
||||
delimiter
|
||||
delimiter ; # Reset delimiter
|
||||
|
||||
# Test delimiter :
|
||||
select "Test delimiter :" as " ";
|
||||
delimiter :
|
||||
select * from t1:
|
||||
delimiter ; # Reset delimiter
|
||||
|
||||
# Test delimiter ':'
|
||||
select "Test delimiter :" as " ";
|
||||
delimiter ':'
|
||||
select * from t1:
|
||||
delimiter ; # Reset delimiter
|
||||
|
||||
# Test delimiter :;
|
||||
select "Test delimiter :;" as " ";
|
||||
delimiter :;
|
||||
select * from t1 :;
|
||||
delimiter ; # Reset delimiter
|
||||
|
||||
## Test delimiter //
|
||||
select "Test delimiter //" as " ";
|
||||
delimiter //
|
||||
select * from t1//
|
||||
delimiter ; # Reset delimiter
|
||||
|
||||
# Test delimiter 'MySQL'
|
||||
select "Test delimiter MySQL" as " ";
|
||||
delimiter 'MySQL'
|
||||
select * from t1MySQL
|
||||
delimiter ; # Reset delimiter
|
||||
|
||||
# Test delimiter 'delimiter'(should be allowed according to the code)
|
||||
select "Test delimiter delimiter" as " ";
|
||||
delimiter delimiter
|
||||
select * from t1 delimiter
|
||||
delimiter ; # Reset delimiter
|
||||
|
||||
|
@ -554,3 +554,12 @@ create table t1 (
|
||||
insert into t1 (F_8d3bba7425e7c98c50f52ca1b52d3735) values (1);
|
||||
--exec $MYSQL_DUMP --skip-comments -c test
|
||||
drop table t1;
|
||||
|
||||
#
|
||||
# Test for --add-drop-database
|
||||
#
|
||||
|
||||
CREATE TABLE t1 (a int);
|
||||
INSERT INTO t1 VALUES (1),(2),(3);
|
||||
--exec $MYSQL_DUMP --add-drop-database --skip-comments --databases test
|
||||
DROP TABLE t1;
|
||||
|
@ -220,3 +220,33 @@ SELECT a, SUM(a), SUM(a)+1, CONCAT(SUM(a),'x'), SUM(a)+SUM(a), SUM(a)
|
||||
|
||||
DROP TABLE t1;
|
||||
|
||||
#
|
||||
# Tests for bug #7894: ROLLUP over expressions on group by attributes
|
||||
#
|
||||
|
||||
CREATE TABLE t1 (a int(11));
|
||||
INSERT INTO t1 VALUES (1),(2);
|
||||
|
||||
SELECT a, a+1, SUM(a) FROM t1 GROUP BY a WITH ROLLUP;
|
||||
SELECT a+1 FROM t1 GROUP BY a WITH ROLLUP;
|
||||
SELECT a+SUM(a) FROM t1 GROUP BY a WITH ROLLUP;
|
||||
SELECT a, a+1 as b FROM t1 GROUP BY a WITH ROLLUP HAVING b > 2;
|
||||
SELECT a, a+1 as b FROM t1 GROUP BY a WITH ROLLUP HAVING a IS NULL;
|
||||
SELECT a, a+1 as b FROM t1 GROUP BY a WITH ROLLUP HAVING b IS NULL;
|
||||
SELECT IFNULL(a, 'TEST') FROM t1 GROUP BY a WITH ROLLUP;
|
||||
|
||||
CREATE TABLE t2 (a int, b int);
|
||||
INSERT INTO t2 VALUES
|
||||
(1,4),
|
||||
(2,2), (2,2),
|
||||
(4,1), (4,1), (4,1), (4,1),
|
||||
(2,1), (2,1);
|
||||
|
||||
SELECT a,b,SUM(b) FROM t2 GROUP BY a,b WITH ROLLUP;
|
||||
SELECT a,b,SUM(b), a+b as c FROM t2
|
||||
GROUP BY a,b WITH ROLLUP HAVING c IS NULL;
|
||||
SELECT IFNULL(a, 'TEST'), COALESCE(b, 'TEST') FROM t2
|
||||
GROUP BY a, b WITH ROLLUP;
|
||||
|
||||
DROP TABLE t1,t2;
|
||||
|
||||
|
@ -1,12 +0,0 @@
|
||||
#
|
||||
# Test of reserved Windows names
|
||||
#
|
||||
--require r/reserved_win_names.require
|
||||
|
||||
--error 1049
|
||||
use COM1;
|
||||
--error 1049
|
||||
use LPT1;
|
||||
--error 1049
|
||||
use PRN;
|
||||
|
@ -1998,6 +1998,15 @@ select distinct all * from t1;
|
||||
drop table t1;
|
||||
|
||||
#
|
||||
|
||||
#
|
||||
# Test for Bug#8009, SELECT failed on bigint unsigned when using HEX
|
||||
#
|
||||
|
||||
CREATE TABLE t1 (b BIGINT(20) UNSIGNED NOT NULL, PRIMARY KEY (b));
|
||||
INSERT INTO t1 VALUES (0x8000000000000000);
|
||||
SELECT b FROM t1 WHERE b=0x8000000000000000;
|
||||
DROP TABLE t1;
|
||||
# Test for bug #6474
|
||||
#
|
||||
|
||||
|
@ -1,6 +1,7 @@
|
||||
--disable_warnings
|
||||
drop table if exists t1,v1;
|
||||
drop view if exists t1,v1;
|
||||
drop procedure if exists f1;
|
||||
--enable_warnings
|
||||
use test;
|
||||
|
||||
@ -11,4 +12,11 @@ create table t1 (field1 INT);
|
||||
CREATE VIEW v1 AS SELECT field1 FROM t1;
|
||||
|
||||
drop view v1;
|
||||
drop table t1
|
||||
drop table t1;
|
||||
|
||||
#
|
||||
# Test that we can create and drop procedure without warnings
|
||||
# see bug#9993
|
||||
#
|
||||
create procedure f1() select 1;
|
||||
drop procedure f1;
|
@ -905,6 +905,54 @@ create procedure bug10537()
|
||||
load data local infile '/tmp/somefile' into table t1|
|
||||
|
||||
|
||||
#
|
||||
# BUG#8409: Stored procedure crash if function contains FLUSH
|
||||
#
|
||||
--disable_warnings
|
||||
drop function if exists bug8409|
|
||||
--enable_warnings
|
||||
--error ER_SP_BADSTATEMENT
|
||||
create function bug8409()
|
||||
returns int
|
||||
begin
|
||||
flush tables;
|
||||
return 5;
|
||||
end|
|
||||
|
||||
|
||||
#
|
||||
# BUG#9529: Stored Procedures: No Warning on truncation of procedure name
|
||||
# during creation.
|
||||
#
|
||||
--error ER_TOO_LONG_IDENT
|
||||
create procedure bug9529_90123456789012345678901234567890123456789012345678901234567890()
|
||||
begin
|
||||
end|
|
||||
|
||||
|
||||
#
|
||||
# BUG#10969: Stored procedures: crash if default() function
|
||||
#
|
||||
--disable_warnings
|
||||
drop procedure if exists bug10969|
|
||||
--enable_warnings
|
||||
--error ER_WRONG_COLUMN_NAME
|
||||
create procedure bug10969()
|
||||
begin
|
||||
declare s1 int default 0;
|
||||
select default(s1) from t30;
|
||||
end|
|
||||
|
||||
# This should work
|
||||
create procedure bug10969()
|
||||
begin
|
||||
declare s1 int default 0;
|
||||
select default(t30.s1) from t30;
|
||||
end|
|
||||
|
||||
drop procedure bug10969|
|
||||
|
||||
|
||||
#
|
||||
# BUG#NNNN: New bug synopsis
|
||||
#
|
||||
|
@ -3801,6 +3801,54 @@ call bug5963_2(1)|
|
||||
drop procedure bug5963_2|
|
||||
drop table t3|
|
||||
|
||||
|
||||
#
|
||||
# BUG#9559: Functions: Numeric Operations using -ve value gives incorrect
|
||||
# results.
|
||||
#
|
||||
--disable_warnings
|
||||
drop function if exists bug9559|
|
||||
--enable_warnings
|
||||
create function bug9559()
|
||||
returns int
|
||||
begin
|
||||
set @y = -6/2;
|
||||
return @y;
|
||||
end|
|
||||
|
||||
select bug9559()|
|
||||
|
||||
drop function bug9559|
|
||||
|
||||
|
||||
#
|
||||
# BUG#10961: Stored procedures: crash if select * from dual
|
||||
#
|
||||
--disable_warnings
|
||||
drop procedure if exists bug10961|
|
||||
--enable_warnings
|
||||
# "select * from dual" results in an error, so the cursor will not open
|
||||
create procedure bug10961()
|
||||
begin
|
||||
declare v char;
|
||||
declare x int;
|
||||
declare c cursor for select * from dual;
|
||||
declare continue handler for sqlexception select x;
|
||||
|
||||
set x = 1;
|
||||
open c;
|
||||
set x = 2;
|
||||
fetch c into v;
|
||||
set x = 3;
|
||||
close c;
|
||||
end|
|
||||
|
||||
call bug10961()|
|
||||
call bug10961()|
|
||||
|
||||
drop procedure bug10961|
|
||||
|
||||
|
||||
#
|
||||
# BUG#NNNN: New bug synopsis
|
||||
#
|
||||
|
@ -150,6 +150,55 @@ drop trigger t1.trg3;
|
||||
drop table t1;
|
||||
|
||||
|
||||
# Let us test how triggers work for special forms of INSERT such as
|
||||
# REPLACE and INSERT ... ON DUPLICATE KEY UPDATE
|
||||
create table t1 (id int not null primary key, data int);
|
||||
create trigger t1_bi before insert on t1 for each row
|
||||
set @log:= concat(@log, "(BEFORE_INSERT: new=(id=", new.id, ", data=", new.data,"))");
|
||||
create trigger t1_ai after insert on t1 for each row
|
||||
set @log:= concat(@log, "(AFTER_INSERT: new=(id=", new.id, ", data=", new.data,"))");
|
||||
create trigger t1_bu before update on t1 for each row
|
||||
set @log:= concat(@log, "(BEFORE_UPDATE: old=(id=", old.id, ", data=", old.data,
|
||||
") new=(id=", new.id, ", data=", new.data,"))");
|
||||
create trigger t1_au after update on t1 for each row
|
||||
set @log:= concat(@log, "(AFTER_UPDATE: old=(id=", old.id, ", data=", old.data,
|
||||
") new=(id=", new.id, ", data=", new.data,"))");
|
||||
create trigger t1_bd before delete on t1 for each row
|
||||
set @log:= concat(@log, "(BEFORE_DELETE: old=(id=", old.id, ", data=", old.data,"))");
|
||||
create trigger t1_ad after delete on t1 for each row
|
||||
set @log:= concat(@log, "(AFTER_DELETE: old=(id=", old.id, ", data=", old.data,"))");
|
||||
# Simple INSERT - both triggers should be called
|
||||
set @log:= "";
|
||||
insert into t1 values (1, 1);
|
||||
select @log;
|
||||
# INSERT IGNORE for already existing key - only before trigger should fire
|
||||
set @log:= "";
|
||||
insert ignore t1 values (1, 2);
|
||||
select @log;
|
||||
# REPLACE: before insert trigger should be called for both records,
|
||||
# but then for first one update will be executed (and both update
|
||||
# triggers should fire). For second after insert trigger will be
|
||||
# called as for usual insert
|
||||
set @log:= "";
|
||||
replace t1 values (1, 3), (2, 2);
|
||||
select @log;
|
||||
# Now let us change table in such way that REPLACE on won't be executed
|
||||
# using update.
|
||||
alter table t1 add ts timestamp default now();
|
||||
set @log:= "";
|
||||
# This REPLACE should be executed via DELETE and INSERT so proper
|
||||
# triggers should be invoked.
|
||||
replace t1 (id, data) values (1, 4);
|
||||
select @log;
|
||||
# Finally let us test INSERT ... ON DUPLICATE KEY UPDATE ...
|
||||
set @log:= "";
|
||||
insert into t1 (id, data) values (1, 5), (3, 3) on duplicate key update data= data + 2;
|
||||
select @log;
|
||||
|
||||
# This also drops associated triggers
|
||||
drop table t1;
|
||||
|
||||
|
||||
#
|
||||
# Test of wrong column specifiers in triggers
|
||||
#
|
||||
@ -249,3 +298,199 @@ create trigger trg1 before insert on t1 for each row set @a:= 1;
|
||||
# This should succeed
|
||||
drop database mysqltest;
|
||||
use test;
|
||||
|
||||
# Test for bug #5860 "Multi-table UPDATE does not activate update triggers"
|
||||
# We will also test how delete triggers wor for multi-table DELETE.
|
||||
create table t1 (i int, j int default 10, k int not null, key (k));
|
||||
create table t2 (i int);
|
||||
insert into t1 (i, k) values (1, 1);
|
||||
insert into t2 values (1);
|
||||
create trigger trg1 before update on t1 for each row set @a:= @a + new.j - old.j;
|
||||
create trigger trg2 after update on t1 for each row set @b:= "Fired";
|
||||
set @a:= 0, @b:= "";
|
||||
# Check that trigger works in case of update on the fly
|
||||
update t1, t2 set j = j + 10 where t1.i = t2.i;
|
||||
select @a, @b;
|
||||
insert into t1 values (2, 13, 2);
|
||||
insert into t2 values (2);
|
||||
set @a:= 0, @b:= "";
|
||||
# And now let us check that triggers work in case of multi-update which
|
||||
# is done through temporary tables...
|
||||
update t1, t2 set j = j + 15 where t1.i = t2.i and t1.k >= 2;
|
||||
select @a, @b;
|
||||
# Let us test delete triggers for multi-delete now.
|
||||
# We create triggers for both tables because we want test how they
|
||||
# work in both on-the-fly and via-temp-tables cases.
|
||||
create trigger trg3 before delete on t1 for each row set @c:= @c + old.j;
|
||||
create trigger trg4 before delete on t2 for each row set @d:= @d + old.i;
|
||||
create trigger trg5 after delete on t1 for each row set @e:= "After delete t1 fired";
|
||||
create trigger trg6 after delete on t2 for each row set @f:= "After delete t2 fired";
|
||||
set @c:= 0, @d:= 0, @e:= "", @f:= "";
|
||||
delete t1, t2 from t1, t2 where t1.i = t2.i;
|
||||
select @c, @d, @e, @f;
|
||||
# This also will drop triggers
|
||||
drop table t1, t2;
|
||||
|
||||
# Test for bug #6812 "Triggers are not activated for INSERT ... SELECT".
|
||||
# (We also check the fact that trigger modifies some field does not affect
|
||||
# value of next record inserted).
|
||||
delimiter |;
|
||||
create table t1 (i int, j int default 10)|
|
||||
create table t2 (i int)|
|
||||
insert into t2 values (1), (2)|
|
||||
create trigger trg1 before insert on t1 for each row
|
||||
begin
|
||||
if new.i = 1 then
|
||||
set new.j := 1;
|
||||
end if;
|
||||
end|
|
||||
create trigger trg2 after insert on t1 for each row set @a:= 1|
|
||||
set @a:= 0|
|
||||
insert into t1 (i) select * from t2|
|
||||
select * from t1|
|
||||
select @a|
|
||||
# This also will drop triggers
|
||||
drop table t1, t2|
|
||||
delimiter ;|
|
||||
|
||||
# Test for bug #8755 "Trigger is not activated by LOAD DATA"
|
||||
create table t1 (i int, j int, k int);
|
||||
create trigger trg1 before insert on t1 for each row set new.k = new.i;
|
||||
create trigger trg2 after insert on t1 for each row set @b:= "Fired";
|
||||
set @b:="";
|
||||
# Test triggers with file with separators
|
||||
load data infile '../../std_data/rpl_loaddata.dat' into table t1 (@a, i);
|
||||
select *, @b from t1;
|
||||
set @b:="";
|
||||
# Test triggers with fixed size row file
|
||||
load data infile '../../std_data/loaddata5.dat' into table t1 fields terminated by '' enclosed by '' (i, j);
|
||||
select *, @b from t1;
|
||||
# This also will drop triggers
|
||||
drop table t1;
|
||||
|
||||
# Test for bug #5894 "Triggers with altered tables cause corrupt databases"
|
||||
# Also tests basic error handling for various kinds of triggers.
|
||||
create table t1 (i int, at int, k int, key(k)) engine=myisam;
|
||||
create table t2 (i int);
|
||||
insert into t1 values (1, 1, 1);
|
||||
# We need at least 3 elements in t2 to test multi-update properly
|
||||
insert into t2 values (1), (2), (3);
|
||||
# Create and then break "after" triggers
|
||||
create trigger ai after insert on t1 for each row set @a:= new.at;
|
||||
create trigger au after update on t1 for each row set @a:= new.at;
|
||||
create trigger ad after delete on t1 for each row set @a:= old.at;
|
||||
alter table t1 drop column at;
|
||||
# We still should be able select data from tables.
|
||||
select * from t1;
|
||||
# The following statements changing t1 should fail, but still cause
|
||||
# their main effect. This is because operation on the table row is
|
||||
# executed before "after" trigger and its effect cannot be rolled back
|
||||
# when whole statement fails, because t1 is MyISAM table.
|
||||
--error 1054
|
||||
insert into t1 values (2, 1);
|
||||
select * from t1;
|
||||
--error 1054
|
||||
update t1 set k = 2 where i = 2;
|
||||
select * from t1;
|
||||
--error 1054
|
||||
delete from t1 where i = 2;
|
||||
select * from t1;
|
||||
# Should fail and insert only 1 row
|
||||
--error 1054
|
||||
load data infile '../../std_data/loaddata5.dat' into table t1 fields terminated by '' enclosed by '' (i, k);
|
||||
select * from t1;
|
||||
--error 1054
|
||||
insert into t1 select 3, 3;
|
||||
select * from t1;
|
||||
# Multi-update working on the fly, again it will update only
|
||||
# one row even if more matches
|
||||
--error 1054
|
||||
update t1, t2 set k = k + 10 where t1.i = t2.i;
|
||||
select * from t1;
|
||||
# The same for multi-update via temp table
|
||||
--error 1054
|
||||
update t1, t2 set k = k + 10 where t1.i = t2.i and k < 3;
|
||||
select * from t1;
|
||||
# Multi-delete on the fly
|
||||
--error 1054
|
||||
delete t1, t2 from t1 straight_join t2 where t1.i = t2.i;
|
||||
select * from t1;
|
||||
# And via temporary storage
|
||||
--error 1054
|
||||
delete t2, t1 from t2 straight_join t1 where t1.i = t2.i;
|
||||
select * from t1;
|
||||
# Prepare table for testing of REPLACE and INSERT ... ON DUPLICATE KEY UPDATE
|
||||
alter table t1 add primary key (i);
|
||||
--error 1054
|
||||
insert into t1 values (3, 4) on duplicate key update k= k + 10;
|
||||
select * from t1;
|
||||
--error 1054
|
||||
replace into t1 values (3, 3);
|
||||
select * from t1;
|
||||
# Change table in such way that REPLACE will delete row
|
||||
alter table t1 add ts timestamp default now();
|
||||
--error 1054
|
||||
replace into t1 (i, k) values (3, 13);
|
||||
select * from t1;
|
||||
# Also drops all triggers
|
||||
drop table t1, t2;
|
||||
|
||||
create table t1 (i int, bt int, k int, key(k)) engine=myisam;
|
||||
create table t2 (i int);
|
||||
insert into t1 values (1, 1, 1), (2, 2, 2);
|
||||
insert into t2 values (1), (2), (3);
|
||||
# Create and then break "before" triggers
|
||||
create trigger bi before insert on t1 for each row set @a:= new.bt;
|
||||
create trigger bu before update on t1 for each row set @a:= new.bt;
|
||||
create trigger bd before delete on t1 for each row set @a:= old.bt;
|
||||
alter table t1 drop column bt;
|
||||
# The following statements changing t1 should fail and should not
|
||||
# cause any effect on table, since "before" trigger is executed
|
||||
# before operation on the table row.
|
||||
--error 1054
|
||||
insert into t1 values (3, 3);
|
||||
select * from t1;
|
||||
--error 1054
|
||||
update t1 set i = 2;
|
||||
select * from t1;
|
||||
--error 1054
|
||||
delete from t1;
|
||||
select * from t1;
|
||||
--error 1054
|
||||
load data infile '../../std_data/loaddata5.dat' into table t1 fields terminated by '' enclosed by '' (i, k);
|
||||
select * from t1;
|
||||
--error 1054
|
||||
insert into t1 select 3, 3;
|
||||
select * from t1;
|
||||
# Both types of multi-update (on the fly and via temp table)
|
||||
--error 1054
|
||||
update t1, t2 set k = k + 10 where t1.i = t2.i;
|
||||
select * from t1;
|
||||
--error 1054
|
||||
update t1, t2 set k = k + 10 where t1.i = t2.i and k < 2;
|
||||
select * from t1;
|
||||
# Both types of multi-delete
|
||||
--error 1054
|
||||
delete t1, t2 from t1 straight_join t2 where t1.i = t2.i;
|
||||
select * from t1;
|
||||
--error 1054
|
||||
delete t2, t1 from t2 straight_join t1 where t1.i = t2.i;
|
||||
select * from t1;
|
||||
# Let us test REPLACE/INSERT ... ON DUPLICATE KEY UPDATE.
|
||||
# To test properly code-paths different from those that are used
|
||||
# in ordinary INSERT we need to drop "before insert" trigger.
|
||||
alter table t1 add primary key (i);
|
||||
drop trigger t1.bi;
|
||||
--error 1054
|
||||
insert into t1 values (2, 4) on duplicate key update k= k + 10;
|
||||
select * from t1;
|
||||
--error 1054
|
||||
replace into t1 values (2, 4);
|
||||
select * from t1;
|
||||
# Change table in such way that REPLACE will delete row
|
||||
alter table t1 add ts timestamp default now();
|
||||
--error 1054
|
||||
replace into t1 (i, k) values (2, 11);
|
||||
select * from t1;
|
||||
# Also drops all triggers
|
||||
drop table t1, t2;
|
||||
|
@ -772,3 +772,24 @@ select row_format from information_schema.TABLES where table_schema="test" and t
|
||||
alter table t2 ROW_FORMAT=fixed;
|
||||
show create table t2;
|
||||
drop table t1,t2;
|
||||
|
||||
#
|
||||
# correct conversion long string to TEXT (BUG#10025)
|
||||
#
|
||||
CREATE TABLE t1 (a mediumtext);
|
||||
CREATE TABLE t2 (b varchar(20));
|
||||
INSERT INTO t1 VALUES ('a'),('b');
|
||||
SELECT left(a,100000000) FROM t1 UNION SELECT b FROM t2;
|
||||
create table t3 SELECT left(a,100000000) FROM t1 UNION SELECT b FROM t2;
|
||||
show create table t3;
|
||||
drop tables t1,t2,t3;
|
||||
|
||||
#
|
||||
# Bug #10032 Bug in parsing UNION with ORDER BY when one node does not use FROM
|
||||
#
|
||||
|
||||
create table t1 ( id int not null auto_increment, primary key (id), col1 int);
|
||||
insert into t1 (col1) values (2),(3),(4),(5),(6);
|
||||
select 99 union all select id from t1 order by 1;
|
||||
select id from t1 union all select 99 order by 1;
|
||||
drop table t1;
|
||||
|
@ -130,6 +130,13 @@ set @@query_alloc_block_size=default, @@query_prealloc_size=default;
|
||||
set transaction_alloc_block_size=default, @@transaction_prealloc_size=default;
|
||||
show variables like '%alloc%';
|
||||
|
||||
#
|
||||
# Bug #10904 Illegal mix of collations between
|
||||
# a system variable and a constant
|
||||
#
|
||||
SELECT @@version LIKE 'non-existent';
|
||||
SELECT @@version_compile_os LIKE 'non-existent';
|
||||
|
||||
# The following should give errors
|
||||
|
||||
--error 1231
|
||||
|
Reference in New Issue
Block a user