1
0
mirror of https://github.com/MariaDB/server.git synced 2025-07-29 05:21:33 +03:00

Merge rurik.mysql.com:/home/igor/mysql-5.0

into rurik.mysql.com:/home/igor/dev/mysql-5.0-0


BitKeeper/etc/ignore:
  auto-union
sql/item.cc:
  Auto merged
sql/item.h:
  Auto merged
This commit is contained in:
unknown
2003-12-08 11:26:34 -08:00
79 changed files with 1220 additions and 589 deletions

View File

@ -201,17 +201,16 @@ t1 CREATE TABLE `t1` (
) TYPE=HEAP DEFAULT CHARSET=latin1
drop table t1;
SET SESSION table_type="gemini";
ERROR 42000: Unknown table engine 'gemini'
SELECT @@table_type;
@@table_type
GEMINI
HEAP
CREATE TABLE t1 (a int not null);
Warnings:
Warning 1265 Using storage engine MYISAM for table 't1'
show create table t1;
Table Create Table
t1 CREATE TABLE `t1` (
`a` int(11) NOT NULL default '0'
) TYPE=MyISAM DEFAULT CHARSET=latin1
) TYPE=HEAP DEFAULT CHARSET=latin1
SET SESSION table_type=default;
drop table t1;
create table t1 ( k1 varchar(2), k2 int, primary key(k1,k2));
@ -347,17 +346,16 @@ t1 CREATE TABLE `t1` (
) TYPE=HEAP DEFAULT CHARSET=latin1
drop table t1;
SET SESSION table_type="gemini";
ERROR 42000: Unknown table engine 'gemini'
SELECT @@table_type;
@@table_type
GEMINI
HEAP
CREATE TABLE t1 (a int not null);
Warnings:
Warning 1265 Using storage engine MYISAM for table 't1'
show create table t1;
Table Create Table
t1 CREATE TABLE `t1` (
`a` int(11) NOT NULL default '0'
) TYPE=MyISAM DEFAULT CHARSET=latin1
) TYPE=HEAP DEFAULT CHARSET=latin1
SET SESSION table_type=default;
drop table t1;
create table t1(a int,b int,c int unsigned,d date,e char,f datetime,g time,h blob);

View File

@ -2,6 +2,6 @@ show variables like "ft\_%";
Variable_name Value
ft_boolean_syntax + -><()~*:""&|
ft_min_word_len 4
ft_max_word_len 254
ft_max_word_len 84
ft_query_expansion_limit 20
ft_stopword_file (built-in)

View File

@ -188,13 +188,14 @@ ttt qqq
NULL NULL
NULL NULL
2001-01-01 02:02:02 26:02:02
SELECT TIMEDIFF(t1,t4) As ttt, TIMEDIFF(t2, t3) As qqq from test;
ttt qqq
-744:00:00 NULL
26305:01:02 22:58:58
-26305:01:02 -22:58:58
NULL 26:02:02
NULL NULL
NULL NULL
00:00:00 -24:00:00
SELECT TIMEDIFF(t1, t4) As ttt, TIMEDIFF(t2, t3) As qqq,
TIMEDIFF(t3, t2) As eee, TIMEDIFF(t2, t4) As rrr from test;
ttt qqq eee rrr
-744:00:00 NULL NULL NULL
26305:01:02 22:58:58 -22:58:58 NULL
-26305:01:02 -22:58:58 22:58:58 NULL
NULL 26:02:02 26:02:02 NULL
NULL NULL NULL NULL
NULL NULL NULL NULL
00:00:00 -24:00:00 24:00:00 NULL
drop table t1, test;

View File

