mirror of
https://github.com/MariaDB/server.git
synced 2025-08-01 03:47:19 +03:00
Merge bk-internal.mysql.com:/home/bk/mysql-5.0
into mishka.local:/home/my/mysql-5.0 sql/sql_select.cc: Auto merged
This commit is contained in:
@ -504,7 +504,7 @@ comment='Procedure privileges';
|
||||
|
||||
|
||||
CREATE TABLE proc (
|
||||
db char(64) binary DEFAULT '' NOT NULL,
|
||||
db char(64) collate utf8_bin DEFAULT '' NOT NULL,
|
||||
name char(64) DEFAULT '' NOT NULL,
|
||||
type enum('FUNCTION','PROCEDURE') NOT NULL,
|
||||
specific_name char(64) DEFAULT '' NOT NULL,
|
||||
@ -519,7 +519,7 @@ CREATE TABLE proc (
|
||||
param_list blob DEFAULT '' NOT NULL,
|
||||
returns char(64) DEFAULT '' NOT NULL,
|
||||
body blob DEFAULT '' NOT NULL,
|
||||
definer char(77) binary DEFAULT '' NOT NULL,
|
||||
definer char(77) collate utf8_bin DEFAULT '' NOT NULL,
|
||||
created timestamp,
|
||||
modified timestamp,
|
||||
sql_mode set(
|
||||
@ -554,6 +554,6 @@ CREATE TABLE proc (
|
||||
'NO_AUTO_CREATE_USER',
|
||||
'HIGH_NOT_PRECEDENCE'
|
||||
) DEFAULT '' NOT NULL,
|
||||
comment char(64) binary DEFAULT '' NOT NULL,
|
||||
comment char(64) collate utf8_bin DEFAULT '' NOT NULL,
|
||||
PRIMARY KEY (db,name,type)
|
||||
) comment='Stored Procedures';
|
||||
) character set utf8 comment='Stored Procedures';
|
||||
|
@ -164,3 +164,5 @@ root@localhost
|
||||
. - is longer then 80 characters and
|
||||
. - consists of several lines
|
||||
--------------------------------------------------------------------------------
|
||||
this will be executed
|
||||
this will be executed
|
||||
|
@ -530,6 +530,10 @@ select @@max_heap_table_size > 0;
|
||||
@@max_heap_table_size > 0
|
||||
1
|
||||
set global max_heap_table_size= 4294967296;
|
||||
select @@global.max_heap_table_size > 0;
|
||||
@@global.max_heap_table_size > 0
|
||||
select @@max_heap_table_size > 0;
|
||||
@@max_heap_table_size > 0
|
||||
1
|
||||
set @@max_heap_table_size= 4294967296;
|
||||
select @@max_heap_table_size > 0;
|
||||
@@max_heap_table_size > 0
|
||||
1
|
||||
|
@ -249,25 +249,27 @@ flush privileges;
|
||||
|
||||
# QQ This results in NULLs instead of the version numbers when
|
||||
# QQ a LOCK TABLES is in effect when selecting from
|
||||
# QQ information_schema.tables. Until this bug has been fixed,
|
||||
# QQ this test is disabled /pem
|
||||
#delimiter //;
|
||||
#create procedure px5 ()
|
||||
#begin
|
||||
#declare v int;
|
||||
#declare c cursor for select version from
|
||||
#information_schema.tables where table_schema <> 'information_schema';
|
||||
#open c;
|
||||
#fetch c into v;
|
||||
#select v;
|
||||
#close c;
|
||||
#end;//
|
||||
#
|
||||
#call px5()//
|
||||
#call px5()//
|
||||
#delimiter ;//
|
||||
#select sql_mode from information_schema.ROUTINES;
|
||||
#drop procedure px5;
|
||||
# QQ information_schema.tables.
|
||||
|
||||
--disable_parsing until bug is fixes
|
||||
delimiter //;
|
||||
create procedure px5 ()
|
||||
begin
|
||||
declare v int;
|
||||
declare c cursor for select version from
|
||||
information_schema.tables where table_schema <> 'information_schema';
|
||||
open c;
|
||||
fetch c into v;
|
||||
select v;
|
||||
close c;
|
||||
end;//
|
||||
|
||||
call px5()//
|
||||
call px5()//
|
||||
delimiter ;//
|
||||
select sql_mode from information_schema.ROUTINES;
|
||||
drop procedure px5;
|
||||
--enable_parsing
|
||||
|
||||
create table t1 (a int not null auto_increment,b int, primary key (a));
|
||||
insert into t1 values (1,1),(NULL,3),(NULL,4);
|
||||
|
@ -324,3 +324,14 @@ let $message= . Here comes a very very long message that
|
||||
. - consists of several lines;
|
||||
--source include/show_msg80.inc
|
||||
|
||||
#
|
||||
# Test --enable_parsning / disable_parsning
|
||||
#
|
||||
--disable_query_log
|
||||
--disable_parsing
|
||||
# The following will not enable query logging
|
||||
--enable_query_log
|
||||
select "this will not be executed";
|
||||
--enable_parsing
|
||||
select "this will be executed";
|
||||
--enable_query_log
|
||||
|
@ -1232,12 +1232,14 @@ begin
|
||||
end|
|
||||
select f5(1)|
|
||||
# This should generate an error about insuficient number of tables locked
|
||||
# Nuw this crash server, comented until bug#11394 fix
|
||||
#--error 1100
|
||||
#select f5(2)|
|
||||
# Now this crash server
|
||||
--disable_parsing until bug#11394 fix
|
||||
--error 1100
|
||||
select f5(2)|
|
||||
# But now it simply miserably fails because we are trying to use the same
|
||||
# lex on the next iteration :/ It should generate some error too...
|
||||
# select f5(3)|
|
||||
select f5(3)|
|
||||
--enable_parsing
|
||||
|
||||
# OTOH this should work
|
||||
create function f6() returns int
|
||||
@ -1285,9 +1287,11 @@ create function f1() returns int
|
||||
return (select sum(data) from t1) + (select sum(data) from v1)|
|
||||
# This queries will crash server because we can't use LEX in
|
||||
# reenterable fashion yet. Patch disabling recursion will heal this.
|
||||
#select f1()|
|
||||
#select * from v1|
|
||||
#select * from v2|
|
||||
--disable_parsing
|
||||
select f1()|
|
||||
select * from v1|
|
||||
select * from v2|
|
||||
--enable_parsing
|
||||
# Back to the normal cases
|
||||
drop function f1|
|
||||
create function f1() returns int
|
||||
@ -1499,54 +1503,55 @@ show procedure status like '%p%'|
|
||||
#
|
||||
# This part of test is disabled until we implement support for
|
||||
# recursive stored procedures.
|
||||
#--disable_warnings
|
||||
#drop table if exists fib|
|
||||
#--enable_warnings
|
||||
#create table fib ( f bigint unsigned not null )|
|
||||
#
|
||||
## We deliberately do it the awkward way, fetching the last two
|
||||
## values from the table, in order to exercise various statements
|
||||
## and table accesses at each turn.
|
||||
#--disable_warnings
|
||||
#drop procedure if exists fib|
|
||||
#--enable_warnings
|
||||
#create procedure fib(n int unsigned)
|
||||
#begin
|
||||
# if n > 1 then
|
||||
# begin
|
||||
# declare x, y bigint unsigned;
|
||||
# declare c cursor for select f from fib order by f desc limit 2;
|
||||
#
|
||||
# open c;
|
||||
# fetch c into y;
|
||||
# fetch c into x;
|
||||
# close c;
|
||||
# insert into fib values (x+y);
|
||||
# call fib(n-1);
|
||||
# end;
|
||||
# end if;
|
||||
#end|
|
||||
#
|
||||
## Minimum test: recursion of 3 levels
|
||||
#
|
||||
#insert into fib values (0), (1)|
|
||||
#
|
||||
#call fib(3)|
|
||||
#
|
||||
#select * from fib order by f asc|
|
||||
#
|
||||
#delete from fib|
|
||||
#
|
||||
## Original test: 20 levels (may run into memory limits!)
|
||||
#
|
||||
#insert into fib values (0), (1)|
|
||||
#
|
||||
#call fib(20)|
|
||||
#
|
||||
#select * from fib order by f asc|
|
||||
#drop table fib|
|
||||
#drop procedure fib|
|
||||
--disable_parsing
|
||||
--disable_warnings
|
||||
drop table if exists fib|
|
||||
--enable_warnings
|
||||
create table fib ( f bigint unsigned not null )|
|
||||
|
||||
# We deliberately do it the awkward way, fetching the last two
|
||||
# values from the table, in order to exercise various statements
|
||||
# and table accesses at each turn.
|
||||
--disable_warnings
|
||||
drop procedure if exists fib|
|
||||
--enable_warnings
|
||||
create procedure fib(n int unsigned)
|
||||
begin
|
||||
if n > 1 then
|
||||
begin
|
||||
declare x, y bigint unsigned;
|
||||
declare c cursor for select f from fib order by f desc limit 2;
|
||||
|
||||
open c;
|
||||
fetch c into y;
|
||||
fetch c into x;
|
||||
close c;
|
||||
insert into fib values (x+y);
|
||||
call fib(n-1);
|
||||
end;
|
||||
end if;
|
||||
end|
|
||||
|
||||
# Minimum test: recursion of 3 levels
|
||||
|
||||
insert into fib values (0), (1)|
|
||||
|
||||
call fib(3)|
|
||||
|
||||
select * from fib order by f asc|
|
||||
|
||||
delete from fib|
|
||||
|
||||
# Original test: 20 levels (may run into memory limits!)
|
||||
|
||||
insert into fib values (0), (1)|
|
||||
|
||||
call fib(20)|
|
||||
|
||||
select * from fib order by f asc|
|
||||
drop table fib|
|
||||
drop procedure fib|
|
||||
--enable_parsing
|
||||
|
||||
#
|
||||
# Comment & suid
|
||||
@ -1830,49 +1835,51 @@ drop procedure bug2260|
|
||||
# FIXME: Other solution would be to use preopened proc table
|
||||
# instead of opening it anew.
|
||||
#
|
||||
#--disable_warnings
|
||||
#drop procedure if exists bug2267_1|
|
||||
#--enable_warnings
|
||||
#create procedure bug2267_1()
|
||||
#begin
|
||||
# show procedure status;
|
||||
#end|
|
||||
#
|
||||
#--disable_warnings
|
||||
#drop procedure if exists bug2267_2|
|
||||
#--enable_warnings
|
||||
#create procedure bug2267_2()
|
||||
#begin
|
||||
# show function status;
|
||||
#end|
|
||||
#
|
||||
#--disable_warnings
|
||||
#drop procedure if exists bug2267_3|
|
||||
#--enable_warnings
|
||||
#create procedure bug2267_3()
|
||||
#begin
|
||||
# show create procedure bug2267_1;
|
||||
#end|
|
||||
#
|
||||
#--disable_warnings
|
||||
#drop procedure if exists bug2267_4|
|
||||
#--enable_warnings
|
||||
#create procedure bug2267_4()
|
||||
#begin
|
||||
# show create function fac;
|
||||
#end|
|
||||
#
|
||||
#--replace_column 5 '0000-00-00 00:00:00' 6 '0000-00-00 00:00:00'
|
||||
#call bug2267_1()|
|
||||
#--replace_column 5 '0000-00-00 00:00:00' 6 '0000-00-00 00:00:00'
|
||||
#call bug2267_2()|
|
||||
#call bug2267_3()|
|
||||
#call bug2267_4()|
|
||||
#
|
||||
#drop procedure bug2267_1|
|
||||
#drop procedure bug2267_2|
|
||||
#drop procedure bug2267_3|
|
||||
#drop procedure bug2267_4|
|
||||
--disable_parsing
|
||||
--disable_warnings
|
||||
drop procedure if exists bug2267_1|
|
||||
--enable_warnings
|
||||
create procedure bug2267_1()
|
||||
begin
|
||||
show procedure status;
|
||||
end|
|
||||
|
||||
--disable_warnings
|
||||
drop procedure if exists bug2267_2|
|
||||
--enable_warnings
|
||||
create procedure bug2267_2()
|
||||
begin
|
||||
show function status;
|
||||
end|
|
||||
|
||||
--disable_warnings
|
||||
drop procedure if exists bug2267_3|
|
||||
--enable_warnings
|
||||
create procedure bug2267_3()
|
||||
begin
|
||||
show create procedure bug2267_1;
|
||||
end|
|
||||
|
||||
--disable_warnings
|
||||
drop procedure if exists bug2267_4|
|
||||
--enable_warnings
|
||||
create procedure bug2267_4()
|
||||
begin
|
||||
show create function fac;
|
||||
end|
|
||||
|
||||
--replace_column 5 '0000-00-00 00:00:00' 6 '0000-00-00 00:00:00'
|
||||
call bug2267_1()|
|
||||
--replace_column 5 '0000-00-00 00:00:00' 6 '0000-00-00 00:00:00'
|
||||
call bug2267_2()|
|
||||
call bug2267_3()|
|
||||
call bug2267_4()|
|
||||
|
||||
drop procedure bug2267_1|
|
||||
drop procedure bug2267_2|
|
||||
drop procedure bug2267_3|
|
||||
drop procedure bug2267_4|
|
||||
--enable_parsing
|
||||
|
||||
#
|
||||
# BUG#2227
|
||||
@ -1901,23 +1908,25 @@ drop procedure bug2227|
|
||||
# QQ For this reason we can't run this test any more (i.e., if we modify
|
||||
# QQ it, it's no longer a test case for the bug), but we keep it here
|
||||
# QQ anyway, for tracability.
|
||||
#--disable_warnings
|
||||
#drop procedure if exists bug2614|
|
||||
#--enable_warnings
|
||||
#create procedure bug2614()
|
||||
#begin
|
||||
# drop temporary table if exists t3;
|
||||
# create temporary table t3 (id int default '0' not null);
|
||||
# insert into t3 select 12;
|
||||
# insert into t3 select * from t3;
|
||||
#end|
|
||||
#
|
||||
#--disable_warnings
|
||||
#call bug2614()|
|
||||
#--enable_warnings
|
||||
#call bug2614()|
|
||||
#drop temporary table t3|
|
||||
#drop procedure bug2614|
|
||||
--disable_parsing
|
||||
--disable_warnings
|
||||
drop procedure if exists bug2614|
|
||||
--enable_warnings
|
||||
create procedure bug2614()
|
||||
begin
|
||||
drop temporary table if exists t3;
|
||||
create temporary table t3 (id int default '0' not null);
|
||||
insert into t3 select 12;
|
||||
insert into t3 select * from t3;
|
||||
end|
|
||||
|
||||
--disable_warnings
|
||||
call bug2614()|
|
||||
--enable_warnings
|
||||
call bug2614()|
|
||||
drop temporary table t3|
|
||||
drop procedure bug2614|
|
||||
--enable_parsing
|
||||
|
||||
#
|
||||
# BUG#2674
|
||||
@ -2508,27 +2517,29 @@ drop table t3|
|
||||
# BUG#4318
|
||||
#
|
||||
#QQ Don't know if HANDLER commands can work with SPs, or at all...
|
||||
#--disable_warnings
|
||||
#drop table if exists t3|
|
||||
#--enable_warnings
|
||||
#
|
||||
#create table t3 (s1 int)|
|
||||
#insert into t3 values (3), (4)|
|
||||
#
|
||||
#--disable_warnings
|
||||
#drop procedure if exists bug4318|
|
||||
#--enable_warnings
|
||||
#create procedure bug4318()
|
||||
# handler t3 read next|
|
||||
#
|
||||
#handler t3 open|
|
||||
## Expect no results, as tables are closed, but there shouldn't be any errors
|
||||
#call bug4318()|
|
||||
#call bug4318()|
|
||||
#handler t3 close|
|
||||
#
|
||||
#drop procedure bug4318|
|
||||
#drop table t3|
|
||||
--disable_parsing
|
||||
--disable_warnings
|
||||
drop table if exists t3|
|
||||
--enable_warnings
|
||||
|
||||
create table t3 (s1 int)|
|
||||
insert into t3 values (3), (4)|
|
||||
|
||||
--disable_warnings
|
||||
drop procedure if exists bug4318|
|
||||
--enable_warnings
|
||||
create procedure bug4318()
|
||||
handler t3 read next|
|
||||
|
||||
handler t3 open|
|
||||
# Expect no results, as tables are closed, but there shouldn't be any errors
|
||||
call bug4318()|
|
||||
call bug4318()|
|
||||
handler t3 close|
|
||||
|
||||
drop procedure bug4318|
|
||||
drop table t3|
|
||||
--enable_parsing
|
||||
|
||||
#
|
||||
# BUG#4902: Stored procedure with SHOW WARNINGS leads to packet error
|
||||
@ -2563,11 +2574,13 @@ begin
|
||||
show variables like 'foo';
|
||||
show warnings;
|
||||
end|
|
||||
#show binlog events;
|
||||
#show storage engines;
|
||||
#show master status;
|
||||
#show slave hosts;
|
||||
#show slave status;
|
||||
--disable_parsing
|
||||
show binlog events;
|
||||
show storage engines;
|
||||
show master status;
|
||||
show slave hosts;
|
||||
show slave status;
|
||||
--enable_parsing
|
||||
|
||||
call bug4902()|
|
||||
call bug4902()|
|
||||
@ -3912,7 +3925,6 @@ drop table t3|
|
||||
#--enable_warnings
|
||||
#create procedure bugNNNN...
|
||||
|
||||
|
||||
# Add bugs above this line. Use existing tables t1 and t2 when
|
||||
# practical, or create table t3, t4 etc temporarily (and drop them).
|
||||
delimiter ;|
|
||||
|
@ -415,4 +415,6 @@ set @@global.error_count=1;
|
||||
set @@max_heap_table_size= 4294967296;
|
||||
select @@max_heap_table_size > 0;
|
||||
set global max_heap_table_size= 4294967296;
|
||||
select @@global.max_heap_table_size > 0;
|
||||
select @@max_heap_table_size > 0;
|
||||
set @@max_heap_table_size= 4294967296;
|
||||
select @@max_heap_table_size > 0;
|
||||
|
@ -147,10 +147,11 @@ insert into t1 values (1), (2), (3);
|
||||
create view v1 (a) as select a+1 from t1;
|
||||
create view v2 (a) as select a-1 from t1;
|
||||
|
||||
# WL #2486 should enable these tests
|
||||
#select * from t1 natural left join v1;
|
||||
#select * from v2 natural left join t1;
|
||||
#select * from v2 natural left join v1;
|
||||
--disable_parsing WL #2486 should enable these tests
|
||||
select * from t1 natural left join v1;
|
||||
select * from v2 natural left join t1;
|
||||
select * from v2 natural left join v1;
|
||||
--enable_parsing
|
||||
|
||||
drop view v1, v2;
|
||||
drop table t1;
|
||||
|
Reference in New Issue
Block a user