mirror of
https://github.com/MariaDB/server.git
synced 2025-07-29 05:21:33 +03:00
Merge tsmith@bk-internal.mysql.com:/home/bk/mysql-5.0-runtime
into quadxeon.mysql.com:/benchmarks/ext3/TOSAVE/tsmith/bk/maint/mrg0306/50
This commit is contained in:
@ -3043,6 +3043,7 @@ language = $path_language
|
||||
character-sets-dir = $path_charsetsdir
|
||||
basedir = $path_my_basedir
|
||||
server_id = $server_id
|
||||
shutdown-delay = 10
|
||||
skip-stack-trace
|
||||
skip-innodb
|
||||
skip-ndbcluster
|
||||
|
@ -128,3 +128,6 @@ f1 f2 if(f1, 40.0, 5.00)
|
||||
0 0 5.00
|
||||
1 1 40.00
|
||||
drop table t1;
|
||||
select if(0, 18446744073709551610, 18446744073709551610);
|
||||
if(0, 18446744073709551610, 18446744073709551610)
|
||||
18446744073709551610
|
||||
|
@ -141,4 +141,48 @@ t1 CREATE TABLE `t1` (
|
||||
`a` bigint(21) unsigned default NULL
|
||||
) ENGINE=MyISAM DEFAULT CHARSET=latin1
|
||||
drop table t1;
|
||||
drop table if exists table_26093;
|
||||
drop function if exists func_26093_a;
|
||||
drop function if exists func_26093_b;
|
||||
create table table_26093(a int);
|
||||
insert into table_26093 values
|
||||
(1), (2), (3), (4), (5),
|
||||
(6), (7), (8), (9), (10);
|
||||
create function func_26093_a(x int) returns int
|
||||
begin
|
||||
set @invoked := @invoked + 1;
|
||||
return x;
|
||||
end//
|
||||
create function func_26093_b(x int, y int) returns int
|
||||
begin
|
||||
set @invoked := @invoked + 1;
|
||||
return x;
|
||||
end//
|
||||
select avg(a) from table_26093;
|
||||
avg(a)
|
||||
5.5000
|
||||
select benchmark(100, (select avg(a) from table_26093));
|
||||
benchmark(100, (select avg(a) from table_26093))
|
||||
0
|
||||
set @invoked := 0;
|
||||
select benchmark(100, (select avg(func_26093_a(a)) from table_26093));
|
||||
benchmark(100, (select avg(func_26093_a(a)) from table_26093))
|
||||
0
|
||||
select @invoked;
|
||||
@invoked
|
||||
10
|
||||
set @invoked := 0;
|
||||
select benchmark(100, (select avg(func_26093_b(a, rand())) from table_26093));
|
||||
benchmark(100, (select avg(func_26093_b(a, rand())) from table_26093))
|
||||
0
|
||||
select @invoked;
|
||||
@invoked
|
||||
1000
|
||||
select benchmark(100, (select (a) from table_26093));
|
||||
ERROR 21000: Subquery returns more than 1 row
|
||||
select benchmark(100, (select 1, 1));
|
||||
ERROR 21000: Operand should contain 1 column(s)
|
||||
drop table table_26093;
|
||||
drop function func_26093_a;
|
||||
drop function func_26093_b;
|
||||
End of 5.0 tests
|
||||
|
@ -21,6 +21,6 @@ Success: the process was restarted.
|
||||
Success: server is ready to accept connection on socket.
|
||||
SHOW INSTANCE STATUS mysqld1;
|
||||
instance_name status version
|
||||
mysqld1 online VERSION
|
||||
mysqld1 STATE VERSION
|
||||
STOP INSTANCE mysqld2;
|
||||
Success: the process has been stopped.
|
||||
|
@ -87,13 +87,13 @@ where table_schema='test';
|
||||
table_name table_type table_comment
|
||||
t1 BASE TABLE
|
||||
v1 VIEW VIEW
|
||||
v2 VIEW View 'test.v2' references invalid table(s) or column(s) or function(s) or define
|
||||
v2 VIEW VIEW
|
||||
drop table t1;
|
||||
select table_name, table_type, table_comment from information_schema.tables
|
||||
where table_schema='test';
|
||||
table_name table_type table_comment
|
||||
v1 VIEW View 'test.v1' references invalid table(s) or column(s) or function(s) or define
|
||||
v2 VIEW View 'test.v2' references invalid table(s) or column(s) or function(s) or define
|
||||
v1 VIEW VIEW
|
||||
v2 VIEW VIEW
|
||||
drop function f1;
|
||||
drop function f2;
|
||||
drop view v1, v2;
|
||||
|
@ -1,3 +1,10 @@
|
||||
INSERT INTO init_file.startup VALUES ( NOW() );
|
||||
SELECT * INTO @X FROM init_file.startup limit 0,1;
|
||||
SELECT * INTO @Y FROM init_file.startup limit 1,1;
|
||||
SELECT YEAR(@X)-YEAR(@Y);
|
||||
YEAR(@X)-YEAR(@Y)
|
||||
0
|
||||
DROP DATABASE init_file;
|
||||
ok
|
||||
end of 4.1 tests
|
||||
select * from t1;
|
||||
|
@ -1128,9 +1128,9 @@ drop view if exists v1, v2, v3, v4;
|
||||
create function bug11555_1() returns int return (select max(i) from t1);
|
||||
create function bug11555_2() returns int return bug11555_1();
|
||||
create view v1 as select bug11555_1();
|
||||
ERROR 42S02: Table 'test.t1' doesn't exist
|
||||
drop view v1;
|
||||
create view v2 as select bug11555_2();
|
||||
ERROR 42S02: Table 'test.t1' doesn't exist
|
||||
drop view v2;
|
||||
create table t1 (i int);
|
||||
create view v1 as select bug11555_1();
|
||||
create view v2 as select bug11555_2();
|
||||
@ -1143,8 +1143,7 @@ ERROR HY000: View 'test.v2' references invalid table(s) or column(s) or function
|
||||
select * from v3;
|
||||
ERROR HY000: View 'test.v3' references invalid table(s) or column(s) or function(s) or definer/invoker of view lack rights to use them
|
||||
create view v4 as select * from v1;
|
||||
ERROR HY000: View 'test.v1' references invalid table(s) or column(s) or function(s) or definer/invoker of view lack rights to use them
|
||||
drop view v1, v2, v3;
|
||||
drop view v1, v2, v3, v4;
|
||||
drop function bug11555_1;
|
||||
drop function bug11555_2;
|
||||
create table t1 (i int);
|
||||
@ -1153,12 +1152,12 @@ create trigger t1_ai after insert on t1 for each row insert into t2 values (new.
|
||||
create view v1 as select * from t1;
|
||||
drop table t2;
|
||||
insert into v1 values (1);
|
||||
ERROR HY000: View 'test.v1' references invalid table(s) or column(s) or function(s) or definer/invoker of view lack rights to use them
|
||||
ERROR HY000: Table 't2' was not locked with LOCK TABLES
|
||||
drop trigger t1_ai;
|
||||
create function bug11555_1() returns int return (select max(i) from t2);
|
||||
create trigger t1_ai after insert on t1 for each row set @a:=bug11555_1();
|
||||
insert into v1 values (2);
|
||||
ERROR HY000: View 'test.v1' references invalid table(s) or column(s) or function(s) or definer/invoker of view lack rights to use them
|
||||
ERROR HY000: Table 't2' was not locked with LOCK TABLES
|
||||
drop function bug11555_1;
|
||||
drop table t1;
|
||||
drop view v1;
|
||||
@ -1269,3 +1268,135 @@ call bug24491();
|
||||
ERROR 42S22: Unknown column 'y.value' in 'field list'
|
||||
drop procedure bug24491;
|
||||
drop tables t1;
|
||||
DROP FUNCTION IF EXISTS bug18914_f1;
|
||||
DROP FUNCTION IF EXISTS bug18914_f2;
|
||||
DROP PROCEDURE IF EXISTS bug18914_p1;
|
||||
DROP PROCEDURE IF EXISTS bug18914_p2;
|
||||
DROP TABLE IF EXISTS t1, t2;
|
||||
CREATE TABLE t1 (i INT);
|
||||
CREATE PROCEDURE bug18914_p1() CREATE TABLE t2 (i INT);
|
||||
CREATE PROCEDURE bug18914_p2() DROP TABLE IF EXISTS no_such_table;
|
||||
CREATE FUNCTION bug18914_f1() RETURNS INT
|
||||
BEGIN
|
||||
CALL bug18914_p1();
|
||||
RETURN 1;
|
||||
END |
|
||||
CREATE FUNCTION bug18914_f2() RETURNS INT
|
||||
BEGIN
|
||||
CALL bug18914_p2();
|
||||
RETURN 1;
|
||||
END |
|
||||
CREATE TRIGGER t1_bi BEFORE INSERT ON t1 FOR EACH ROW
|
||||
CALL bug18914_p1();
|
||||
INSERT INTO t1 VALUES (1);
|
||||
ERROR HY000: Explicit or implicit commit is not allowed in stored function or trigger.
|
||||
SELECT bug18914_f1();
|
||||
ERROR HY000: Explicit or implicit commit is not allowed in stored function or trigger.
|
||||
SELECT bug18914_f2();
|
||||
ERROR HY000: Explicit or implicit commit is not allowed in stored function or trigger.
|
||||
SELECT * FROM t2;
|
||||
ERROR 42S02: Table 'test.t2' doesn't exist
|
||||
DROP FUNCTION bug18914_f1;
|
||||
DROP FUNCTION bug18914_f2;
|
||||
DROP PROCEDURE bug18914_p1;
|
||||
DROP PROCEDURE bug18914_p2;
|
||||
DROP TABLE t1;
|
||||
drop table if exists bogus_table_20713;
|
||||
drop function if exists func_20713_a;
|
||||
drop function if exists func_20713_b;
|
||||
create table bogus_table_20713( id int(10) not null primary key);
|
||||
insert into bogus_table_20713 values (1), (2), (3);
|
||||
create function func_20713_a() returns int(11)
|
||||
begin
|
||||
declare id int;
|
||||
declare continue handler for sqlexception set id=null;
|
||||
set @in_func := 1;
|
||||
set id = (select id from bogus_table_20713 where id = 3);
|
||||
set @in_func := 2;
|
||||
return id;
|
||||
end//
|
||||
create function func_20713_b() returns int(11)
|
||||
begin
|
||||
declare id int;
|
||||
declare continue handler for sqlstate value '42S02' set id=null;
|
||||
set @in_func := 1;
|
||||
set id = (select id from bogus_table_20713 where id = 3);
|
||||
set @in_func := 2;
|
||||
return id;
|
||||
end//
|
||||
set @in_func := 0;
|
||||
select func_20713_a();
|
||||
func_20713_a()
|
||||
NULL
|
||||
select @in_func;
|
||||
@in_func
|
||||
2
|
||||
set @in_func := 0;
|
||||
select func_20713_b();
|
||||
func_20713_b()
|
||||
NULL
|
||||
select @in_func;
|
||||
@in_func
|
||||
2
|
||||
drop table bogus_table_20713;
|
||||
set @in_func := 0;
|
||||
select func_20713_a();
|
||||
func_20713_a()
|
||||
NULL
|
||||
select @in_func;
|
||||
@in_func
|
||||
2
|
||||
set @in_func := 0;
|
||||
select func_20713_b();
|
||||
func_20713_b()
|
||||
NULL
|
||||
select @in_func;
|
||||
@in_func
|
||||
2
|
||||
drop function if exists func_20713_a;
|
||||
drop function if exists func_20713_b;
|
||||
drop table if exists table_25345_a;
|
||||
drop table if exists table_25345_b;
|
||||
drop procedure if exists proc_25345;
|
||||
drop function if exists func_25345;
|
||||
drop function if exists func_25345_b;
|
||||
create table table_25345_a (a int);
|
||||
create table table_25345_b (b int);
|
||||
create procedure proc_25345()
|
||||
begin
|
||||
declare c1 cursor for select a from table_25345_a;
|
||||
declare c2 cursor for select b from table_25345_b;
|
||||
select 1 as result;
|
||||
end ||
|
||||
create function func_25345() returns int(11)
|
||||
begin
|
||||
call proc_25345();
|
||||
return 1;
|
||||
end ||
|
||||
create function func_25345_b() returns int(11)
|
||||
begin
|
||||
declare c1 cursor for select a from table_25345_a;
|
||||
declare c2 cursor for select b from table_25345_b;
|
||||
return 1;
|
||||
end ||
|
||||
call proc_25345();
|
||||
result
|
||||
1
|
||||
select func_25345();
|
||||
ERROR 0A000: Not allowed to return a result set from a function
|
||||
select func_25345_b();
|
||||
func_25345_b()
|
||||
1
|
||||
drop table table_25345_a;
|
||||
call proc_25345();
|
||||
result
|
||||
1
|
||||
select func_25345();
|
||||
ERROR 0A000: Not allowed to return a result set from a function
|
||||
select func_25345_b();
|
||||
func_25345_b()
|
||||
1
|
||||
drop table table_25345_b;
|
||||
drop procedure proc_25345;
|
||||
drop function func_25345;
|
||||
drop function func_25345_b;
|
||||
|
@ -431,17 +431,17 @@ SELECT HEX(v10);
|
||||
END|
|
||||
CALL p1();
|
||||
HEX(v1)
|
||||
01
|
||||
1
|
||||
HEX(v2)
|
||||
00
|
||||
0
|
||||
HEX(v3)
|
||||
05
|
||||
5
|
||||
HEX(v4)
|
||||
5555555555555555
|
||||
HEX(v5)
|
||||
07
|
||||
7
|
||||
HEX(v6)
|
||||
0000000000000005
|
||||
5
|
||||
HEX(v7)
|
||||
80
|
||||
HEX(v8)
|
||||
@ -748,12 +748,60 @@ HEX(b) b = 0 b = FALSE b IS FALSE b = 1 b = TRUE b IS TRUE
|
||||
1 0 0 0 1 1 1
|
||||
call p2();
|
||||
HEX(vb) vb = 0 vb = FALSE vb IS FALSE vb = 1 vb = TRUE vb IS TRUE
|
||||
00 1 1 1 0 0 0
|
||||
0 1 1 1 0 0 0
|
||||
HEX(vb) vb = 0 vb = FALSE vb IS FALSE vb = 1 vb = TRUE vb IS TRUE
|
||||
01 0 0 1 1 1 0
|
||||
1 0 0 0 1 1 1
|
||||
DROP TABLE t1;
|
||||
DROP PROCEDURE p1;
|
||||
DROP PROCEDURE p2;
|
||||
DROP TABLE IF EXISTS table_12976_a;
|
||||
DROP TABLE IF EXISTS table_12976_b;
|
||||
DROP PROCEDURE IF EXISTS proc_12976_a;
|
||||
DROP PROCEDURE IF EXISTS proc_12976_b;
|
||||
CREATE TABLE table_12976_a (val bit(1));
|
||||
CREATE TABLE table_12976_b(
|
||||
appname varchar(15),
|
||||
emailperm bit not null default 1,
|
||||
phoneperm bit not null default 0);
|
||||
insert into table_12976_b values ('A', b'1', b'1'), ('B', b'0', b'0');
|
||||
CREATE PROCEDURE proc_12976_a()
|
||||
BEGIN
|
||||
declare localvar bit(1);
|
||||
SELECT val INTO localvar FROM table_12976_a;
|
||||
SELECT coalesce(localvar, 1)+1, coalesce(val, 1)+1 FROM table_12976_a;
|
||||
END||
|
||||
CREATE PROCEDURE proc_12976_b(
|
||||
name varchar(15),
|
||||
out ep bit,
|
||||
out msg varchar(10))
|
||||
BEGIN
|
||||
SELECT emailperm into ep FROM table_12976_b where (appname = name);
|
||||
IF ep is true THEN
|
||||
SET msg = 'True';
|
||||
ELSE
|
||||
SET msg = 'False';
|
||||
END IF;
|
||||
END||
|
||||
INSERT table_12976_a VALUES (0);
|
||||
call proc_12976_a();
|
||||
coalesce(localvar, 1)+1 coalesce(val, 1)+1
|
||||
1 1
|
||||
UPDATE table_12976_a set val=1;
|
||||
call proc_12976_a();
|
||||
coalesce(localvar, 1)+1 coalesce(val, 1)+1
|
||||
2 2
|
||||
call proc_12976_b('A', @ep, @msg);
|
||||
select @ep, @msg;
|
||||
@ep @msg
|
||||
1 True
|
||||
call proc_12976_b('B', @ep, @msg);
|
||||
select @ep, @msg;
|
||||
@ep @msg
|
||||
0 False
|
||||
DROP TABLE table_12976_a;
|
||||
DROP TABLE table_12976_b;
|
||||
DROP PROCEDURE proc_12976_a;
|
||||
DROP PROCEDURE proc_12976_b;
|
||||
|
||||
---------------------------------------------------------------
|
||||
BUG#9572
|
||||
|
@ -1155,9 +1155,13 @@ create function f12_2() returns int
|
||||
return (select count(*) from t3)|
|
||||
drop temporary table t3|
|
||||
select f12_1()|
|
||||
ERROR 42S02: Table 'test.t3' doesn't exist
|
||||
f12_1()
|
||||
3
|
||||
Warnings:
|
||||
Note 1051 Unknown table 't3'
|
||||
select f12_1() from t1 limit 1|
|
||||
ERROR 42S02: Table 'test.t3' doesn't exist
|
||||
f12_1()
|
||||
3
|
||||
drop function f0|
|
||||
drop function f1|
|
||||
drop function f2|
|
||||
@ -5727,4 +5731,38 @@ END|
|
||||
CALL bug24117()|
|
||||
DROP PROCEDURE bug24117|
|
||||
DROP TABLE t3|
|
||||
drop function if exists func_8407_a|
|
||||
drop function if exists func_8407_b|
|
||||
create function func_8407_a() returns int
|
||||
begin
|
||||
declare x int;
|
||||
declare continue handler for sqlexception
|
||||
begin
|
||||
end;
|
||||
select 1 from no_such_view limit 1 into x;
|
||||
return x;
|
||||
end|
|
||||
create function func_8407_b() returns int
|
||||
begin
|
||||
declare x int default 0;
|
||||
declare continue handler for sqlstate '42S02'
|
||||
begin
|
||||
set x:= x+1000;
|
||||
end;
|
||||
case (select 1 from no_such_view limit 1)
|
||||
when 1 then set x:= x+1;
|
||||
when 2 then set x:= x+2;
|
||||
else set x:= x+100;
|
||||
end case;
|
||||
set x:=x + 500;
|
||||
return x;
|
||||
end|
|
||||
select func_8407_a()|
|
||||
func_8407_a()
|
||||
NULL
|
||||
select func_8407_b()|
|
||||
func_8407_b()
|
||||
1500
|
||||
drop function func_8407_a|
|
||||
drop function func_8407_b|
|
||||
drop table t1,t2;
|
||||
|
@ -3095,7 +3095,7 @@ SELECT a FROM t1 GROUP BY a
|
||||
HAVING IFNULL((SELECT b FROM t2 WHERE b > 4),
|
||||
(SELECT c FROM t2 WHERE c=a AND b > 1 ORDER BY b)) > 3;
|
||||
ERROR 21000: Subquery returns more than 1 row
|
||||
SELECT a FROM t1
|
||||
SELECT a FROM t1
|
||||
ORDER BY IFNULL((SELECT b FROM t2 WHERE b > 2),
|
||||
(SELECT c FROM t2 WHERE c=a AND b > 2 ORDER BY b));
|
||||
a
|
||||
@ -3103,11 +3103,11 @@ a
|
||||
4
|
||||
1
|
||||
3
|
||||
SELECT a FROM t1
|
||||
SELECT a FROM t1
|
||||
ORDER BY IFNULL((SELECT b FROM t2 WHERE b > 1),
|
||||
(SELECT c FROM t2 WHERE c=a AND b > 1 ORDER BY b));
|
||||
ERROR 21000: Subquery returns more than 1 row
|
||||
SELECT a FROM t1
|
||||
SELECT a FROM t1
|
||||
ORDER BY IFNULL((SELECT b FROM t2 WHERE b > 4),
|
||||
(SELECT c FROM t2 WHERE c=a AND b > 2 ORDER BY b));
|
||||
a
|
||||
@ -3115,7 +3115,7 @@ a
|
||||
1
|
||||
3
|
||||
4
|
||||
SELECT a FROM t1
|
||||
SELECT a FROM t1
|
||||
ORDER BY IFNULL((SELECT b FROM t2 WHERE b > 4),
|
||||
(SELECT c FROM t2 WHERE c=a AND b > 1 ORDER BY b));
|
||||
ERROR 21000: Subquery returns more than 1 row
|
||||
@ -3683,16 +3683,16 @@ CREATE TABLE t1 (id char(4) PRIMARY KEY, c int);
|
||||
CREATE TABLE t2 (c int);
|
||||
INSERT INTO t1 VALUES ('aa', 1);
|
||||
INSERT INTO t2 VALUES (1);
|
||||
SELECT * FROM t1
|
||||
SELECT * FROM t1
|
||||
WHERE EXISTS (SELECT c FROM t2 WHERE c=1
|
||||
UNION
|
||||
UNION
|
||||
SELECT c from t2 WHERE c=t1.c);
|
||||
id c
|
||||
aa 1
|
||||
INSERT INTO t1 VALUES ('bb', 2), ('cc', 3), ('dd',1);
|
||||
SELECT * FROM t1
|
||||
SELECT * FROM t1
|
||||
WHERE EXISTS (SELECT c FROM t2 WHERE c=1
|
||||
UNION
|
||||
UNION
|
||||
SELECT c from t2 WHERE c=t1.c);
|
||||
id c
|
||||
aa 1
|
||||
@ -3702,9 +3702,9 @@ dd 1
|
||||
INSERT INTO t2 VALUES (2);
|
||||
CREATE TABLE t3 (c int);
|
||||
INSERT INTO t3 VALUES (1);
|
||||
SELECT * FROM t1
|
||||
SELECT * FROM t1
|
||||
WHERE EXISTS (SELECT t2.c FROM t2 JOIN t3 ON t2.c=t3.c WHERE t2.c=1
|
||||
UNION
|
||||
UNION
|
||||
SELECT c from t2 WHERE c=t1.c);
|
||||
id c
|
||||
aa 1
|
||||
@ -3754,3 +3754,116 @@ a MAX(b) test
|
||||
2 3 h
|
||||
3 4 i
|
||||
DROP TABLE t1;
|
||||
DROP TABLE IF EXISTS t1;
|
||||
DROP TABLE IF EXISTS t2;
|
||||
DROP TABLE IF EXISTS t1xt2;
|
||||
CREATE TABLE t1 (
|
||||
id_1 int(5) NOT NULL,
|
||||
t varchar(4) DEFAULT NULL
|
||||
);
|
||||
CREATE TABLE t2 (
|
||||
id_2 int(5) NOT NULL,
|
||||
t varchar(4) DEFAULT NULL
|
||||
);
|
||||
CREATE TABLE t1xt2 (
|
||||
id_1 int(5) NOT NULL,
|
||||
id_2 int(5) NOT NULL
|
||||
);
|
||||
INSERT INTO t1 VALUES (1, 'a'), (2, 'b'), (3, 'c'), (4, 'd');
|
||||
INSERT INTO t2 VALUES (2, 'bb'), (3, 'cc'), (4, 'dd'), (12, 'aa');
|
||||
INSERT INTO t1xt2 VALUES (2, 2), (3, 3), (4, 4);
|
||||
SELECT DISTINCT t1.id_1 FROM t1 WHERE
|
||||
(12 IN (SELECT t1xt2.id_2 FROM t1xt2 WHERE t1.id_1 = t1xt2.id_1));
|
||||
id_1
|
||||
SELECT DISTINCT t1.id_1 FROM t1 WHERE
|
||||
(12 IN ((SELECT t1xt2.id_2 FROM t1xt2 WHERE t1.id_1 = t1xt2.id_1)));
|
||||
id_1
|
||||
SELECT DISTINCT t1.id_1 FROM t1 WHERE
|
||||
(12 IN (((SELECT t1xt2.id_2 FROM t1xt2 WHERE t1.id_1 = t1xt2.id_1))));
|
||||
id_1
|
||||
SELECT DISTINCT t1.id_1 FROM t1 WHERE
|
||||
(12 NOT IN (SELECT t1xt2.id_2 FROM t1xt2 WHERE t1.id_1 = t1xt2.id_1));
|
||||
id_1
|
||||
1
|
||||
2
|
||||
3
|
||||
4
|
||||
SELECT DISTINCT t1.id_1 FROM t1 WHERE
|
||||
(12 NOT IN ((SELECT t1xt2.id_2 FROM t1xt2 where t1.id_1 = t1xt2.id_1)));
|
||||
id_1
|
||||
1
|
||||
2
|
||||
3
|
||||
4
|
||||
SELECT DISTINCT t1.id_1 FROM t1 WHERE
|
||||
(12 NOT IN (((SELECT t1xt2.id_2 FROM t1xt2 where t1.id_1 = t1xt2.id_1))));
|
||||
id_1
|
||||
1
|
||||
2
|
||||
3
|
||||
4
|
||||
insert INTO t1xt2 VALUES (1, 12);
|
||||
SELECT DISTINCT t1.id_1 FROM t1 WHERE
|
||||
(12 IN (SELECT t1xt2.id_2 FROM t1xt2 WHERE t1.id_1 = t1xt2.id_1));
|
||||
id_1
|
||||
1
|
||||
SELECT DISTINCT t1.id_1 FROM t1 WHERE
|
||||
(12 IN ((SELECT t1xt2.id_2 FROM t1xt2 WHERE t1.id_1 = t1xt2.id_1)));
|
||||
id_1
|
||||
1
|
||||
SELECT DISTINCT t1.id_1 FROM t1 WHERE
|
||||
(12 IN (((SELECT t1xt2.id_2 FROM t1xt2 WHERE t1.id_1 = t1xt2.id_1))));
|
||||
id_1
|
||||
1
|
||||
SELECT DISTINCT t1.id_1 FROM t1 WHERE
|
||||
(12 NOT IN (SELECT t1xt2.id_2 FROM t1xt2 WHERE t1.id_1 = t1xt2.id_1));
|
||||
id_1
|
||||
2
|
||||
3
|
||||
4
|
||||
SELECT DISTINCT t1.id_1 FROM t1 WHERE
|
||||
(12 NOT IN ((SELECT t1xt2.id_2 FROM t1xt2 WHERE t1.id_1 = t1xt2.id_1)));
|
||||
id_1
|
||||
2
|
||||
3
|
||||
4
|
||||
SELECT DISTINCT t1.id_1 FROM t1 WHERE
|
||||
(12 NOT IN (((SELECT t1xt2.id_2 FROM t1xt2 WHERE t1.id_1 = t1xt2.id_1))));
|
||||
id_1
|
||||
2
|
||||
3
|
||||
4
|
||||
insert INTO t1xt2 VALUES (2, 12);
|
||||
SELECT DISTINCT t1.id_1 FROM t1 WHERE
|
||||
(12 IN (SELECT t1xt2.id_2 FROM t1xt2 WHERE t1.id_1 = t1xt2.id_1));
|
||||
id_1
|
||||
1
|
||||
2
|
||||
SELECT DISTINCT t1.id_1 FROM t1 WHERE
|
||||
(12 IN ((SELECT t1xt2.id_2 FROM t1xt2 WHERE t1.id_1 = t1xt2.id_1)));
|
||||
id_1
|
||||
1
|
||||
2
|
||||
SELECT DISTINCT t1.id_1 FROM t1 WHERE
|
||||
(12 IN (((SELECT t1xt2.id_2 FROM t1xt2 WHERE t1.id_1 = t1xt2.id_1))));
|
||||
id_1
|
||||
1
|
||||
2
|
||||
SELECT DISTINCT t1.id_1 FROM t1 WHERE
|
||||
(12 NOT IN (SELECT t1xt2.id_2 FROM t1xt2 WHERE t1.id_1 = t1xt2.id_1));
|
||||
id_1
|
||||
3
|
||||
4
|
||||
SELECT DISTINCT t1.id_1 FROM t1 WHERE
|
||||
(12 NOT IN ((SELECT t1xt2.id_2 FROM t1xt2 WHERE t1.id_1 = t1xt2.id_1)));
|
||||
id_1
|
||||
3
|
||||
4
|
||||
SELECT DISTINCT t1.id_1 FROM t1 WHERE
|
||||
(12 NOT IN (((SELECT t1xt2.id_2 FROM t1xt2 WHERE t1.id_1 = t1xt2.id_1))));
|
||||
id_1
|
||||
3
|
||||
4
|
||||
DROP TABLE t1;
|
||||
DROP TABLE t2;
|
||||
DROP TABLE t1xt2;
|
||||
|
@ -1335,4 +1335,41 @@ SELECT fubar_id FROM t2;
|
||||
fubar_id
|
||||
1
|
||||
DROP TABLE t1,t2;
|
||||
DROP TABLE IF EXISTS bug21825_A;
|
||||
DROP TABLE IF EXISTS bug21825_B;
|
||||
CREATE TABLE bug21825_A (id int(10));
|
||||
CREATE TABLE bug21825_B (id int(10));
|
||||
CREATE TRIGGER trgA AFTER INSERT ON bug21825_A
|
||||
FOR EACH ROW
|
||||
BEGIN
|
||||
INSERT INTO bug21825_B (id) values (1);
|
||||
END//
|
||||
INSERT INTO bug21825_A (id) VALUES (10);
|
||||
INSERT INTO bug21825_A (id) VALUES (20);
|
||||
DROP TABLE bug21825_B;
|
||||
DELETE FROM bug21825_A WHERE id = 20;
|
||||
DROP TABLE bug21825_A;
|
||||
DROP TABLE IF EXISTS bug22580_t1;
|
||||
DROP PROCEDURE IF EXISTS bug22580_proc_1;
|
||||
DROP PROCEDURE IF EXISTS bug22580_proc_2;
|
||||
CREATE TABLE bug22580_t1 (a INT, b INT);
|
||||
CREATE PROCEDURE bug22580_proc_2()
|
||||
BEGIN
|
||||
DROP TABLE IF EXISTS bug22580_tmp;
|
||||
CREATE TEMPORARY TABLE bug22580_tmp (a INT);
|
||||
DROP TABLE bug22580_tmp;
|
||||
END||
|
||||
CREATE PROCEDURE bug22580_proc_1()
|
||||
BEGIN
|
||||
CALL bug22580_proc_2();
|
||||
END||
|
||||
CREATE TRIGGER t1bu BEFORE UPDATE ON bug22580_t1
|
||||
FOR EACH ROW
|
||||
BEGIN
|
||||
CALL bug22580_proc_1();
|
||||
END||
|
||||
INSERT INTO bug22580_t1 VALUES (1,1);
|
||||
DROP TABLE bug22580_t1;
|
||||
DROP PROCEDURE bug22580_proc_1;
|
||||
DROP PROCEDURE bug22580_proc_2;
|
||||
End of 5.0 tests
|
||||
|
@ -834,14 +834,16 @@ show create view v1;
|
||||
View Create View
|
||||
v1 CREATE ALGORITHM=UNDEFINED DEFINER=`root`@`localhost` SQL SECURITY DEFINER VIEW `v1` AS select 99999999999999999999999999999999999999999999999999999 AS `col1`
|
||||
drop view v1;
|
||||
create table t<> (c<> char);
|
||||
create view v<> as select c<> from t<>;
|
||||
insert into v<> values ('<27>');
|
||||
select * from v<>;
|
||||
c<EFBFBD>
|
||||
<EFBFBD>
|
||||
drop view v<>;
|
||||
drop table t<>;
|
||||
set names utf8;
|
||||
create table tü (cü char);
|
||||
create view vü as select cü from tü;
|
||||
insert into vü values ('ü');
|
||||
select * from vü;
|
||||
cü
|
||||
ü
|
||||
drop view vü;
|
||||
drop table tü;
|
||||
set names latin1;
|
||||
create table t1 (a int, b int);
|
||||
insert into t1 values (1,2), (1,3), (2,4), (2,5), (3,10);
|
||||
create view v1(c) as select a+1 from t1 where b >= 4;
|
||||
@ -1933,11 +1935,11 @@ create function f1 () returns int return (select max(col1) from t1);
|
||||
DROP TABLE t1;
|
||||
CHECK TABLE v1, v2, v3, v4, v5, v6;
|
||||
Table Op Msg_type Msg_text
|
||||
test.v1 check error View 'test.v1' references invalid table(s) or column(s) or function(s) or definer/invoker of view lack rights to use them
|
||||
test.v1 check status OK
|
||||
test.v2 check status OK
|
||||
test.v3 check error View 'test.v3' references invalid table(s) or column(s) or function(s) or definer/invoker of view lack rights to use them
|
||||
test.v3 check status OK
|
||||
test.v4 check status OK
|
||||
test.v5 check error View 'test.v5' references invalid table(s) or column(s) or function(s) or definer/invoker of view lack rights to use them
|
||||
test.v5 check status OK
|
||||
test.v6 check status OK
|
||||
drop function f1;
|
||||
drop function f2;
|
||||
@ -3035,7 +3037,7 @@ View Create View
|
||||
v1 CREATE ALGORITHM=UNDEFINED DEFINER=`root`@`localhost` SQL SECURITY DEFINER VIEW `v1` AS select _latin1'The\ZEnd' AS `TheEnd`
|
||||
DROP VIEW v1;
|
||||
CREATE TABLE t1 (mydate DATETIME);
|
||||
INSERT INTO t1 VALUES
|
||||
INSERT INTO t1 VALUES
|
||||
('2007-01-01'), ('2007-01-02'), ('2007-01-30'), ('2007-01-31');
|
||||
CREATE VIEW v1 AS SELECT mydate from t1;
|
||||
SELECT * FROM t1 WHERE mydate BETWEEN '2007-01-01' AND '2007-01-31';
|
||||
@ -3135,4 +3137,139 @@ code COUNT(DISTINCT country)
|
||||
100 2
|
||||
DROP VIEW v1;
|
||||
DROP TABLE t1;
|
||||
DROP VIEW IF EXISTS v1;
|
||||
SELECT * FROM (SELECT 1) AS t;
|
||||
1
|
||||
1
|
||||
CREATE VIEW v1 AS SELECT * FROM (SELECT 1) AS t;
|
||||
ERROR HY000: View's SELECT contains a subquery in the FROM clause
|
||||
# Previously the following would fail.
|
||||
SELECT * FROM (SELECT 1) AS t;
|
||||
1
|
||||
1
|
||||
drop view if exists view_24532_a;
|
||||
drop view if exists view_24532_b;
|
||||
drop table if exists table_24532;
|
||||
create table table_24532 (
|
||||
a int,
|
||||
b bigint,
|
||||
c int(4),
|
||||
d bigint(48)
|
||||
);
|
||||
create view view_24532_a as
|
||||
select
|
||||
a IS TRUE,
|
||||
a IS NOT TRUE,
|
||||
a IS FALSE,
|
||||
a IS NOT FALSE,
|
||||
a IS UNKNOWN,
|
||||
a IS NOT UNKNOWN,
|
||||
a is NULL,
|
||||
a IS NOT NULL,
|
||||
ISNULL(a),
|
||||
b IS TRUE,
|
||||
b IS NOT TRUE,
|
||||
b IS FALSE,
|
||||
b IS NOT FALSE,
|
||||
b IS UNKNOWN,
|
||||
b IS NOT UNKNOWN,
|
||||
b is NULL,
|
||||
b IS NOT NULL,
|
||||
ISNULL(b),
|
||||
c IS TRUE,
|
||||
c IS NOT TRUE,
|
||||
c IS FALSE,
|
||||
c IS NOT FALSE,
|
||||
c IS UNKNOWN,
|
||||
c IS NOT UNKNOWN,
|
||||
c is NULL,
|
||||
c IS NOT NULL,
|
||||
ISNULL(c),
|
||||
d IS TRUE,
|
||||
d IS NOT TRUE,
|
||||
d IS FALSE,
|
||||
d IS NOT FALSE,
|
||||
d IS UNKNOWN,
|
||||
d IS NOT UNKNOWN,
|
||||
d is NULL,
|
||||
d IS NOT NULL,
|
||||
ISNULL(d)
|
||||
from table_24532;
|
||||
describe view_24532_a;
|
||||
Field Type Null Key Default Extra
|
||||
a IS TRUE int(1) NO 0
|
||||
a IS NOT TRUE int(1) NO 0
|
||||
a IS FALSE int(1) NO 0
|
||||
a IS NOT FALSE int(1) NO 0
|
||||
a IS UNKNOWN int(1) NO 0
|
||||
a IS NOT UNKNOWN int(1) NO 0
|
||||
a is NULL int(1) NO 0
|
||||
a IS NOT NULL int(1) NO 0
|
||||
ISNULL(a) int(1) NO 0
|
||||
b IS TRUE int(1) NO 0
|
||||
b IS NOT TRUE int(1) NO 0
|
||||
b IS FALSE int(1) NO 0
|
||||
b IS NOT FALSE int(1) NO 0
|
||||
b IS UNKNOWN int(1) NO 0
|
||||
b IS NOT UNKNOWN int(1) NO 0
|
||||
b is NULL int(1) NO 0
|
||||
b IS NOT NULL int(1) NO 0
|
||||
ISNULL(b) int(1) NO 0
|
||||
c IS TRUE int(1) NO 0
|
||||
c IS NOT TRUE int(1) NO 0
|
||||
c IS FALSE int(1) NO 0
|
||||
c IS NOT FALSE int(1) NO 0
|
||||
c IS UNKNOWN int(1) NO 0
|
||||
c IS NOT UNKNOWN int(1) NO 0
|
||||
c is NULL int(1) NO 0
|
||||
c IS NOT NULL int(1) NO 0
|
||||
ISNULL(c) int(1) NO 0
|
||||
d IS TRUE int(1) NO 0
|
||||
d IS NOT TRUE int(1) NO 0
|
||||
d IS FALSE int(1) NO 0
|
||||
d IS NOT FALSE int(1) NO 0
|
||||
d IS UNKNOWN int(1) NO 0
|
||||
d IS NOT UNKNOWN int(1) NO 0
|
||||
d is NULL int(1) NO 0
|
||||
d IS NOT NULL int(1) NO 0
|
||||
ISNULL(d) int(1) NO 0
|
||||
create view view_24532_b as
|
||||
select
|
||||
a IS TRUE,
|
||||
if(ifnull(a, 0), 1, 0) as old_istrue,
|
||||
a IS NOT TRUE,
|
||||
if(ifnull(a, 0), 0, 1) as old_isnottrue,
|
||||
a IS FALSE,
|
||||
if(ifnull(a, 1), 0, 1) as old_isfalse,
|
||||
a IS NOT FALSE,
|
||||
if(ifnull(a, 1), 1, 0) as old_isnotfalse
|
||||
from table_24532;
|
||||
describe view_24532_b;
|
||||
Field Type Null Key Default Extra
|
||||
a IS TRUE int(1) NO 0
|
||||
old_istrue int(1) NO 0
|
||||
a IS NOT TRUE int(1) NO 0
|
||||
old_isnottrue int(1) NO 0
|
||||
a IS FALSE int(1) NO 0
|
||||
old_isfalse int(1) NO 0
|
||||
a IS NOT FALSE int(1) NO 0
|
||||
old_isnotfalse int(1) NO 0
|
||||
show create view view_24532_b;
|
||||
View Create View
|
||||
view_24532_b CREATE ALGORITHM=UNDEFINED DEFINER=`root`@`localhost` SQL SECURITY DEFINER VIEW `view_24532_b` AS select (`table_24532`.`a` is true) AS `a IS TRUE`,if(ifnull(`table_24532`.`a`,0),1,0) AS `old_istrue`,(`table_24532`.`a` is not true) AS `a IS NOT TRUE`,if(ifnull(`table_24532`.`a`,0),0,1) AS `old_isnottrue`,(`table_24532`.`a` is false) AS `a IS FALSE`,if(ifnull(`table_24532`.`a`,1),0,1) AS `old_isfalse`,(`table_24532`.`a` is not false) AS `a IS NOT FALSE`,if(ifnull(`table_24532`.`a`,1),1,0) AS `old_isnotfalse` from `table_24532`
|
||||
insert into table_24532 values (0, 0, 0, 0);
|
||||
select * from view_24532_b;
|
||||
a IS TRUE old_istrue a IS NOT TRUE old_isnottrue a IS FALSE old_isfalse a IS NOT FALSE old_isnotfalse
|
||||
0 0 1 1 1 1 0 0
|
||||
update table_24532 set a=1;
|
||||
select * from view_24532_b;
|
||||
a IS TRUE old_istrue a IS NOT TRUE old_isnottrue a IS FALSE old_isfalse a IS NOT FALSE old_isnotfalse
|
||||
1 1 0 0 0 0 1 1
|
||||
update table_24532 set a=NULL;
|
||||
select * from view_24532_b;
|
||||
a IS TRUE old_istrue a IS NOT TRUE old_isnottrue a IS FALSE old_isfalse a IS NOT FALSE old_isnotfalse
|
||||
0 0 1 1 0 0 1 1
|
||||
drop view view_24532_a;
|
||||
drop view view_24532_b;
|
||||
drop table table_24532;
|
||||
End of 5.0 tests.
|
||||
|
@ -27,3 +27,12 @@ insert into t2 values (11), (13);
|
||||
drop procedure p1;
|
||||
drop function f1;
|
||||
drop view v1;
|
||||
|
||||
#
|
||||
# Bug#23240 --init-file statements with NOW() reports '1970-01-01 11:00:00'as the date time
|
||||
#
|
||||
CREATE DATABASE IF NOT EXISTS init_file;
|
||||
CREATE TABLE IF NOT EXISTS init_file.startup ( startdate DATETIME );
|
||||
INSERT INTO init_file.startup VALUES ( NOW() );
|
||||
|
||||
|
||||
|
@ -10,6 +10,5 @@
|
||||
#
|
||||
##############################################################################
|
||||
|
||||
im_daemon_life_cycle : Bug#24415 see note: [19 Dec 23:17] Trudy Pelzer
|
||||
ndb_load : Bug#17233
|
||||
user_limits : Bug#23921 random failure of user_limits.test
|
||||
|
@ -97,3 +97,14 @@ create table t1 (f1 int, f2 int);
|
||||
insert into t1 values(1,1),(0,0);
|
||||
select f1, f2, if(f1, 40.0, 5.00) from t1 group by f1 order by f2;
|
||||
drop table t1;
|
||||
|
||||
#
|
||||
# Bug#24532 (The return data type of IS TRUE is different from similar
|
||||
# operations)
|
||||
#
|
||||
# IF(x, unsigned, unsigned) should be unsigned.
|
||||
#
|
||||
|
||||
select if(0, 18446744073709551610, 18446744073709551610);
|
||||
|
||||
|
||||
|
@ -132,4 +132,61 @@ set global query_cache_size=default;
|
||||
create table t1 select INET_ATON('255.255.0.1') as `a`;
|
||||
show create table t1;
|
||||
drop table t1;
|
||||
|
||||
#
|
||||
# Bug#26093 (SELECT BENCHMARK() for SELECT statements does not produce
|
||||
# valid results)
|
||||
#
|
||||
|
||||
--disable_warnings
|
||||
drop table if exists table_26093;
|
||||
drop function if exists func_26093_a;
|
||||
drop function if exists func_26093_b;
|
||||
--enable_warnings
|
||||
|
||||
create table table_26093(a int);
|
||||
insert into table_26093 values
|
||||
(1), (2), (3), (4), (5),
|
||||
(6), (7), (8), (9), (10);
|
||||
|
||||
delimiter //;
|
||||
|
||||
create function func_26093_a(x int) returns int
|
||||
begin
|
||||
set @invoked := @invoked + 1;
|
||||
return x;
|
||||
end//
|
||||
|
||||
create function func_26093_b(x int, y int) returns int
|
||||
begin
|
||||
set @invoked := @invoked + 1;
|
||||
return x;
|
||||
end//
|
||||
|
||||
delimiter ;//
|
||||
|
||||
select avg(a) from table_26093;
|
||||
|
||||
select benchmark(100, (select avg(a) from table_26093));
|
||||
|
||||
set @invoked := 0;
|
||||
select benchmark(100, (select avg(func_26093_a(a)) from table_26093));
|
||||
# Returns only 10, since intermediate results are cached.
|
||||
select @invoked;
|
||||
|
||||
set @invoked := 0;
|
||||
select benchmark(100, (select avg(func_26093_b(a, rand())) from table_26093));
|
||||
# Returns 1000, due to rand() preventing caching.
|
||||
select @invoked;
|
||||
|
||||
--error ER_SUBQUERY_NO_1_ROW
|
||||
select benchmark(100, (select (a) from table_26093));
|
||||
|
||||
--error ER_OPERAND_COLUMNS
|
||||
select benchmark(100, (select 1, 1));
|
||||
|
||||
drop table table_26093;
|
||||
drop function func_26093_a;
|
||||
drop function func_26093_b;
|
||||
|
||||
--echo End of 5.0 tests
|
||||
|
@ -23,15 +23,20 @@
|
||||
# - wait for IM-main to start accepting connections before continue test
|
||||
# case;
|
||||
#
|
||||
# NOTE: timeout is 55 seconds. Timeout should be more than shutdown-delay
|
||||
# specified for managed MySQL instance. Now shutdown-delay is 10 seconds
|
||||
# (set in mysql-test-run.pl). So, 55 seconds should be enough to make 5
|
||||
# attempts.
|
||||
#
|
||||
###########################################################################
|
||||
|
||||
--exec $MYSQL_TEST_DIR/t/log.sh im_daemon_life_cycle Main-test: starting...
|
||||
|
||||
--exec $MYSQL_TEST_DIR/t/log.sh im_daemon_life_cycle Killing IM-main...
|
||||
--exec $MYSQL_TEST_DIR/t/kill_n_check.sh $IM_PATH_PID restarted 30 im_daemon_life_cycle
|
||||
--exec $MYSQL_TEST_DIR/t/kill_n_check.sh $IM_PATH_PID restarted 55 im_daemon_life_cycle
|
||||
|
||||
--exec $MYSQL_TEST_DIR/t/log.sh im_daemon_life_cycle Waiting for IM-main to start accepting connections...
|
||||
--exec $MYSQL_TEST_DIR/t/wait_for_socket.sh $EXE_MYSQL $IM_PATH_SOCK $IM_USERNAME $IM_PASSWORD '' 30 im_daemon_life_cycle
|
||||
--exec $MYSQL_TEST_DIR/t/wait_for_socket.sh $EXE_MYSQL $IM_PATH_SOCK $IM_USERNAME $IM_PASSWORD '' 55 im_daemon_life_cycle
|
||||
|
||||
--exec $MYSQL_TEST_DIR/t/log.sh im_daemon_life_cycle Main-test: done.
|
||||
|
||||
@ -58,23 +63,23 @@
|
||||
START INSTANCE mysqld2;
|
||||
|
||||
--exec $MYSQL_TEST_DIR/t/log.sh im_daemon_life_cycle mysqld2: waiting to start...
|
||||
--exec $MYSQL_TEST_DIR/t/wait_for_process.sh $IM_MYSQLD2_PATH_PID 30 started im_daemon_life_cycle
|
||||
--exec $MYSQL_TEST_DIR/t/wait_for_process.sh $IM_MYSQLD2_PATH_PID 55 started im_daemon_life_cycle
|
||||
|
||||
--exec $MYSQL_TEST_DIR/t/log.sh im_daemon_life_cycle mysqld2: started.
|
||||
|
||||
# 2. Restart IM-main;
|
||||
|
||||
--exec $MYSQL_TEST_DIR/t/log.sh im_daemon_life_cycle Killing IM-main...
|
||||
--exec $MYSQL_TEST_DIR/t/kill_n_check.sh $IM_PATH_PID restarted 30 im_daemon_life_cycle
|
||||
--exec $MYSQL_TEST_DIR/t/kill_n_check.sh $IM_PATH_PID restarted 55 im_daemon_life_cycle
|
||||
|
||||
--exec $MYSQL_TEST_DIR/t/log.sh im_daemon_life_cycle Waiting for IM-main to start accepting connections...
|
||||
--exec $MYSQL_TEST_DIR/t/wait_for_socket.sh $EXE_MYSQL $IM_PATH_SOCK $IM_USERNAME $IM_PASSWORD '' 30 im_daemon_life_cycle
|
||||
--exec $MYSQL_TEST_DIR/t/wait_for_socket.sh $EXE_MYSQL $IM_PATH_SOCK $IM_USERNAME $IM_PASSWORD '' 55 im_daemon_life_cycle
|
||||
|
||||
# 3. Issue some statement -- connection should be re-established.
|
||||
|
||||
--exec $MYSQL_TEST_DIR/t/log.sh im_daemon_life_cycle Checking that IM-main processing commands...
|
||||
|
||||
--replace_column 3 VERSION
|
||||
--replace_column 2 STATE 3 VERSION
|
||||
SHOW INSTANCE STATUS mysqld1;
|
||||
|
||||
# 4. Stop mysqld2, because it will not be stopped by IM, as it is nonguarded.
|
||||
@ -85,7 +90,7 @@ SHOW INSTANCE STATUS mysqld1;
|
||||
STOP INSTANCE mysqld2;
|
||||
|
||||
--exec $MYSQL_TEST_DIR/t/log.sh im_daemon_life_cycle mysqld2: waiting to stop...
|
||||
--exec $MYSQL_TEST_DIR/t/wait_for_process.sh $IM_MYSQLD2_PATH_PID 30 stopped im_daemon_life_cycle
|
||||
--exec $MYSQL_TEST_DIR/t/wait_for_process.sh $IM_MYSQLD2_PATH_PID 55 stopped im_daemon_life_cycle
|
||||
--exec $MYSQL_TEST_DIR/t/log.sh im_daemon_life_cycle mysqld2: stopped.
|
||||
|
||||
###########################################################################
|
||||
|
@ -6,6 +6,15 @@
|
||||
# mysql-test/t/init_file-master.opt for the actual test
|
||||
#
|
||||
|
||||
#
|
||||
# Bug#23240 --init-file statements with NOW() reports '1970-01-01 11:00:00'as the date time
|
||||
#
|
||||
INSERT INTO init_file.startup VALUES ( NOW() );
|
||||
SELECT * INTO @X FROM init_file.startup limit 0,1;
|
||||
SELECT * INTO @Y FROM init_file.startup limit 1,1;
|
||||
SELECT YEAR(@X)-YEAR(@Y);
|
||||
DROP DATABASE init_file;
|
||||
|
||||
--echo ok
|
||||
--echo end of 4.1 tests
|
||||
#
|
||||
|
@ -53,7 +53,7 @@ pid_path="$1"
|
||||
expected_result="$2"
|
||||
total_timeout="$3"
|
||||
test_id="$4"
|
||||
log_file="$MYSQLTEST_VARDIR/log/$test_id.log"
|
||||
log_file="$MYSQLTEST_VARDIR/log/$test_id.script.log"
|
||||
|
||||
log_debug "-- $basename: starting --"
|
||||
log_debug "pid_path: '$pid_path'"
|
||||
|
@ -17,7 +17,7 @@ if [ $# -lt 2 ]; then
|
||||
fi
|
||||
|
||||
test_id="$1"
|
||||
log_file="$MYSQLTEST_VARDIR/log/$test_id.log"
|
||||
log_file="$MYSQLTEST_VARDIR/log/$test_id.script.log"
|
||||
|
||||
shift
|
||||
|
||||
|
@ -1607,10 +1607,12 @@ create function bug11555_1() returns int return (select max(i) from t1);
|
||||
create function bug11555_2() returns int return bug11555_1();
|
||||
# It is OK to report name of implicitly used table which is missing
|
||||
# when we create view.
|
||||
--error ER_NO_SUCH_TABLE
|
||||
# For stored functions however, because of exceptions handlers, there is
|
||||
# no easy way to find out if a missing table makes the view invalid.
|
||||
create view v1 as select bug11555_1();
|
||||
--error ER_NO_SUCH_TABLE
|
||||
drop view v1;
|
||||
create view v2 as select bug11555_2();
|
||||
drop view v2;
|
||||
# But we should hide name of missing implicitly used table when we use view
|
||||
create table t1 (i int);
|
||||
create view v1 as select bug11555_1();
|
||||
@ -1625,9 +1627,8 @@ select * from v2;
|
||||
select * from v3;
|
||||
# Note that creation of view which depends on broken view is yet
|
||||
# another form of view usage.
|
||||
--error ER_VIEW_INVALID
|
||||
create view v4 as select * from v1;
|
||||
drop view v1, v2, v3;
|
||||
drop view v1, v2, v3, v4;
|
||||
# We also should hide details about broken triggers which are
|
||||
# invoked for view.
|
||||
drop function bug11555_1;
|
||||
@ -1637,12 +1638,14 @@ create table t2 (i int);
|
||||
create trigger t1_ai after insert on t1 for each row insert into t2 values (new.i);
|
||||
create view v1 as select * from t1;
|
||||
drop table t2;
|
||||
--error ER_VIEW_INVALID
|
||||
# Limitation, the desired error is ER_VIEW_INVALID
|
||||
--error ER_TABLE_NOT_LOCKED
|
||||
insert into v1 values (1);
|
||||
drop trigger t1_ai;
|
||||
create function bug11555_1() returns int return (select max(i) from t2);
|
||||
create trigger t1_ai after insert on t1 for each row set @a:=bug11555_1();
|
||||
--error ER_VIEW_INVALID
|
||||
# Limitation, the desired error is ER_VIEW_INVALID
|
||||
--error ER_TABLE_NOT_LOCKED
|
||||
insert into v1 values (2);
|
||||
drop function bug11555_1;
|
||||
drop table t1;
|
||||
@ -1839,6 +1842,184 @@ call bug24491();
|
||||
drop procedure bug24491;
|
||||
drop tables t1;
|
||||
|
||||
#
|
||||
# BUG#18914: Calling certain SPs from triggers fail
|
||||
#
|
||||
# Failing to call a procedure that does implicit commit from a trigger
|
||||
# is a correct behaviour, however the error message was misleading.
|
||||
#
|
||||
# DROP TABLE IF EXISTS is also fixed to give correct error instead of
|
||||
# "Table doesn't exist".
|
||||
#
|
||||
--disable_warnings
|
||||
DROP FUNCTION IF EXISTS bug18914_f1;
|
||||
DROP FUNCTION IF EXISTS bug18914_f2;
|
||||
DROP PROCEDURE IF EXISTS bug18914_p1;
|
||||
DROP PROCEDURE IF EXISTS bug18914_p2;
|
||||
DROP TABLE IF EXISTS t1, t2;
|
||||
--enable_warnings
|
||||
|
||||
CREATE TABLE t1 (i INT);
|
||||
|
||||
CREATE PROCEDURE bug18914_p1() CREATE TABLE t2 (i INT);
|
||||
CREATE PROCEDURE bug18914_p2() DROP TABLE IF EXISTS no_such_table;
|
||||
|
||||
delimiter |;
|
||||
CREATE FUNCTION bug18914_f1() RETURNS INT
|
||||
BEGIN
|
||||
CALL bug18914_p1();
|
||||
RETURN 1;
|
||||
END |
|
||||
|
||||
CREATE FUNCTION bug18914_f2() RETURNS INT
|
||||
BEGIN
|
||||
CALL bug18914_p2();
|
||||
RETURN 1;
|
||||
END |
|
||||
delimiter ;|
|
||||
|
||||
CREATE TRIGGER t1_bi BEFORE INSERT ON t1 FOR EACH ROW
|
||||
CALL bug18914_p1();
|
||||
|
||||
--error ER_COMMIT_NOT_ALLOWED_IN_SF_OR_TRG
|
||||
INSERT INTO t1 VALUES (1);
|
||||
|
||||
--error ER_COMMIT_NOT_ALLOWED_IN_SF_OR_TRG
|
||||
SELECT bug18914_f1();
|
||||
|
||||
--error ER_COMMIT_NOT_ALLOWED_IN_SF_OR_TRG
|
||||
SELECT bug18914_f2();
|
||||
|
||||
--error ER_NO_SUCH_TABLE
|
||||
SELECT * FROM t2;
|
||||
|
||||
DROP FUNCTION bug18914_f1;
|
||||
DROP FUNCTION bug18914_f2;
|
||||
DROP PROCEDURE bug18914_p1;
|
||||
DROP PROCEDURE bug18914_p2;
|
||||
DROP TABLE t1;
|
||||
|
||||
#
|
||||
# Bug#20713 (Functions will not not continue for SQLSTATE VALUE '42S02')
|
||||
#
|
||||
|
||||
--disable_warnings
|
||||
drop table if exists bogus_table_20713;
|
||||
drop function if exists func_20713_a;
|
||||
drop function if exists func_20713_b;
|
||||
--enable_warnings
|
||||
|
||||
create table bogus_table_20713( id int(10) not null primary key);
|
||||
insert into bogus_table_20713 values (1), (2), (3);
|
||||
|
||||
delimiter //;
|
||||
|
||||
create function func_20713_a() returns int(11)
|
||||
begin
|
||||
declare id int;
|
||||
|
||||
declare continue handler for sqlexception set id=null;
|
||||
|
||||
set @in_func := 1;
|
||||
set id = (select id from bogus_table_20713 where id = 3);
|
||||
set @in_func := 2;
|
||||
|
||||
return id;
|
||||
end//
|
||||
|
||||
create function func_20713_b() returns int(11)
|
||||
begin
|
||||
declare id int;
|
||||
|
||||
declare continue handler for sqlstate value '42S02' set id=null;
|
||||
|
||||
set @in_func := 1;
|
||||
set id = (select id from bogus_table_20713 where id = 3);
|
||||
set @in_func := 2;
|
||||
|
||||
return id;
|
||||
end//
|
||||
|
||||
delimiter ;//
|
||||
|
||||
set @in_func := 0;
|
||||
select func_20713_a();
|
||||
select @in_func;
|
||||
|
||||
set @in_func := 0;
|
||||
select func_20713_b();
|
||||
select @in_func;
|
||||
|
||||
drop table bogus_table_20713;
|
||||
|
||||
set @in_func := 0;
|
||||
select func_20713_a();
|
||||
select @in_func;
|
||||
|
||||
set @in_func := 0;
|
||||
select func_20713_b();
|
||||
select @in_func;
|
||||
|
||||
drop function if exists func_20713_a;
|
||||
drop function if exists func_20713_b;
|
||||
|
||||
#
|
||||
# Bug#25345 (Cursors from Functions)
|
||||
#
|
||||
|
||||
--disable_warnings
|
||||
drop table if exists table_25345_a;
|
||||
drop table if exists table_25345_b;
|
||||
drop procedure if exists proc_25345;
|
||||
drop function if exists func_25345;
|
||||
drop function if exists func_25345_b;
|
||||
--enable_warnings
|
||||
|
||||
create table table_25345_a (a int);
|
||||
create table table_25345_b (b int);
|
||||
|
||||
delimiter ||;
|
||||
|
||||
create procedure proc_25345()
|
||||
begin
|
||||
declare c1 cursor for select a from table_25345_a;
|
||||
declare c2 cursor for select b from table_25345_b;
|
||||
|
||||
select 1 as result;
|
||||
end ||
|
||||
|
||||
create function func_25345() returns int(11)
|
||||
begin
|
||||
call proc_25345();
|
||||
return 1;
|
||||
end ||
|
||||
|
||||
create function func_25345_b() returns int(11)
|
||||
begin
|
||||
declare c1 cursor for select a from table_25345_a;
|
||||
declare c2 cursor for select b from table_25345_b;
|
||||
|
||||
return 1;
|
||||
end ||
|
||||
|
||||
delimiter ;||
|
||||
|
||||
call proc_25345();
|
||||
--error ER_SP_NO_RETSET
|
||||
select func_25345();
|
||||
select func_25345_b();
|
||||
|
||||
drop table table_25345_a;
|
||||
|
||||
call proc_25345();
|
||||
--error ER_SP_NO_RETSET
|
||||
select func_25345();
|
||||
select func_25345_b();
|
||||
|
||||
drop table table_25345_b;
|
||||
drop procedure proc_25345;
|
||||
drop function func_25345;
|
||||
drop function func_25345_b;
|
||||
|
||||
#
|
||||
# BUG#NNNN: New bug synopsis
|
||||
|
@ -500,8 +500,6 @@ DROP PROCEDURE p1;
|
||||
#
|
||||
# Test case for BUG#12976: Boolean values reversed in stored procedures?
|
||||
#
|
||||
# TODO: test case failed.
|
||||
#
|
||||
###########################################################################
|
||||
|
||||
--echo
|
||||
@ -566,13 +564,8 @@ BEGIN
|
||||
END|
|
||||
delimiter ;|
|
||||
|
||||
# The expected and correct result.
|
||||
|
||||
call p1();
|
||||
|
||||
# The wrong result. Note that only hex(vb) works, but is printed with two
|
||||
# digits for some reason in this case.
|
||||
|
||||
call p2();
|
||||
|
||||
#
|
||||
@ -583,6 +576,64 @@ DROP TABLE t1;
|
||||
DROP PROCEDURE p1;
|
||||
DROP PROCEDURE p2;
|
||||
|
||||
# Additional tests for Bug#12976
|
||||
|
||||
--disable_warnings
|
||||
DROP TABLE IF EXISTS table_12976_a;
|
||||
DROP TABLE IF EXISTS table_12976_b;
|
||||
DROP PROCEDURE IF EXISTS proc_12976_a;
|
||||
DROP PROCEDURE IF EXISTS proc_12976_b;
|
||||
--enable_warnings
|
||||
|
||||
CREATE TABLE table_12976_a (val bit(1));
|
||||
|
||||
CREATE TABLE table_12976_b(
|
||||
appname varchar(15),
|
||||
emailperm bit not null default 1,
|
||||
phoneperm bit not null default 0);
|
||||
|
||||
insert into table_12976_b values ('A', b'1', b'1'), ('B', b'0', b'0');
|
||||
|
||||
delimiter ||;
|
||||
CREATE PROCEDURE proc_12976_a()
|
||||
BEGIN
|
||||
declare localvar bit(1);
|
||||
SELECT val INTO localvar FROM table_12976_a;
|
||||
SELECT coalesce(localvar, 1)+1, coalesce(val, 1)+1 FROM table_12976_a;
|
||||
END||
|
||||
|
||||
CREATE PROCEDURE proc_12976_b(
|
||||
name varchar(15),
|
||||
out ep bit,
|
||||
out msg varchar(10))
|
||||
BEGIN
|
||||
SELECT emailperm into ep FROM table_12976_b where (appname = name);
|
||||
IF ep is true THEN
|
||||
SET msg = 'True';
|
||||
ELSE
|
||||
SET msg = 'False';
|
||||
END IF;
|
||||
END||
|
||||
|
||||
delimiter ;||
|
||||
|
||||
INSERT table_12976_a VALUES (0);
|
||||
call proc_12976_a();
|
||||
UPDATE table_12976_a set val=1;
|
||||
call proc_12976_a();
|
||||
|
||||
call proc_12976_b('A', @ep, @msg);
|
||||
select @ep, @msg;
|
||||
|
||||
call proc_12976_b('B', @ep, @msg);
|
||||
select @ep, @msg;
|
||||
|
||||
DROP TABLE table_12976_a;
|
||||
DROP TABLE table_12976_b;
|
||||
DROP PROCEDURE proc_12976_a;
|
||||
DROP PROCEDURE proc_12976_b;
|
||||
|
||||
|
||||
###########################################################################
|
||||
#
|
||||
# Test case for BUG#9572: Stored procedures: variable type declarations
|
||||
|
@ -1370,7 +1370,7 @@ end|
|
||||
select f11()|
|
||||
--error ER_CANT_REOPEN_TABLE
|
||||
select f11() from t1|
|
||||
# We don't handle temporary tables used by nested functions well
|
||||
# Test that using a single table instance at a time works
|
||||
create function f12_1() returns int
|
||||
begin
|
||||
drop temporary table if exists t3;
|
||||
@ -1380,11 +1380,9 @@ begin
|
||||
end|
|
||||
create function f12_2() returns int
|
||||
return (select count(*) from t3)|
|
||||
# We need clean start to get error
|
||||
|
||||
drop temporary table t3|
|
||||
--error ER_NO_SUCH_TABLE
|
||||
select f12_1()|
|
||||
--error ER_NO_SUCH_TABLE
|
||||
select f12_1() from t1 limit 1|
|
||||
|
||||
# Cleanup
|
||||
@ -6693,6 +6691,53 @@ CALL bug24117()|
|
||||
DROP PROCEDURE bug24117|
|
||||
DROP TABLE t3|
|
||||
|
||||
#
|
||||
# Bug#8407(Stored functions/triggers ignore exception handler)
|
||||
#
|
||||
|
||||
--disable_warnings
|
||||
drop function if exists func_8407_a|
|
||||
drop function if exists func_8407_b|
|
||||
--enable_warnings
|
||||
|
||||
create function func_8407_a() returns int
|
||||
begin
|
||||
declare x int;
|
||||
|
||||
declare continue handler for sqlexception
|
||||
begin
|
||||
end;
|
||||
|
||||
select 1 from no_such_view limit 1 into x;
|
||||
|
||||
return x;
|
||||
end|
|
||||
|
||||
create function func_8407_b() returns int
|
||||
begin
|
||||
declare x int default 0;
|
||||
|
||||
declare continue handler for sqlstate '42S02'
|
||||
begin
|
||||
set x:= x+1000;
|
||||
end;
|
||||
|
||||
case (select 1 from no_such_view limit 1)
|
||||
when 1 then set x:= x+1;
|
||||
when 2 then set x:= x+2;
|
||||
else set x:= x+100;
|
||||
end case;
|
||||
set x:=x + 500;
|
||||
|
||||
return x;
|
||||
end|
|
||||
|
||||
select func_8407_a()|
|
||||
select func_8407_b()|
|
||||
|
||||
drop function func_8407_a|
|
||||
drop function func_8407_b|
|
||||
|
||||
#
|
||||
# NOTE: The delimiter is `|`, and not `;`. It is changed to `;`
|
||||
# at the end of the file!
|
||||
|
@ -2002,7 +2002,7 @@ EXPLAIN SELECT a FROM t1 WHERE (SELECT 1 FROM DUAL WHERE 1=0) IS NULL;
|
||||
DROP TABLE t1;
|
||||
|
||||
#
|
||||
# Bug 24653: sorting by expressions containing subselects
|
||||
# Bug 24653: sorting by expressions containing subselects
|
||||
# that return more than one row
|
||||
#
|
||||
|
||||
@ -2014,12 +2014,12 @@ INSERT INTO t2 VALUES
|
||||
(2,1), (1,3), (2,1), (4,4), (2,2), (1,4);
|
||||
|
||||
SELECT a FROM t1 ORDER BY (SELECT c FROM t2 WHERE b > 2 );
|
||||
--error 1242
|
||||
SELECT a FROM t1 ORDER BY (SELECT c FROM t2 WHERE b > 1);
|
||||
SELECT a FROM t1 ORDER BY (SELECT c FROM t2 WHERE b > 2), a;
|
||||
--error 1242
|
||||
--error 1242
|
||||
SELECT a FROM t1 ORDER BY (SELECT c FROM t2 WHERE b > 1);
|
||||
SELECT a FROM t1 ORDER BY (SELECT c FROM t2 WHERE b > 2), a;
|
||||
--error 1242
|
||||
SELECT a FROM t1 ORDER BY (SELECT c FROM t2 WHERE b > 1), a;
|
||||
|
||||
|
||||
SELECT b, MAX(c) FROM t2 GROUP BY b, (SELECT c FROM t2 WHERE b > 2);
|
||||
--error 1242
|
||||
SELECT b, MAX(c) FROM t2 GROUP BY b, (SELECT c FROM t2 WHERE b > 1);
|
||||
@ -2036,28 +2036,28 @@ SELECT a FROM t1 GROUP BY a
|
||||
SELECT a FROM t1 GROUP BY a
|
||||
HAVING IFNULL((SELECT b FROM t2 WHERE b > 4),
|
||||
(SELECT c FROM t2 WHERE c=a AND b > 2 ORDER BY b)) > 3;
|
||||
--error 1242
|
||||
--error 1242
|
||||
SELECT a FROM t1 GROUP BY a
|
||||
HAVING IFNULL((SELECT b FROM t2 WHERE b > 4),
|
||||
(SELECT c FROM t2 WHERE c=a AND b > 1 ORDER BY b)) > 3;
|
||||
|
||||
SELECT a FROM t1
|
||||
SELECT a FROM t1
|
||||
ORDER BY IFNULL((SELECT b FROM t2 WHERE b > 2),
|
||||
(SELECT c FROM t2 WHERE c=a AND b > 2 ORDER BY b));
|
||||
--error 1242
|
||||
SELECT a FROM t1
|
||||
SELECT a FROM t1
|
||||
ORDER BY IFNULL((SELECT b FROM t2 WHERE b > 1),
|
||||
(SELECT c FROM t2 WHERE c=a AND b > 1 ORDER BY b));
|
||||
|
||||
SELECT a FROM t1
|
||||
SELECT a FROM t1
|
||||
ORDER BY IFNULL((SELECT b FROM t2 WHERE b > 4),
|
||||
(SELECT c FROM t2 WHERE c=a AND b > 2 ORDER BY b));
|
||||
--error 1242
|
||||
SELECT a FROM t1
|
||||
SELECT a FROM t1
|
||||
ORDER BY IFNULL((SELECT b FROM t2 WHERE b > 4),
|
||||
(SELECT c FROM t2 WHERE c=a AND b > 1 ORDER BY b));
|
||||
|
||||
DROP TABLE t1,t2;
|
||||
DROP TABLE t1,t2;
|
||||
|
||||
# End of 4.1 tests
|
||||
|
||||
@ -2571,7 +2571,7 @@ DROP TABLE t1,t2;
|
||||
#
|
||||
# Bug #25219: EXIST subquery with UNION over a mix of
|
||||
# correlated and uncorrelated selects
|
||||
#
|
||||
#
|
||||
|
||||
CREATE TABLE t1 (id char(4) PRIMARY KEY, c int);
|
||||
CREATE TABLE t2 (c int);
|
||||
@ -2579,28 +2579,29 @@ CREATE TABLE t2 (c int);
|
||||
INSERT INTO t1 VALUES ('aa', 1);
|
||||
INSERT INTO t2 VALUES (1);
|
||||
|
||||
SELECT * FROM t1
|
||||
SELECT * FROM t1
|
||||
WHERE EXISTS (SELECT c FROM t2 WHERE c=1
|
||||
UNION
|
||||
UNION
|
||||
SELECT c from t2 WHERE c=t1.c);
|
||||
|
||||
INSERT INTO t1 VALUES ('bb', 2), ('cc', 3), ('dd',1);
|
||||
|
||||
SELECT * FROM t1
|
||||
SELECT * FROM t1
|
||||
WHERE EXISTS (SELECT c FROM t2 WHERE c=1
|
||||
UNION
|
||||
UNION
|
||||
SELECT c from t2 WHERE c=t1.c);
|
||||
|
||||
INSERT INTO t2 VALUES (2);
|
||||
CREATE TABLE t3 (c int);
|
||||
INSERT INTO t3 VALUES (1);
|
||||
|
||||
SELECT * FROM t1
|
||||
SELECT * FROM t1
|
||||
WHERE EXISTS (SELECT t2.c FROM t2 JOIN t3 ON t2.c=t3.c WHERE t2.c=1
|
||||
UNION
|
||||
UNION
|
||||
SELECT c from t2 WHERE c=t1.c);
|
||||
|
||||
DROP TABLE t1,t2,t3;
|
||||
DROP TABLE t1,t2,t3;
|
||||
|
||||
#
|
||||
# Bug#23800: Outer fields in correlated subqueries is used in a temporary
|
||||
# table created for sorting.
|
||||
@ -2628,3 +2629,103 @@ SELECT a, MAX(b),
|
||||
(SELECT t.c FROM t1 AS t WHERE t1.a=t.a AND t.b=MAX(t1.b)) AS test
|
||||
FROM t1 GROUP BY a;
|
||||
DROP TABLE t1;
|
||||
|
||||
#
|
||||
# Bug#21904 (parser problem when using IN with a double "(())")
|
||||
#
|
||||
|
||||
--disable_warnings
|
||||
DROP TABLE IF EXISTS t1;
|
||||
DROP TABLE IF EXISTS t2;
|
||||
DROP TABLE IF EXISTS t1xt2;
|
||||
--enable_warnings
|
||||
|
||||
CREATE TABLE t1 (
|
||||
id_1 int(5) NOT NULL,
|
||||
t varchar(4) DEFAULT NULL
|
||||
);
|
||||
|
||||
CREATE TABLE t2 (
|
||||
id_2 int(5) NOT NULL,
|
||||
t varchar(4) DEFAULT NULL
|
||||
);
|
||||
|
||||
CREATE TABLE t1xt2 (
|
||||
id_1 int(5) NOT NULL,
|
||||
id_2 int(5) NOT NULL
|
||||
);
|
||||
|
||||
INSERT INTO t1 VALUES (1, 'a'), (2, 'b'), (3, 'c'), (4, 'd');
|
||||
|
||||
INSERT INTO t2 VALUES (2, 'bb'), (3, 'cc'), (4, 'dd'), (12, 'aa');
|
||||
|
||||
INSERT INTO t1xt2 VALUES (2, 2), (3, 3), (4, 4);
|
||||
|
||||
# subselect returns 0 rows
|
||||
|
||||
SELECT DISTINCT t1.id_1 FROM t1 WHERE
|
||||
(12 IN (SELECT t1xt2.id_2 FROM t1xt2 WHERE t1.id_1 = t1xt2.id_1));
|
||||
|
||||
SELECT DISTINCT t1.id_1 FROM t1 WHERE
|
||||
(12 IN ((SELECT t1xt2.id_2 FROM t1xt2 WHERE t1.id_1 = t1xt2.id_1)));
|
||||
|
||||
SELECT DISTINCT t1.id_1 FROM t1 WHERE
|
||||
(12 IN (((SELECT t1xt2.id_2 FROM t1xt2 WHERE t1.id_1 = t1xt2.id_1))));
|
||||
|
||||
SELECT DISTINCT t1.id_1 FROM t1 WHERE
|
||||
(12 NOT IN (SELECT t1xt2.id_2 FROM t1xt2 WHERE t1.id_1 = t1xt2.id_1));
|
||||
|
||||
SELECT DISTINCT t1.id_1 FROM t1 WHERE
|
||||
(12 NOT IN ((SELECT t1xt2.id_2 FROM t1xt2 where t1.id_1 = t1xt2.id_1)));
|
||||
|
||||
SELECT DISTINCT t1.id_1 FROM t1 WHERE
|
||||
(12 NOT IN (((SELECT t1xt2.id_2 FROM t1xt2 where t1.id_1 = t1xt2.id_1))));
|
||||
|
||||
insert INTO t1xt2 VALUES (1, 12);
|
||||
|
||||
# subselect returns 1 row
|
||||
|
||||
SELECT DISTINCT t1.id_1 FROM t1 WHERE
|
||||
(12 IN (SELECT t1xt2.id_2 FROM t1xt2 WHERE t1.id_1 = t1xt2.id_1));
|
||||
|
||||
SELECT DISTINCT t1.id_1 FROM t1 WHERE
|
||||
(12 IN ((SELECT t1xt2.id_2 FROM t1xt2 WHERE t1.id_1 = t1xt2.id_1)));
|
||||
|
||||
SELECT DISTINCT t1.id_1 FROM t1 WHERE
|
||||
(12 IN (((SELECT t1xt2.id_2 FROM t1xt2 WHERE t1.id_1 = t1xt2.id_1))));
|
||||
|
||||
SELECT DISTINCT t1.id_1 FROM t1 WHERE
|
||||
(12 NOT IN (SELECT t1xt2.id_2 FROM t1xt2 WHERE t1.id_1 = t1xt2.id_1));
|
||||
|
||||
SELECT DISTINCT t1.id_1 FROM t1 WHERE
|
||||
(12 NOT IN ((SELECT t1xt2.id_2 FROM t1xt2 WHERE t1.id_1 = t1xt2.id_1)));
|
||||
|
||||
SELECT DISTINCT t1.id_1 FROM t1 WHERE
|
||||
(12 NOT IN (((SELECT t1xt2.id_2 FROM t1xt2 WHERE t1.id_1 = t1xt2.id_1))));
|
||||
|
||||
insert INTO t1xt2 VALUES (2, 12);
|
||||
|
||||
# subselect returns more than 1 row
|
||||
|
||||
SELECT DISTINCT t1.id_1 FROM t1 WHERE
|
||||
(12 IN (SELECT t1xt2.id_2 FROM t1xt2 WHERE t1.id_1 = t1xt2.id_1));
|
||||
|
||||
SELECT DISTINCT t1.id_1 FROM t1 WHERE
|
||||
(12 IN ((SELECT t1xt2.id_2 FROM t1xt2 WHERE t1.id_1 = t1xt2.id_1)));
|
||||
|
||||
SELECT DISTINCT t1.id_1 FROM t1 WHERE
|
||||
(12 IN (((SELECT t1xt2.id_2 FROM t1xt2 WHERE t1.id_1 = t1xt2.id_1))));
|
||||
|
||||
SELECT DISTINCT t1.id_1 FROM t1 WHERE
|
||||
(12 NOT IN (SELECT t1xt2.id_2 FROM t1xt2 WHERE t1.id_1 = t1xt2.id_1));
|
||||
|
||||
SELECT DISTINCT t1.id_1 FROM t1 WHERE
|
||||
(12 NOT IN ((SELECT t1xt2.id_2 FROM t1xt2 WHERE t1.id_1 = t1xt2.id_1)));
|
||||
|
||||
SELECT DISTINCT t1.id_1 FROM t1 WHERE
|
||||
(12 NOT IN (((SELECT t1xt2.id_2 FROM t1xt2 WHERE t1.id_1 = t1xt2.id_1))));
|
||||
|
||||
DROP TABLE t1;
|
||||
DROP TABLE t2;
|
||||
DROP TABLE t1xt2;
|
||||
|
||||
|
@ -1625,4 +1625,78 @@ SELECT fubar_id FROM t2;
|
||||
|
||||
DROP TABLE t1,t2;
|
||||
|
||||
#
|
||||
# Bug#21285 (Incorrect message error deleting records in a table with a
|
||||
# trigger for inserting)
|
||||
#
|
||||
|
||||
--disable_warnings
|
||||
DROP TABLE IF EXISTS bug21825_A;
|
||||
DROP TABLE IF EXISTS bug21825_B;
|
||||
--enable_warnings
|
||||
|
||||
CREATE TABLE bug21825_A (id int(10));
|
||||
CREATE TABLE bug21825_B (id int(10));
|
||||
|
||||
delimiter //;
|
||||
|
||||
CREATE TRIGGER trgA AFTER INSERT ON bug21825_A
|
||||
FOR EACH ROW
|
||||
BEGIN
|
||||
INSERT INTO bug21825_B (id) values (1);
|
||||
END//
|
||||
delimiter ;//
|
||||
|
||||
INSERT INTO bug21825_A (id) VALUES (10);
|
||||
INSERT INTO bug21825_A (id) VALUES (20);
|
||||
|
||||
DROP TABLE bug21825_B;
|
||||
|
||||
# Must pass, the missing table in the insert trigger should not matter.
|
||||
DELETE FROM bug21825_A WHERE id = 20;
|
||||
|
||||
DROP TABLE bug21825_A;
|
||||
|
||||
#
|
||||
# Bug#22580 (DROP TABLE in nested stored procedure causes strange dependancy
|
||||
# error)
|
||||
#
|
||||
|
||||
--disable_warnings
|
||||
DROP TABLE IF EXISTS bug22580_t1;
|
||||
DROP PROCEDURE IF EXISTS bug22580_proc_1;
|
||||
DROP PROCEDURE IF EXISTS bug22580_proc_2;
|
||||
--enable_warnings
|
||||
|
||||
CREATE TABLE bug22580_t1 (a INT, b INT);
|
||||
|
||||
DELIMITER ||;
|
||||
|
||||
CREATE PROCEDURE bug22580_proc_2()
|
||||
BEGIN
|
||||
DROP TABLE IF EXISTS bug22580_tmp;
|
||||
CREATE TEMPORARY TABLE bug22580_tmp (a INT);
|
||||
DROP TABLE bug22580_tmp;
|
||||
END||
|
||||
|
||||
CREATE PROCEDURE bug22580_proc_1()
|
||||
BEGIN
|
||||
CALL bug22580_proc_2();
|
||||
END||
|
||||
|
||||
CREATE TRIGGER t1bu BEFORE UPDATE ON bug22580_t1
|
||||
FOR EACH ROW
|
||||
BEGIN
|
||||
CALL bug22580_proc_1();
|
||||
END||
|
||||
|
||||
DELIMITER ;||
|
||||
|
||||
# Must pass, the actions of the update trigger should not matter
|
||||
INSERT INTO bug22580_t1 VALUES (1,1);
|
||||
|
||||
DROP TABLE bug22580_t1;
|
||||
DROP PROCEDURE bug22580_proc_1;
|
||||
DROP PROCEDURE bug22580_proc_2;
|
||||
|
||||
--echo End of 5.0 tests
|
||||
|
@ -748,12 +748,14 @@ drop view v1;
|
||||
#
|
||||
# VIEWs with national characters
|
||||
#
|
||||
create table t<> (c<> char);
|
||||
create view v<> as select c<> from t<>;
|
||||
insert into v<> values ('<27>');
|
||||
select * from v<>;
|
||||
drop view v<EFBFBD>;
|
||||
drop table t<>;
|
||||
set names utf8;
|
||||
create table tü (cü char);
|
||||
create view vü as select cü from tü;
|
||||
insert into vü values ('ü');
|
||||
select * from vü;
|
||||
drop view vü;
|
||||
drop table tü;
|
||||
set names latin1;
|
||||
|
||||
#
|
||||
# problem with used_tables() of outer reference resolved in VIEW
|
||||
@ -2991,7 +2993,7 @@ DROP VIEW v1;
|
||||
#
|
||||
|
||||
CREATE TABLE t1 (mydate DATETIME);
|
||||
INSERT INTO t1 VALUES
|
||||
INSERT INTO t1 VALUES
|
||||
('2007-01-01'), ('2007-01-02'), ('2007-01-30'), ('2007-01-31');
|
||||
|
||||
CREATE VIEW v1 AS SELECT mydate from t1;
|
||||
@ -3039,7 +3041,7 @@ drop view v1;
|
||||
drop table t1;
|
||||
|
||||
#
|
||||
# Bug#26209: queries with GROUP BY and ORDER BY using views
|
||||
# Bug#26209: queries with GROUP BY and ORDER BY using views
|
||||
#
|
||||
|
||||
CREATE TABLE t1 (
|
||||
@ -3058,4 +3060,107 @@ SELECT code, COUNT(DISTINCT country) FROM v1 GROUP BY code ORDER BY MAX(id);
|
||||
DROP VIEW v1;
|
||||
DROP TABLE t1;
|
||||
|
||||
#
|
||||
# BUG#25897: Some queries are no longer possible after a CREATE VIEW
|
||||
# fails
|
||||
#
|
||||
--disable_warnings
|
||||
DROP VIEW IF EXISTS v1;
|
||||
--enable_warnings
|
||||
|
||||
let $query = SELECT * FROM (SELECT 1) AS t;
|
||||
|
||||
eval $query;
|
||||
--error ER_VIEW_SELECT_DERIVED
|
||||
eval CREATE VIEW v1 AS $query;
|
||||
--echo # Previously the following would fail.
|
||||
eval $query;
|
||||
|
||||
#
|
||||
# Bug#24532: The return data type of IS TRUE is different from similar
|
||||
# operations
|
||||
#
|
||||
|
||||
--disable_warnings
|
||||
drop view if exists view_24532_a;
|
||||
drop view if exists view_24532_b;
|
||||
drop table if exists table_24532;
|
||||
--enable_warnings
|
||||
|
||||
create table table_24532 (
|
||||
a int,
|
||||
b bigint,
|
||||
c int(4),
|
||||
d bigint(48)
|
||||
);
|
||||
|
||||
create view view_24532_a as
|
||||
select
|
||||
a IS TRUE,
|
||||
a IS NOT TRUE,
|
||||
a IS FALSE,
|
||||
a IS NOT FALSE,
|
||||
a IS UNKNOWN,
|
||||
a IS NOT UNKNOWN,
|
||||
a is NULL,
|
||||
a IS NOT NULL,
|
||||
ISNULL(a),
|
||||
b IS TRUE,
|
||||
b IS NOT TRUE,
|
||||
b IS FALSE,
|
||||
b IS NOT FALSE,
|
||||
b IS UNKNOWN,
|
||||
b IS NOT UNKNOWN,
|
||||
b is NULL,
|
||||
b IS NOT NULL,
|
||||
ISNULL(b),
|
||||
c IS TRUE,
|
||||
c IS NOT TRUE,
|
||||
c IS FALSE,
|
||||
c IS NOT FALSE,
|
||||
c IS UNKNOWN,
|
||||
c IS NOT UNKNOWN,
|
||||
c is NULL,
|
||||
c IS NOT NULL,
|
||||
ISNULL(c),
|
||||
d IS TRUE,
|
||||
d IS NOT TRUE,
|
||||
d IS FALSE,
|
||||
d IS NOT FALSE,
|
||||
d IS UNKNOWN,
|
||||
d IS NOT UNKNOWN,
|
||||
d is NULL,
|
||||
d IS NOT NULL,
|
||||
ISNULL(d)
|
||||
from table_24532;
|
||||
|
||||
describe view_24532_a;
|
||||
|
||||
create view view_24532_b as
|
||||
select
|
||||
a IS TRUE,
|
||||
if(ifnull(a, 0), 1, 0) as old_istrue,
|
||||
a IS NOT TRUE,
|
||||
if(ifnull(a, 0), 0, 1) as old_isnottrue,
|
||||
a IS FALSE,
|
||||
if(ifnull(a, 1), 0, 1) as old_isfalse,
|
||||
a IS NOT FALSE,
|
||||
if(ifnull(a, 1), 1, 0) as old_isnotfalse
|
||||
from table_24532;
|
||||
|
||||
describe view_24532_b;
|
||||
|
||||
show create view view_24532_b;
|
||||
|
||||
insert into table_24532 values (0, 0, 0, 0);
|
||||
select * from view_24532_b;
|
||||
update table_24532 set a=1;
|
||||
select * from view_24532_b;
|
||||
update table_24532 set a=NULL;
|
||||
select * from view_24532_b;
|
||||
|
||||
drop view view_24532_a;
|
||||
drop view view_24532_b;
|
||||
drop table table_24532;
|
||||
|
||||
--echo End of 5.0 tests.
|
||||
|
@ -63,7 +63,7 @@ pid_path="$1"
|
||||
total_attempts="$2"
|
||||
event="$3"
|
||||
test_id="$4"
|
||||
log_file="$MYSQLTEST_VARDIR/log/$test_id.log"
|
||||
log_file="$MYSQLTEST_VARDIR/log/$test_id.script.log"
|
||||
|
||||
log_debug "-- $basename: starting --"
|
||||
log_debug "pid_path: '$pid_path'"
|
||||
|
@ -30,7 +30,7 @@ password="$4"
|
||||
db="$5"
|
||||
total_timeout="$6"
|
||||
test_id="$7"
|
||||
log_file="$MYSQLTEST_VARDIR/log/$test_id.log"
|
||||
log_file="$MYSQLTEST_VARDIR/log/$test_id.script.log"
|
||||
|
||||
log_debug "-- $basename: starting --"
|
||||
log_debug "client_exe: '$client_exe'"
|
||||
|
Reference in New Issue
Block a user