@ -464,6 +464,63 @@ date_add(date,INTERVAL "1 1:1" DAY_MINUTE)
select date_add(date,INTERVAL "1 1:1:1" DAY_SECOND) from t1;
date_add(date,INTERVAL "1 1:1:1" DAY_SECOND)
2003-01-03 01:01:01
select date_add(date,INTERVAL "1" WEEK) from t1;
date_add(date,INTERVAL "1" WEEK)
2003-01-09 00:00:00
select date_add(date,INTERVAL "1" QUARTER) from t1;
date_add(date,INTERVAL "1" QUARTER)
2003-04-02
select timestampadd(MINUTE, 1, date) from t1;
timestampadd(MINUTE, 1, date)
2003-01-02 00:01:00
select timestampadd(WEEK, 1, date) from t1;
timestampadd(WEEK, 1, date)
2003-01-09 00:00:00
select timestampadd(SQL_TSI_SECOND, 1, date) from t1;
timestampadd(SQL_TSI_SECOND, 1, date)
2003-01-02 00:00:01
select timestampadd(SQL_TSI_FRAC_SECOND, 1, date) from t1;
timestampadd(SQL_TSI_FRAC_SECOND, 1, date)
2003-01-02 00:00:00.000001
select timestampdiff(MONTH, '2001-02-01', '2001-05-01') as a;
a
3
select timestampdiff(YEAR, '2002-05-01', '2001-01-01') as a;
a
-1
select timestampdiff(QUARTER, '2002-05-01', '2001-01-01') as a;
a
-5
select timestampdiff(MONTH, '2000-03-28', '2000-02-29') as a;
a
0
select timestampdiff(MONTH, '1991-03-28', '2000-02-29') as a;
a
107
select timestampdiff(SQL_TSI_WEEK, '2001-02-01', '2001-05-01') as a;
a
12
select timestampdiff(SQL_TSI_HOUR, '2001-02-01', '2001-05-01') as a;
a
2136
select timestampdiff(SQL_TSI_DAY, '2001-02-01', '2001-05-01') as a;
a
89
select timestampdiff(SQL_TSI_MINUTE, '2001-02-01 12:59:59', '2001-05-01 12:58:59') as a;
a
128159
select timestampdiff(SQL_TSI_SECOND, '2001-02-01 12:59:59', '2001-05-01 12:58:58') as a;
a
7689539
select timestampdiff(SQL_TSI_FRAC_SECOND, '2001-02-01 12:59:59.120000', '2001-05-01 12:58:58.119999') as a;
a
7689538999999
select timestampdiff(SQL_TSI_DAY, '1986-02-01', '1986-03-01') as a1,
timestampdiff(SQL_TSI_DAY, '1900-02-01', '1900-03-01') as a2,
timestampdiff(SQL_TSI_DAY, '1996-02-01', '1996-03-01') as a3,
timestampdiff(SQL_TSI_DAY, '2000-02-01', '2000-03-01') as a4;
a1 a2 a3 a4
28 28 29 29
select date_add(time,INTERVAL 1 SECOND) from t1;
date_add(time,INTERVAL 1 SECOND)
2006-07-08 00:00:01
@ -508,3 +565,9 @@ id select_type table type possible_keys key key_len ref rows Extra
1 SIMPLE NULL NULL NULL NULL NULL NULL NULL No tables used
Warnings:
Note 1003 select high_priority no_cache period_add(_latin1'9602',-(12)) AS `period_add("9602",-12)`,period_diff(199505,_latin1'9404') AS `period_diff(199505,"9404")`,from_days(to_days(_latin1'960101')) AS `from_days(to_days("960101"))`,dayofmonth(_latin1'1997-01-02') AS `dayofmonth("1997-01-02")`,month(_latin1'1997-01-02') AS `month("1997-01-02")`,monthname(_latin1'1972-03-04') AS `monthname("1972-03-04")`,dayofyear(_latin1'0000-00-00') AS `dayofyear("0000-00-00")`,hour(_latin1'1997-03-03 23:03:22') AS `HOUR("1997-03-03 23:03:22")`,minute(_latin1'23:03:22') AS `MINUTE("23:03:22")`,second(230322) AS `SECOND(230322)`,quarter(980303) AS `QUARTER(980303)`,week(_latin1'1998-03-03',0) AS `WEEK("1998-03-03")`,yearweek(_latin1'2000-01-01',1) AS `yearweek("2000-01-01",1)`,week(19950101,1) AS `week(19950101,1)`,year(_latin1'98-02-03') AS `year("98-02-03")`,(weekday(to_days(curdate())) - weekday(to_days(now()))) AS `weekday(curdate())-weekday(now())`,dayname(to_days(_latin1'1962-03-03')) AS `dayname("1962-03-03")`,unix_timestamp() AS `unix_timestamp()`,sec_to_time((time_to_sec(_latin1'0:30:47') / 6.21)) AS `sec_to_time(time_to_sec("0:30:47")/6.21)`,curtime() AS `curtime()`,utc_time() AS `utc_time()`,curdate() AS `curdate()`,utc_date() AS `utc_date()`,utc_timestamp() AS `utc_timestamp()`,date_format(_latin1'1997-01-02 03:04:05',_latin1'%M %W %D %Y %y %m %d %h %i %s %w') AS `date_format("1997-01-02 03:04:05", "%M %W %D %Y %y %m %d %h %i %s %w")`,from_unixtime(unix_timestamp(_latin1'1994-03-02 10:11:12')) AS `from_unixtime(unix_timestamp("1994-03-02 10:11:12"))`,(_latin1'1997-12-31 23:59:59' + interval 1 second) AS `"1997-12-31 23:59:59" + INTERVAL 1 SECOND`,(_latin1'1998-01-01 00:00:00' - interval 1 second) AS `"1998-01-01 00:00:00" - INTERVAL 1 SECOND`,(_latin1'1997-12-31' + interval 1 day) AS `INTERVAL 1 DAY + "1997-12-31"`,extract(year from _latin1'1999-01-02 10:11:12') AS `extract(YEAR FROM "1999-01-02 10:11:12")`,(_latin1'1997-12-31 23:59:59' + interval 1 second) AS `date_add("1997-12-31 23:59:59",INTERVAL 1 SECOND)`
explain extended select timestampdiff(SQL_TSI_WEEK, '2001-02-01', '2001-05-01') as a1,
timestampdiff(SQL_TSI_FRAC_SECOND, '2001-02-01 12:59:59.120000', '2001-05-01 12:58:58.119999') as a2;
id select_type table type possible_keys key key_len ref rows Extra
1 SIMPLE NULL NULL NULL NULL NULL NULL NULL No tables used
Warnings:
Note 1003 select high_priority timestamp_diff(WEEK,_latin1'2001-02-01',_latin1'2001-05-01') AS `a1`,timestamp_diff(SECOND_FRAC,_latin1'2001-02-01 12:59:59.120000',_latin1'2001-05-01 12:58:58.119999') AS `a2`

View File

@ -1,12 +1,14 @@
drop table if exists t1;
create table t1 (time time, date date, timestamp timestamp);
insert into t1 values ("12:22:22","97:02:03","1997-01-02");
create table t1 (time time, date date, timestamp timestamp,
quarter int, week int, year int, timestampadd int, timestampdiff int);
insert into t1 values ("12:22:22","97:02:03","1997-01-02",1,2,3,4,5);
select * from t1;
time date timestamp
12:22:22 1997-02-03 1997-01-02 00:00:00
select t1.time+0,t1.date+0,t1.timestamp+0,concat(date," ",time) from t1;
t1.time+0 t1.date+0 t1.timestamp+0 concat(date," ",time)
122222 19970203 19970102000000 1997-02-03 12:22:22
time date timestamp quarter week year timestampadd timestampdiff
12:22:22 1997-02-03 1997-01-02 00:00:00 1 2 3 4 5
select t1.time+0,t1.date+0,t1.timestamp+0,concat(date," ",time),
t1.quarter+t1.week, t1.year+timestampadd, timestampdiff from t1;
t1.time+0 t1.date+0 t1.timestamp+0 concat(date," ",time) t1.quarter+t1.week t1.year+timestampadd timestampdiff
122222 19970203 19970102000000 1997-02-03 12:22:22 3 7 5
drop table t1;
create table events(binlog int);
insert into events values(1);

View File

@ -35,7 +35,7 @@ call foo();
ERROR 42000: PROCEDURE foo does not exist
drop procedure if exists foo;
Warnings:
Warning 1287 PROCEDURE foo does not exist
Warning 1288 PROCEDURE foo does not exist
show create procedure foo;
ERROR 42000: PROCEDURE foo does not exist
create procedure foo()
@ -71,7 +71,7 @@ declare y int;
set x = y;
end;
Warnings:
Warning 1293 Referring to uninitialized variable y
Warning 1294 Referring to uninitialized variable y
drop procedure foo;
create procedure foo()
begin
@ -270,4 +270,14 @@ ERROR 42S22: Unknown column 'valname' in 'order clause'
drop procedure bug1965;
select 1 into a;
ERROR 42000: Undeclared variable: a
create procedure bug336(id char(16))
begin
declare x int;
set x = (select sum(t.data) from test.t2 t);
end;
ERROR 0A000: Subselect value not supported
create function bug1654()
returns int
return (select sum(t.data) from test.t2 t);
ERROR 0A000: Statements like SELECT, INSERT, UPDATE (and others) are not allowed in a FUNCTION
drop table t1;

View File

@ -801,6 +801,17 @@ avg 0 4.4
delete from t1;
delete from t2;
drop procedure bug1874;
drop table if exists table_1;
create table t3 (column_1_0 int);
create procedure bug1653()
update t3 set column_1 = 0;
call bug1653();
ERROR 42S22: Unknown column 'column_1' in 'field list'
drop table t3;
create table t3 (column_1 int);
call bug1653();
drop procedure bug1653;
drop table t3;
drop table if exists fac;
create table fac (n int unsigned not null primary key, f bigint unsigned);
create procedure ifac(n int unsigned)
@ -948,6 +959,51 @@ drop procedure opp;
drop procedure ip;
show procedure status like '%p%';
Name Type Creator Modified Created Suid Comment
drop table if exists fib;
create table fib ( f bigint unsigned not null );
insert into fib values (1), (1);
create procedure fib(n int unsigned)
begin
if n > 0 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;
call fib(20);
select * from fib order by f asc;
f
1
1
2
3
5
8
13
21
34
55
89
144
233
377
610
987
1597
2584
4181
6765
10946
17711
drop table fib;
drop procedure fib;
create procedure bar(x char(16), y int)
comment "111111111111" sql security invoker
insert into test.t1 values (x, y);

View File

@ -143,7 +143,7 @@ Variable_name Value
table_type HEAP
show global variables like 'table_type';
Variable_name Value
table_type INNODB
table_type InnoDB
set GLOBAL query_cache_size=100000;
set GLOBAL myisam_max_sort_file_size=2000000;
show global variables like 'myisam_max_sort_file_size';
@ -241,7 +241,7 @@ ERROR HY000: Unknown system variable 'unknown_variable'
set max_join_size="hello";
ERROR 42000: Wrong argument type to variable 'max_join_size'
set table_type=UNKNOWN_TABLE_TYPE;
ERROR 42000: Variable 'table_type' can't be set to the value of 'UNKNOWN_TABLE_TYPE'
ERROR 42000: Unknown table engine 'UNKNOWN_TABLE_TYPE'
set table_type=INNODB, big_tables=2;
ERROR 42000: Variable 'big_tables' can't be set to the value of '2'
show local variables like 'table_type';
@ -360,7 +360,7 @@ set sql_log_bin=1;
set sql_log_off=1;
set sql_log_update=1;
Warnings:
Note 1297 The update log is deprecated and replaced by the binary log. SET SQL_LOG_UPDATE has been ignored.
Note 1298 The update log is deprecated and replaced by the binary log. SET SQL_LOG_UPDATE has been ignored.
set sql_low_priority_updates=1;
set sql_max_join_size=200;
select @@sql_max_join_size,@@max_join_size;

View File

@ -121,8 +121,8 @@ select @@warning_count;
drop table t1;
create table t1 (id int) type=isam;
Warnings:
Warning 1265 Using storage engine MYISAM for table 't1'
Warning 1265 Using storage engine MyISAM for table 't1'
alter table t1 type=isam;
Warnings:
Warning 1265 Using storage engine MYISAM for table 't1'
Warning 1265 Using storage engine MyISAM for table 't1'
drop table t1;

View File

@ -157,7 +157,7 @@ SELECT @@table_type;
CREATE TABLE t1 (a int not null);
show create table t1;
drop table t1;
# Test what happens when using a non existing table type
--error 1285
SET SESSION table_type="gemini";
SELECT @@table_type;
CREATE TABLE t1 (a int not null);
@ -277,7 +277,7 @@ SELECT @@table_type;
CREATE TABLE t1 (a int not null);
show create table t1;
drop table t1;
# Test what happens when using a non existing table type
--error 1285
SET SESSION table_type="gemini";
SELECT @@table_type;
CREATE TABLE t1 (a int not null);

View File

@ -94,6 +94,7 @@ insert into test values
('2001-01-01 01:01:01', '01:01:01', '1 01:01:01', '2001-01-01 01:01:01');
SELECT ADDTIME(t1,t2) As ttt, ADDTIME(t2, t3) As qqq from test;
SELECT TIMEDIFF(t1,t4) As ttt, TIMEDIFF(t2, t3) As qqq from test;
SELECT TIMEDIFF(t1, t4) As ttt, TIMEDIFF(t2, t3) As qqq,
TIMEDIFF(t3, t2) As eee, TIMEDIFF(t2, t4) As rrr from test;
drop table t1, test;

View File

@ -220,6 +220,30 @@ select date_add(date,INTERVAL "1:1:1" HOUR_SECOND) from t1;
select date_add(date,INTERVAL "1 1:1" DAY_MINUTE) from t1;
select date_add(date,INTERVAL "1 1:1:1" DAY_SECOND) from t1;
select date_add(date,INTERVAL "1" WEEK) from t1;
select date_add(date,INTERVAL "1" QUARTER) from t1;
select timestampadd(MINUTE, 1, date) from t1;
select timestampadd(WEEK, 1, date) from t1;
select timestampadd(SQL_TSI_SECOND, 1, date) from t1;
select timestampadd(SQL_TSI_FRAC_SECOND, 1, date) from t1;
select timestampdiff(MONTH, '2001-02-01', '2001-05-01') as a;
select timestampdiff(YEAR, '2002-05-01', '2001-01-01') as a;
select timestampdiff(QUARTER, '2002-05-01', '2001-01-01') as a;
select timestampdiff(MONTH, '2000-03-28', '2000-02-29') as a;
select timestampdiff(MONTH, '1991-03-28', '2000-02-29') as a;
select timestampdiff(SQL_TSI_WEEK, '2001-02-01', '2001-05-01') as a;
select timestampdiff(SQL_TSI_HOUR, '2001-02-01', '2001-05-01') as a;
select timestampdiff(SQL_TSI_DAY, '2001-02-01', '2001-05-01') as a;
select timestampdiff(SQL_TSI_MINUTE, '2001-02-01 12:59:59', '2001-05-01 12:58:59') as a;
select timestampdiff(SQL_TSI_SECOND, '2001-02-01 12:59:59', '2001-05-01 12:58:58') as a;
select timestampdiff(SQL_TSI_FRAC_SECOND, '2001-02-01 12:59:59.120000', '2001-05-01 12:58:58.119999') as a;
select timestampdiff(SQL_TSI_DAY, '1986-02-01', '1986-03-01') as a1,
timestampdiff(SQL_TSI_DAY, '1900-02-01', '1900-03-01') as a2,
timestampdiff(SQL_TSI_DAY, '1996-02-01', '1996-03-01') as a3,
timestampdiff(SQL_TSI_DAY, '2000-02-01', '2000-03-01') as a4;
# The following is not as one would expect...
select date_add(time,INTERVAL 1 SECOND) from t1;
drop table t1;
@ -247,3 +271,6 @@ select strcmp(date_format(utc_timestamp(),"%Y-%m-%d"), utc_date())=0;
select strcmp(concat(utc_date(),' ',utc_time()),utc_timestamp())=0;
explain extended select period_add("9602",-12),period_diff(199505,"9404"),from_days(to_days("960101")),dayofmonth("1997-01-02"), month("1997-01-02"), monthname("1972-03-04"),dayofyear("0000-00-00"),HOUR("1997-03-03 23:03:22"),MINUTE("23:03:22"),SECOND(230322),QUARTER(980303),WEEK("1998-03-03"),yearweek("2000-01-01",1),week(19950101,1),year("98-02-03"),weekday(curdate())-weekday(now()),dayname("1962-03-03"),unix_timestamp(),sec_to_time(time_to_sec("0:30:47")/6.21),curtime(),utc_time(),curdate(),utc_date(),utc_timestamp(),date_format("1997-01-02 03:04:05", "%M %W %D %Y %y %m %d %h %i %s %w"),from_unixtime(unix_timestamp("1994-03-02 10:11:12")),"1997-12-31 23:59:59" + INTERVAL 1 SECOND,"1998-01-01 00:00:00" - INTERVAL 1 SECOND,INTERVAL 1 DAY + "1997-12-31", extract(YEAR FROM "1999-01-02 10:11:12"),date_add("1997-12-31 23:59:59",INTERVAL 1 SECOND);
explain extended select timestampdiff(SQL_TSI_WEEK, '2001-02-01', '2001-05-01') as a1,
timestampdiff(SQL_TSI_FRAC_SECOND, '2001-02-01 12:59:59.120000', '2001-05-01 12:58:58.119999') as a2;

View File

@ -6,10 +6,12 @@
drop table if exists t1;
--enable_warnings
create table t1 (time time, date date, timestamp timestamp);
insert into t1 values ("12:22:22","97:02:03","1997-01-02");
create table t1 (time time, date date, timestamp timestamp,
quarter int, week int, year int, timestampadd int, timestampdiff int);
insert into t1 values ("12:22:22","97:02:03","1997-01-02",1,2,3,4,5);
select * from t1;
select t1.time+0,t1.date+0,t1.timestamp+0,concat(date," ",time) from t1;
select t1.time+0,t1.date+0,t1.timestamp+0,concat(date," ",time),
t1.quarter+t1.week, t1.year+timestampadd, timestampdiff from t1;
drop table t1;
create table events(binlog int);
insert into events values(1);

View File

@ -32,18 +32,18 @@ create function func1() returns int
return 42|
# Can't create recursively
--error 1285
--error 1286
create procedure foo()
create procedure bar() set @x=3|
--error 1285
--error 1286
create procedure foo()
create function bar() returns double return 2.3|
# Already exists
--error 1286
--error 1287
create procedure proc1()
set @x = 42|
--error 1286
--error 1287
create function func1() returns int
return 42|
@ -51,39 +51,39 @@ drop procedure proc1|
drop function func1|
# Does not exist
--error 1287
--error 1288
alter procedure foo|
--error 1287
--error 1288
alter function foo|
--error 1287
--error 1288
drop procedure foo|
--error 1287
--error 1288
drop function foo|
--error 1287
--error 1288
call foo()|
drop procedure if exists foo|
--error 1287
--error 1288
show create procedure foo|
# LEAVE/ITERATE with no match
--error 1290
--error 1291
create procedure foo()
foo: loop
leave bar;
end loop|
--error 1290
--error 1291
create procedure foo()
foo: loop
iterate bar;
end loop|
--error 1290
--error 1291
create procedure foo()
foo: begin
iterate foo;
end|
# Redefining label
--error 1291
--error 1292
create procedure foo()
foo: loop
foo: loop
@ -92,7 +92,7 @@ foo: loop
end loop foo|
# End label mismatch
--error 1292
--error 1293
create procedure foo()
foo: loop
set @x=2;
@ -113,17 +113,17 @@ begin
select name from mysql.proc;
select type from mysql.proc;
end|
--error 1294
--error 1295
call foo()|
drop procedure foo|
# RETURN in FUNCTION only
--error 1295
--error 1296
create procedure foo()
return 42|
# Doesn't allow queries in FUNCTIONs (for now :-( )
--error 1296
--error 1297
create function foo() returns int
begin
declare x int;
@ -137,19 +137,19 @@ create procedure p(x int)
create function f(x int) returns int
return x+42|
--error 1300
--error 1301
call p()|
--error 1300
--error 1301
call p(1, 2)|
--error 1300
--error 1301
select f()|
--error 1300
--error 1301
select f(1, 2)|
drop procedure p|
drop function f|
--error 1301
--error 1302
create procedure p(val int, out res int)
begin
declare x int default 0;
@ -163,7 +163,7 @@ begin
end if;
end|
--error 1301
--error 1302
create procedure p(val int, out res int)
begin
declare x int default 0;
@ -178,7 +178,7 @@ begin
end if;
end|
--error 1302
--error 1303
create function f(val int) returns int
begin
declare x int;
@ -196,12 +196,12 @@ begin
end if;
end|
--error 1303
--error 1304
select f(10)|
drop function f|
--error 1304
--error 1305
create procedure p()
begin
declare c cursor for insert into test.t1 values ("foo", 42);
@ -210,7 +210,7 @@ begin
close c;
end|
--error 1305
--error 1306
create procedure p()
begin
declare x int;
@ -220,7 +220,7 @@ begin
close c;
end|
--error 1306
--error 1307
create procedure p()
begin
declare c cursor for select * from test.t;
@ -242,7 +242,7 @@ begin
open c;
close c;
end|
--error 1307
--error 1308
call p()|
drop procedure p|
@ -254,11 +254,11 @@ begin
close c;
close c;
end|
--error 1308
--error 1309
call p()|
drop procedure p|
--error 1287
--error 1288
alter procedure bar3 sql security invoker|
--error 1059
alter procedure bar3 name
@ -272,7 +272,7 @@ drop table if exists t1|
create table t1 (val int, x float)|
insert into t1 values (42, 3.1), (19, 1.2)|
--error 1309
--error 1310
create procedure p()
begin
declare c cursor for select * from t1;
@ -292,7 +292,7 @@ begin
fetch c into x;
close c;
end|
--error 1310
--error 1311
call p()|
drop procedure p|
@ -307,34 +307,34 @@ begin
fetch c into x, y, z;
close c;
end|
--error 1310
--error 1311
call p()|
drop procedure p|
--error 1312
--error 1313
create procedure p(in x int, x char(10))
begin
end|
--error 1312
--error 1313
create function p(x int, x char(10))
begin
end|
--error 1313
--error 1314
create procedure p()
begin
declare x float;
declare x int;
end|
--error 1314
--error 1315
create procedure p()
begin
declare c condition for 1064;
declare c condition for 1065;
end|
--error 1315
--error 1316
create procedure p()
begin
declare c cursor for select * from t1;
@ -358,9 +358,26 @@ drop procedure bug1965|
#
# BUG#1966
#
--error 1309
--error 1310
select 1 into a|
#
# BUG#336
#
--error 1318
create procedure bug336(id char(16))
begin
declare x int;
set x = (select sum(t.data) from test.t2 t);
end|
#
# BUG#1654
#
--error 1297
create function bug1654()
returns int
return (select sum(t.data) from test.t2 t)|
drop table t1|

View File

@ -815,6 +815,11 @@ delete from t2|
drop table t3|
drop procedure cur2|
#
# Test cases for old bugs
#
#
# BUG#822
#
@ -898,7 +903,6 @@ select @1, @2|
drop table t70|
drop procedure bug1656|
#
# BUG#1862
#
@ -920,7 +924,6 @@ select * from t3|
drop table t3|
drop procedure bug1862|
#
# BUG#1874
#
@ -945,6 +948,26 @@ delete from t1|
delete from t2|
drop procedure bug1874|
#
# BUG#1653
#
--disable_warnings
drop table if exists table_1|
--enable_warnings
create table t3 (column_1_0 int)|
create procedure bug1653()
update t3 set column_1 = 0|
--error 1054
call bug1653()|
drop table t3|
create table t3 (column_1 int)|
call bug1653()|
drop procedure bug1653|
drop table t3|
#
# Some "real" examples
@ -1071,7 +1094,47 @@ drop procedure ip|
--replace_column 4 '0000-00-00 00:00:00' 5 '0000-00-00 00:00:00'
show procedure status like '%p%'|
# Fibonacci, for recursion test. (Yet Another Numerical series :)
--disable_warnings
drop table if exists fib|
--enable_warnings
create table fib ( f bigint unsigned not null )|
insert into fib values (1), (1)|
# 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.
create procedure fib(n int unsigned)
begin
if n > 0 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|
call fib(20)|
select * from fib order by f asc|
drop table fib|
drop procedure fib|
#
# Comment & suid
#
create procedure bar(x char(16), y int)
comment "111111111111" sql security invoker
insert into test.t1 values (x, y)|

View File

@ -136,7 +136,7 @@ set big_tables="OFFF";
set unknown_variable=1;
--error 1232
set max_join_size="hello";
--error 1231
--error 1285
set table_type=UNKNOWN_TABLE_TYPE;
--error 1231
set table_type=INNODB, big_tables=2;