diff options
author | Alexander Nozdrin <alik@sun.com> | 2009-09-23 17:57:39 +0400 |
---|---|---|
committer | Alexander Nozdrin <alik@sun.com> | 2009-09-23 17:57:39 +0400 |
commit | ff83a4285376c8f259fea451d92e5909ddb5049e (patch) | |
tree | c148b3632f4b93b84d5f1e31dd3669612181702e /mysql-test | |
parent | 7947948c5225b5e48dfeb18a17f0c170620bfc89 (diff) | |
parent | 1ecaf1bc1e589a7246b2a4c18490ecf96209154e (diff) | |
download | mariadb-git-ff83a4285376c8f259fea451d92e5909ddb5049e.tar.gz |
Merge mysql-trunk-signal (into mysql-next-mr-alik, which is mysql-next-mr).
Diffstat (limited to 'mysql-test')
59 files changed, 7266 insertions, 783 deletions
diff --git a/mysql-test/r/bigint.result b/mysql-test/r/bigint.result index 4a5b8fcf4aa..7c23f1267c2 100644 --- a/mysql-test/r/bigint.result +++ b/mysql-test/r/bigint.result @@ -362,12 +362,12 @@ select cast(19999999999999999999 as signed); cast(19999999999999999999 as signed) 9223372036854775807 Warnings: -Error 1292 Truncated incorrect DECIMAL value: '' +Warning 1292 Truncated incorrect DECIMAL value: '' select cast(-19999999999999999999 as signed); cast(-19999999999999999999 as signed) -9223372036854775808 Warnings: -Error 1292 Truncated incorrect DECIMAL value: '' +Warning 1292 Truncated incorrect DECIMAL value: '' select -9223372036854775808; Catalog Database Table Table_alias Column Column_alias Type Length Max length Is_null Flags Decimals Charsetnr def -9223372036854775808 8 20 20 N 32897 0 63 diff --git a/mysql-test/r/cast.result b/mysql-test/r/cast.result index dd61396e485..c53de220b60 100644 --- a/mysql-test/r/cast.result +++ b/mysql-test/r/cast.result @@ -380,7 +380,7 @@ select cast(s1 as decimal(7,2)) from t1; cast(s1 as decimal(7,2)) 99999.99 Warnings: -Error 1264 Out of range value for column 'cast(s1 as decimal(7,2))' at row 1 +Warning 1264 Out of range value for column 'cast(s1 as decimal(7,2))' at row 1 drop table t1; CREATE TABLE t1 (v varchar(10), tt tinytext, t text, mt mediumtext, lt longtext); diff --git a/mysql-test/r/ctype_utf8.result b/mysql-test/r/ctype_utf8.result index 6f4ae965ca0..70f976ee9a7 100644 --- a/mysql-test/r/ctype_utf8.result +++ b/mysql-test/r/ctype_utf8.result @@ -1631,27 +1631,27 @@ select char(0xff,0x8f using utf8); char(0xff,0x8f using utf8) NULL Warnings: -Error 1300 Invalid utf8 character string: 'FF8F' +Warning 1300 Invalid utf8 character string: 'FF8F' select char(195 using utf8); char(195 using utf8) NULL Warnings: -Error 1300 Invalid utf8 character string: 'C3' +Warning 1300 Invalid utf8 character string: 'C3' select char(196 using utf8); char(196 using utf8) NULL Warnings: -Error 1300 Invalid utf8 character string: 'C4' +Warning 1300 Invalid utf8 character string: 'C4' select char(2557 using utf8); char(2557 using utf8) NULL Warnings: -Error 1300 Invalid utf8 character string: 'FD' +Warning 1300 Invalid utf8 character string: 'FD' select convert(char(0xff,0x8f) using utf8); convert(char(0xff,0x8f) using utf8) NULL Warnings: -Error 1300 Invalid utf8 character string: 'FF8F' +Warning 1300 Invalid utf8 character string: 'FF8F' select hex(convert(char(2557 using latin1) using utf8)); hex(convert(char(2557 using latin1) using utf8)) 09C3BD @@ -1815,12 +1815,12 @@ select hex(char(0xFF using utf8)); hex(char(0xFF using utf8)) NULL Warnings: -Error 1300 Invalid utf8 character string: 'FF' +Warning 1300 Invalid utf8 character string: 'FF' select hex(convert(0xFF using utf8)); hex(convert(0xFF using utf8)) NULL Warnings: -Error 1300 Invalid utf8 character string: 'FF' +Warning 1300 Invalid utf8 character string: 'FF' select hex(_utf8 0x616263FF); ERROR HY000: Invalid utf8 character string: 'FF' select hex(_utf8 X'616263FF'); diff --git a/mysql-test/r/date_formats.result b/mysql-test/r/date_formats.result index 7e185daa668..b0b8316fe33 100644 --- a/mysql-test/r/date_formats.result +++ b/mysql-test/r/date_formats.result @@ -89,7 +89,7 @@ select STR_TO_DATE('2004.12.12 22.30.61','%Y.%m.%d %T'); STR_TO_DATE('2004.12.12 22.30.61','%Y.%m.%d %T') NULL Warnings: -Error 1411 Incorrect time value: '22.30.61' for function str_to_date +Warning 1411 Incorrect time value: '22.30.61' for function str_to_date create table t1 (date char(30), format char(30) not null); insert into t1 values ('2003-01-02 10:11:12', '%Y-%m-%d %H:%i:%S'), @@ -361,21 +361,21 @@ Tuesday 52 2001 %W %u %x NULL 7 53 1998 %w %u %Y NULL NULL %m.%d.%Y NULL Warnings: -Error 1411 Incorrect datetime value: '2003-01-02 10:11:12 PM' for function str_to_date -Error 1411 Incorrect datetime value: '2003-01-02 10:11:12.123456' for function str_to_date -Error 1411 Incorrect datetime value: '2003-01-02 10:11:12AM' for function str_to_date -Error 1411 Incorrect datetime value: '2003-01-02 10:11:12AN' for function str_to_date -Error 1411 Incorrect datetime value: '2003-01-02 10:11:12 PM' for function str_to_date -Error 1411 Incorrect datetime value: '10:20:10AM' for function str_to_date -Error 1411 Incorrect datetime value: '15 Septembei 2001' for function str_to_date -Error 1411 Incorrect datetime value: '15 Ju 2001' for function str_to_date -Error 1411 Incorrect datetime value: 'Sund 15 MA' for function str_to_date -Error 1411 Incorrect datetime value: 'Thursdai 12 1998' for function str_to_date -Error 1411 Incorrect datetime value: 'Sunday 01 2001' for function str_to_date -Error 1411 Incorrect datetime value: 'Tuesday 52 2001' for function str_to_date -Error 1411 Incorrect datetime value: 'Tuesday 52 2001' for function str_to_date -Error 1411 Incorrect datetime value: 'Tuesday 52 2001' for function str_to_date -Error 1411 Incorrect datetime value: '7 53 1998' for function str_to_date +Warning 1411 Incorrect datetime value: '2003-01-02 10:11:12 PM' for function str_to_date +Warning 1411 Incorrect datetime value: '2003-01-02 10:11:12.123456' for function str_to_date +Warning 1411 Incorrect datetime value: '2003-01-02 10:11:12AM' for function str_to_date +Warning 1411 Incorrect datetime value: '2003-01-02 10:11:12AN' for function str_to_date +Warning 1411 Incorrect datetime value: '2003-01-02 10:11:12 PM' for function str_to_date +Warning 1411 Incorrect datetime value: '10:20:10AM' for function str_to_date +Warning 1411 Incorrect datetime value: '15 Septembei 2001' for function str_to_date +Warning 1411 Incorrect datetime value: '15 Ju 2001' for function str_to_date +Warning 1411 Incorrect datetime value: 'Sund 15 MA' for function str_to_date +Warning 1411 Incorrect datetime value: 'Thursdai 12 1998' for function str_to_date +Warning 1411 Incorrect datetime value: 'Sunday 01 2001' for function str_to_date +Warning 1411 Incorrect datetime value: 'Tuesday 52 2001' for function str_to_date +Warning 1411 Incorrect datetime value: 'Tuesday 52 2001' for function str_to_date +Warning 1411 Incorrect datetime value: 'Tuesday 52 2001' for function str_to_date +Warning 1411 Incorrect datetime value: '7 53 1998' for function str_to_date select date,format,concat(str_to_date(date, format),'') as con from t1; date format con 2003-01-02 10:11:12 PM %Y-%m-%d %H:%i:%S %p NULL @@ -395,21 +395,21 @@ Tuesday 52 2001 %W %u %x NULL 7 53 1998 %w %u %Y NULL NULL %m.%d.%Y NULL Warnings: -Error 1411 Incorrect datetime value: '2003-01-02 10:11:12 PM' for function str_to_date -Error 1411 Incorrect datetime value: '2003-01-02 10:11:12.123456' for function str_to_date -Error 1411 Incorrect datetime value: '2003-01-02 10:11:12AM' for function str_to_date -Error 1411 Incorrect datetime value: '2003-01-02 10:11:12AN' for function str_to_date -Error 1411 Incorrect datetime value: '2003-01-02 10:11:12 PM' for function str_to_date -Error 1411 Incorrect datetime value: '10:20:10AM' for function str_to_date -Error 1411 Incorrect datetime value: '15 Septembei 2001' for function str_to_date -Error 1411 Incorrect datetime value: '15 Ju 2001' for function str_to_date -Error 1411 Incorrect datetime value: 'Sund 15 MA' for function str_to_date -Error 1411 Incorrect datetime value: 'Thursdai 12 1998' for function str_to_date -Error 1411 Incorrect datetime value: 'Sunday 01 2001' for function str_to_date -Error 1411 Incorrect datetime value: 'Tuesday 52 2001' for function str_to_date -Error 1411 Incorrect datetime value: 'Tuesday 52 2001' for function str_to_date -Error 1411 Incorrect datetime value: 'Tuesday 52 2001' for function str_to_date -Error 1411 Incorrect datetime value: '7 53 1998' for function str_to_date +Warning 1411 Incorrect datetime value: '2003-01-02 10:11:12 PM' for function str_to_date +Warning 1411 Incorrect datetime value: '2003-01-02 10:11:12.123456' for function str_to_date +Warning 1411 Incorrect datetime value: '2003-01-02 10:11:12AM' for function str_to_date +Warning 1411 Incorrect datetime value: '2003-01-02 10:11:12AN' for function str_to_date +Warning 1411 Incorrect datetime value: '2003-01-02 10:11:12 PM' for function str_to_date +Warning 1411 Incorrect datetime value: '10:20:10AM' for function str_to_date +Warning 1411 Incorrect datetime value: '15 Septembei 2001' for function str_to_date +Warning 1411 Incorrect datetime value: '15 Ju 2001' for function str_to_date +Warning 1411 Incorrect datetime value: 'Sund 15 MA' for function str_to_date +Warning 1411 Incorrect datetime value: 'Thursdai 12 1998' for function str_to_date +Warning 1411 Incorrect datetime value: 'Sunday 01 2001' for function str_to_date +Warning 1411 Incorrect datetime value: 'Tuesday 52 2001' for function str_to_date +Warning 1411 Incorrect datetime value: 'Tuesday 52 2001' for function str_to_date +Warning 1411 Incorrect datetime value: 'Tuesday 52 2001' for function str_to_date +Warning 1411 Incorrect datetime value: '7 53 1998' for function str_to_date truncate table t1; insert into t1 values ('10:20:10AM', '%h:%i:%s'), @@ -449,7 +449,7 @@ select str_to_date('15-01-2001 12:59:59', GET_FORMAT(DATE,'USA')); str_to_date('15-01-2001 12:59:59', GET_FORMAT(DATE,'USA')) NULL Warnings: -Error 1411 Incorrect datetime value: '15-01-2001 12:59:59' for function str_to_date +Warning 1411 Incorrect datetime value: '15-01-2001 12:59:59' for function str_to_date explain extended select makedate(1997,1), addtime("31.12.97 11.59.59.999999 PM", "1 1.1.1.000002"),subtime("31.12.97 11.59.59.999999 PM", "1 1.1.1.000002"),timediff("01.01.97 11:59:59.000001 PM","31.12.95 11:59:59.000002 PM"),cast(str_to_date("15-01-2001 12:59:59", "%d-%m-%Y %H:%i:%S") as TIME), maketime(23,11,12),microsecond("1997-12-31 23:59:59.000001"); id select_type table type possible_keys key key_len ref rows filtered Extra 1 SIMPLE NULL NULL NULL NULL NULL NULL NULL NULL No tables used diff --git a/mysql-test/r/func_compress.result b/mysql-test/r/func_compress.result index b4e61d0e4fc..650cc9c2c70 100644 --- a/mysql-test/r/func_compress.result +++ b/mysql-test/r/func_compress.result @@ -65,8 +65,8 @@ NULL 50000 NULL Warnings: -Error 1259 ZLIB: Input data corrupted -Error 1256 Uncompressed data size too large; the maximum size is 1048576 (probably, length of uncompressed data was corrupted) +Warning 1259 ZLIB: Input data corrupted +Warning 1256 Uncompressed data size too large; the maximum size is 1048576 (probably, length of uncompressed data was corrupted) drop table t1; set @@global.max_allowed_packet=1048576*100; select compress(repeat('aaaaaaaaaa', IF(XXX, 10, 10000000))) is null; @@ -96,12 +96,12 @@ explain select * from t1 where uncompress(a) is null; id select_type table type possible_keys key key_len ref rows Extra 1 SIMPLE t1 system NULL NULL NULL NULL 1 Warnings: -Error 1259 ZLIB: Input data corrupted +Warning 1259 ZLIB: Input data corrupted select * from t1 where uncompress(a) is null; a foo Warnings: -Error 1259 ZLIB: Input data corrupted +Warning 1259 ZLIB: Input data corrupted explain select *, uncompress(a) from t1; id select_type table type possible_keys key key_len ref rows Extra 1 SIMPLE t1 system NULL NULL NULL NULL 1 @@ -109,13 +109,13 @@ select *, uncompress(a) from t1; a uncompress(a) foo NULL Warnings: -Error 1259 ZLIB: Input data corrupted +Warning 1259 ZLIB: Input data corrupted select *, uncompress(a), uncompress(a) is null from t1; a uncompress(a) uncompress(a) is null foo NULL 1 Warnings: -Error 1259 ZLIB: Input data corrupted -Error 1259 ZLIB: Input data corrupted +Warning 1259 ZLIB: Input data corrupted +Warning 1259 ZLIB: Input data corrupted drop table t1; CREATE TABLE t1 (c1 INT); INSERT INTO t1 VALUES (1), (1111), (11111); diff --git a/mysql-test/r/func_encrypt.result b/mysql-test/r/func_encrypt.result index 8fbf36b45b9..91ff4e218fb 100644 --- a/mysql-test/r/func_encrypt.result +++ b/mysql-test/r/func_encrypt.result @@ -124,7 +124,7 @@ select des_encrypt("hello",10); des_encrypt("hello",10) NULL Warnings: -Error 1108 Incorrect parameters to procedure 'des_encrypt' +Warning 1108 Incorrect parameters to procedure 'des_encrypt' select des_encrypt(NULL); des_encrypt(NULL) NULL @@ -138,12 +138,12 @@ select des_encrypt(10, NULL); des_encrypt(10, NULL) NULL Warnings: -Error 1108 Incorrect parameters to procedure 'des_encrypt' +Warning 1108 Incorrect parameters to procedure 'des_encrypt' select des_encrypt("hello", NULL); des_encrypt("hello", NULL) NULL Warnings: -Error 1108 Incorrect parameters to procedure 'des_encrypt' +Warning 1108 Incorrect parameters to procedure 'des_encrypt' select des_decrypt("hello",10); des_decrypt("hello",10) hello @@ -177,7 +177,7 @@ select hex(des_decrypt(des_encrypt("hello","hidden"))); hex(des_decrypt(des_encrypt("hello","hidden"))) NULL Warnings: -Error 1108 Incorrect parameters to procedure 'des_decrypt' +Warning 1108 Incorrect parameters to procedure 'des_decrypt' explain extended select des_decrypt(des_encrypt("hello",4),'password2'), des_decrypt(des_encrypt("hello","hidden")); id select_type table type possible_keys key key_len ref rows filtered Extra 1 SIMPLE NULL NULL NULL NULL NULL NULL NULL NULL No tables used diff --git a/mysql-test/r/func_encrypt_nossl.result b/mysql-test/r/func_encrypt_nossl.result index d0df2335afa..fc003eec226 100644 --- a/mysql-test/r/func_encrypt_nossl.result +++ b/mysql-test/r/func_encrypt_nossl.result @@ -2,83 +2,83 @@ select des_encrypt("test", 'akeystr'); des_encrypt("test", 'akeystr') NULL Warnings: -Error 1289 The 'des_encrypt' feature is disabled; you need MySQL built with '--with-openssl' to have it working +Warning 1289 The 'des_encrypt' feature is disabled; you need MySQL built with '--with-openssl' to have it working select des_encrypt("test", 1); des_encrypt("test", 1) NULL Warnings: -Error 1289 The 'des_encrypt' feature is disabled; you need MySQL built with '--with-openssl' to have it working +Warning 1289 The 'des_encrypt' feature is disabled; you need MySQL built with '--with-openssl' to have it working select des_encrypt("test", 9); des_encrypt("test", 9) NULL Warnings: -Error 1289 The 'des_encrypt' feature is disabled; you need MySQL built with '--with-openssl' to have it working +Warning 1289 The 'des_encrypt' feature is disabled; you need MySQL built with '--with-openssl' to have it working select des_encrypt("test", 100); des_encrypt("test", 100) NULL Warnings: -Error 1289 The 'des_encrypt' feature is disabled; you need MySQL built with '--with-openssl' to have it working +Warning 1289 The 'des_encrypt' feature is disabled; you need MySQL built with '--with-openssl' to have it working select des_encrypt("test", NULL); des_encrypt("test", NULL) NULL Warnings: -Error 1289 The 'des_encrypt' feature is disabled; you need MySQL built with '--with-openssl' to have it working +Warning 1289 The 'des_encrypt' feature is disabled; you need MySQL built with '--with-openssl' to have it working select des_encrypt(NULL, NULL); des_encrypt(NULL, NULL) NULL Warnings: -Error 1289 The 'des_encrypt' feature is disabled; you need MySQL built with '--with-openssl' to have it working +Warning 1289 The 'des_encrypt' feature is disabled; you need MySQL built with '--with-openssl' to have it working select des_decrypt("test", 'anotherkeystr'); des_decrypt("test", 'anotherkeystr') NULL Warnings: -Error 1289 The 'des_decrypt' feature is disabled; you need MySQL built with '--with-openssl' to have it working +Warning 1289 The 'des_decrypt' feature is disabled; you need MySQL built with '--with-openssl' to have it working select des_decrypt(1, 1); des_decrypt(1, 1) NULL Warnings: -Error 1289 The 'des_decrypt' feature is disabled; you need MySQL built with '--with-openssl' to have it working +Warning 1289 The 'des_decrypt' feature is disabled; you need MySQL built with '--with-openssl' to have it working select des_decrypt(des_encrypt("test", 'thekey')); des_decrypt(des_encrypt("test", 'thekey')) NULL Warnings: -Error 1289 The 'des_decrypt' feature is disabled; you need MySQL built with '--with-openssl' to have it working +Warning 1289 The 'des_decrypt' feature is disabled; you need MySQL built with '--with-openssl' to have it working select hex(des_encrypt("hello")),des_decrypt(des_encrypt("hello")); hex(des_encrypt("hello")) des_decrypt(des_encrypt("hello")) NULL NULL Warnings: -Error 1289 The 'des_encrypt' feature is disabled; you need MySQL built with '--with-openssl' to have it working -Error 1289 The 'des_decrypt' feature is disabled; you need MySQL built with '--with-openssl' to have it working +Warning 1289 The 'des_encrypt' feature is disabled; you need MySQL built with '--with-openssl' to have it working +Warning 1289 The 'des_decrypt' feature is disabled; you need MySQL built with '--with-openssl' to have it working select des_decrypt(des_encrypt("hello",4)); des_decrypt(des_encrypt("hello",4)) NULL Warnings: -Error 1289 The 'des_decrypt' feature is disabled; you need MySQL built with '--with-openssl' to have it working +Warning 1289 The 'des_decrypt' feature is disabled; you need MySQL built with '--with-openssl' to have it working select des_decrypt(des_encrypt("hello",'test'),'test'); des_decrypt(des_encrypt("hello",'test'),'test') NULL Warnings: -Error 1289 The 'des_decrypt' feature is disabled; you need MySQL built with '--with-openssl' to have it working +Warning 1289 The 'des_decrypt' feature is disabled; you need MySQL built with '--with-openssl' to have it working select hex(des_encrypt("hello")),hex(des_encrypt("hello",5)),hex(des_encrypt("hello",'default_password')); hex(des_encrypt("hello")) hex(des_encrypt("hello",5)) hex(des_encrypt("hello",'default_password')) NULL NULL NULL Warnings: -Error 1289 The 'des_encrypt' feature is disabled; you need MySQL built with '--with-openssl' to have it working -Error 1289 The 'des_encrypt' feature is disabled; you need MySQL built with '--with-openssl' to have it working -Error 1289 The 'des_encrypt' feature is disabled; you need MySQL built with '--with-openssl' to have it working +Warning 1289 The 'des_encrypt' feature is disabled; you need MySQL built with '--with-openssl' to have it working +Warning 1289 The 'des_encrypt' feature is disabled; you need MySQL built with '--with-openssl' to have it working +Warning 1289 The 'des_encrypt' feature is disabled; you need MySQL built with '--with-openssl' to have it working select des_decrypt(des_encrypt("hello"),'default_password'); des_decrypt(des_encrypt("hello"),'default_password') NULL Warnings: -Error 1289 The 'des_decrypt' feature is disabled; you need MySQL built with '--with-openssl' to have it working +Warning 1289 The 'des_decrypt' feature is disabled; you need MySQL built with '--with-openssl' to have it working select des_decrypt(des_encrypt("hello",4),'password4'); des_decrypt(des_encrypt("hello",4),'password4') NULL Warnings: -Error 1289 The 'des_decrypt' feature is disabled; you need MySQL built with '--with-openssl' to have it working +Warning 1289 The 'des_decrypt' feature is disabled; you need MySQL built with '--with-openssl' to have it working SET @a=des_decrypt(des_encrypt("hello")); Warnings: -Error 1289 The 'des_decrypt' feature is disabled; you need MySQL built with '--with-openssl' to have it working +Warning 1289 The 'des_decrypt' feature is disabled; you need MySQL built with '--with-openssl' to have it working flush des_key_file; select @a = des_decrypt(des_encrypt("hello")); @a = des_decrypt(des_encrypt("hello")) @@ -90,9 +90,9 @@ select hex(des_decrypt(des_encrypt("hello",4),'password2')); hex(des_decrypt(des_encrypt("hello",4),'password2')) NULL Warnings: -Error 1289 The 'des_decrypt' feature is disabled; you need MySQL built with '--with-openssl' to have it working +Warning 1289 The 'des_decrypt' feature is disabled; you need MySQL built with '--with-openssl' to have it working select hex(des_decrypt(des_encrypt("hello","hidden"))); hex(des_decrypt(des_encrypt("hello","hidden"))) NULL Warnings: -Error 1289 The 'des_decrypt' feature is disabled; you need MySQL built with '--with-openssl' to have it working +Warning 1289 The 'des_decrypt' feature is disabled; you need MySQL built with '--with-openssl' to have it working diff --git a/mysql-test/r/func_gconcat.result b/mysql-test/r/func_gconcat.result index 3b78851a1b9..ebec186591d 100644 --- a/mysql-test/r/func_gconcat.result +++ b/mysql-test/r/func_gconcat.result @@ -153,10 +153,10 @@ grp group_concat(c) 4 5 NULL Warnings: -Warning 1260 1 line(s) were cut by GROUP_CONCAT() +Warning 1260 Row 4 was cut by GROUP_CONCAT() show warnings; Level Code Message -Warning 1260 1 line(s) were cut by GROUP_CONCAT() +Warning 1260 Row 4 was cut by GROUP_CONCAT() set group_concat_max_len = 1024; select group_concat(sum(c)) from t1 group by grp; ERROR HY000: Invalid use of group function @@ -380,25 +380,29 @@ group_concat(b) bb,c BB,C Warnings: -Warning 1260 2 line(s) were cut by GROUP_CONCAT() +Warning 1260 Row 2 was cut by GROUP_CONCAT() +Warning 1260 Row 4 was cut by GROUP_CONCAT() select group_concat(distinct b) from t1 group by a; group_concat(distinct b) bb,c BB,C Warnings: -Warning 1260 2 line(s) were cut by GROUP_CONCAT() +Warning 1260 Row 2 was cut by GROUP_CONCAT() +Warning 1260 Row 4 was cut by GROUP_CONCAT() select group_concat(b order by b) from t1 group by a; group_concat(b order by b) a,bb A,BB Warnings: -Warning 1260 2 line(s) were cut by GROUP_CONCAT() +Warning 1260 Row 3 was cut by GROUP_CONCAT() +Warning 1260 Row 6 was cut by GROUP_CONCAT() select group_concat(distinct b order by b) from t1 group by a; group_concat(distinct b order by b) a,bb A,BB Warnings: -Warning 1260 2 line(s) were cut by GROUP_CONCAT() +Warning 1260 Row 3 was cut by GROUP_CONCAT() +Warning 1260 Row 6 was cut by GROUP_CONCAT() insert into t1 values (1, concat(repeat('1', 300), '2')), (1, concat(repeat('1', 300), '2')), (1, concat(repeat('0', 300), '1')), (2, concat(repeat('1', 300), '2')), (2, concat(repeat('1', 300), '2')), @@ -426,25 +430,29 @@ group_concat(b) bb,ccc,a,bb,ccc,1111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111112,1111111111111111111111111111111111111111111111111111111111111111111111111111111111 BB,CCC,A,BB,CCC,1111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111112,1111111111111111111111111111111111111111111111111111111111111111111111111111111111 Warnings: -Warning 1260 2 line(s) were cut by GROUP_CONCAT() +Warning 1260 Row 7 was cut by GROUP_CONCAT() +Warning 1260 Row 14 was cut by GROUP_CONCAT() select group_concat(distinct b) from t1 group by a; group_concat(distinct b) bb,ccc,a,1111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111112,00000000000000000000000000000000000000000000000000000000000000000000000000000000000000000 BB,CCC,A,1111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111112,00000000000000000000000000000000000000000000000000000000000000000000000000000000000000000 Warnings: -Warning 1260 2 line(s) were cut by GROUP_CONCAT() +Warning 1260 Row 5 was cut by GROUP_CONCAT() +Warning 1260 Row 10 was cut by GROUP_CONCAT() select group_concat(b order by b) from t1 group by a; group_concat(b order by b) 0000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000001,11111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111 0000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000001,11111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111 Warnings: -Warning 1260 2 line(s) were cut by GROUP_CONCAT() +Warning 1260 Row 2 was cut by GROUP_CONCAT() +Warning 1260 Row 4 was cut by GROUP_CONCAT() select group_concat(distinct b order by b) from t1 group by a; group_concat(distinct b order by b) 0000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000001,11111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111 0000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000001,11111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111 Warnings: -Warning 1260 2 line(s) were cut by GROUP_CONCAT() +Warning 1260 Row 2 was cut by GROUP_CONCAT() +Warning 1260 Row 4 was cut by GROUP_CONCAT() drop table t1; create table t1 (a varchar(255) character set cp1250 collate cp1250_general_ci, b varchar(255) character set koi8r); @@ -751,22 +759,22 @@ SELECT GROUP_CONCAT( a ) FROM t1; GROUP_CONCAT( a ) aaaaaaaaaa,bbbbbbbbb Warnings: -Warning 1260 1 line(s) were cut by GROUP_CONCAT() +Warning 1260 Row 2 was cut by GROUP_CONCAT() SELECT GROUP_CONCAT( DISTINCT a ) FROM t1; GROUP_CONCAT( DISTINCT a ) aaaaaaaaaa,bbbbbbbbb Warnings: -Warning 1260 1 line(s) were cut by GROUP_CONCAT() +Warning 1260 Row 2 was cut by GROUP_CONCAT() SELECT GROUP_CONCAT( a ORDER BY b ) FROM t1; GROUP_CONCAT( a ORDER BY b ) aaaaaaaaaa,bbbbbbbbb Warnings: -Warning 1260 1 line(s) were cut by GROUP_CONCAT() +Warning 1260 Row 2 was cut by GROUP_CONCAT() SELECT GROUP_CONCAT( DISTINCT a ORDER BY b ) FROM t1; GROUP_CONCAT( DISTINCT a ORDER BY b ) aaaaaaaaaa,bbbbbbbbb Warnings: -Warning 1260 1 line(s) were cut by GROUP_CONCAT() +Warning 1260 Row 2 was cut by GROUP_CONCAT() SET group_concat_max_len = DEFAULT; DROP TABLE t1; SET group_concat_max_len= 65535; @@ -979,3 +987,31 @@ GROUP BY t1.a 1 DROP TABLE t1, t2; End of 5.0 tests +DROP TABLE IF EXISTS t1, t2; +CREATE TABLE t1 (a VARCHAR(6), b INT); +CREATE TABLE t2 (a VARCHAR(6), b INT); +INSERT INTO t1 VALUES ('111111', 1); +INSERT INTO t1 VALUES ('222222', 2); +INSERT INTO t1 VALUES ('333333', 3); +INSERT INTO t1 VALUES ('444444', 4); +INSERT INTO t1 VALUES ('555555', 5); +SET group_concat_max_len = 5; +SET @old_sql_mode = @@sql_mode, @@sql_mode = 'traditional'; +SELECT GROUP_CONCAT(a), b FROM t1 GROUP BY b LIMIT 3; +GROUP_CONCAT(a) b +11111 1 +22222 2 +33333 3 +Warnings: +Warning 1260 Row 1 was cut by GROUP_CONCAT() +Warning 1260 Row 2 was cut by GROUP_CONCAT() +Warning 1260 Row 3 was cut by GROUP_CONCAT() +INSERT INTO t2 SELECT GROUP_CONCAT(a), b FROM t1 GROUP BY b; +ERROR HY000: Row 1 was cut by GROUP_CONCAT() +UPDATE t1 SET a = '11111' WHERE b = 1; +UPDATE t1 SET a = '22222' WHERE b = 2; +INSERT INTO t2 SELECT GROUP_CONCAT(a), b FROM t1 GROUP BY b; +ERROR HY000: Row 3 was cut by GROUP_CONCAT() +SET group_concat_max_len = DEFAULT; +SET @@sql_mode = @old_sql_mode; +DROP TABLE t1, t2; diff --git a/mysql-test/r/func_math.result b/mysql-test/r/func_math.result index fd7ef72409e..d8b8a14afc6 100644 --- a/mysql-test/r/func_math.result +++ b/mysql-test/r/func_math.result @@ -225,27 +225,27 @@ select ln(-1); ln(-1) NULL Warnings: -Error 1365 Division by 0 +Warning 1365 Division by 0 select log10(-1); log10(-1) NULL Warnings: -Error 1365 Division by 0 +Warning 1365 Division by 0 select log2(-1); log2(-1) NULL Warnings: -Error 1365 Division by 0 +Warning 1365 Division by 0 select log(2,-1); log(2,-1) NULL Warnings: -Error 1365 Division by 0 +Warning 1365 Division by 0 select log(-2,1); log(-2,1) NULL Warnings: -Error 1365 Division by 0 +Warning 1365 Division by 0 set sql_mode=''; select round(111,-10); round(111,-10) diff --git a/mysql-test/r/func_str.result b/mysql-test/r/func_str.result index 2a2fe50ad0f..c87879e13b5 100644 --- a/mysql-test/r/func_str.result +++ b/mysql-test/r/func_str.result @@ -1433,7 +1433,7 @@ select benchmark(-1, 1); benchmark(-1, 1) NULL Warnings: -Error 1411 Incorrect count value: '-1' for function benchmark +Warning 1411 Incorrect count value: '-1' for function benchmark set @password="password"; set @my_data="clear text to encode"; select md5(encode(@my_data, "password")); @@ -1533,7 +1533,7 @@ select locate('lo','hello',-18446744073709551615); locate('lo','hello',-18446744073709551615) 0 Warnings: -Error 1292 Truncated incorrect DECIMAL value: '' +Warning 1292 Truncated incorrect DECIMAL value: '' select locate('lo','hello',18446744073709551615); locate('lo','hello',18446744073709551615) 0 @@ -1541,22 +1541,22 @@ select locate('lo','hello',-18446744073709551616); locate('lo','hello',-18446744073709551616) 0 Warnings: -Error 1292 Truncated incorrect DECIMAL value: '' +Warning 1292 Truncated incorrect DECIMAL value: '' select locate('lo','hello',18446744073709551616); locate('lo','hello',18446744073709551616) 0 Warnings: -Error 1292 Truncated incorrect DECIMAL value: '' +Warning 1292 Truncated incorrect DECIMAL value: '' select locate('lo','hello',-18446744073709551617); locate('lo','hello',-18446744073709551617) 0 Warnings: -Error 1292 Truncated incorrect DECIMAL value: '' +Warning 1292 Truncated incorrect DECIMAL value: '' select locate('lo','hello',18446744073709551617); locate('lo','hello',18446744073709551617) 0 Warnings: -Error 1292 Truncated incorrect DECIMAL value: '' +Warning 1292 Truncated incorrect DECIMAL value: '' select left('hello', 10); left('hello', 10) hello @@ -1588,8 +1588,8 @@ select left('hello', -18446744073709551615); left('hello', -18446744073709551615) Warnings: -Error 1292 Truncated incorrect DECIMAL value: '' -Error 1292 Truncated incorrect DECIMAL value: '' +Warning 1292 Truncated incorrect DECIMAL value: '' +Warning 1292 Truncated incorrect DECIMAL value: '' select left('hello', 18446744073709551615); left('hello', 18446744073709551615) hello @@ -1597,26 +1597,26 @@ select left('hello', -18446744073709551616); left('hello', -18446744073709551616) Warnings: -Error 1292 Truncated incorrect DECIMAL value: '' -Error 1292 Truncated incorrect DECIMAL value: '' +Warning 1292 Truncated incorrect DECIMAL value: '' +Warning 1292 Truncated incorrect DECIMAL value: '' select left('hello', 18446744073709551616); left('hello', 18446744073709551616) hello Warnings: -Error 1292 Truncated incorrect DECIMAL value: '' -Error 1292 Truncated incorrect DECIMAL value: '' +Warning 1292 Truncated incorrect DECIMAL value: '' +Warning 1292 Truncated incorrect DECIMAL value: '' select left('hello', -18446744073709551617); left('hello', -18446744073709551617) Warnings: -Error 1292 Truncated incorrect DECIMAL value: '' -Error 1292 Truncated incorrect DECIMAL value: '' +Warning 1292 Truncated incorrect DECIMAL value: '' +Warning 1292 Truncated incorrect DECIMAL value: '' select left('hello', 18446744073709551617); left('hello', 18446744073709551617) hello Warnings: -Error 1292 Truncated incorrect DECIMAL value: '' -Error 1292 Truncated incorrect DECIMAL value: '' +Warning 1292 Truncated incorrect DECIMAL value: '' +Warning 1292 Truncated incorrect DECIMAL value: '' select right('hello', 10); right('hello', 10) hello @@ -1648,8 +1648,8 @@ select right('hello', -18446744073709551615); right('hello', -18446744073709551615) Warnings: -Error 1292 Truncated incorrect DECIMAL value: '' -Error 1292 Truncated incorrect DECIMAL value: '' +Warning 1292 Truncated incorrect DECIMAL value: '' +Warning 1292 Truncated incorrect DECIMAL value: '' select right('hello', 18446744073709551615); right('hello', 18446744073709551615) hello @@ -1657,26 +1657,26 @@ select right('hello', -18446744073709551616); right('hello', -18446744073709551616) Warnings: -Error 1292 Truncated incorrect DECIMAL value: '' -Error 1292 Truncated incorrect DECIMAL value: '' +Warning 1292 Truncated incorrect DECIMAL value: '' +Warning 1292 Truncated incorrect DECIMAL value: '' select right('hello', 18446744073709551616); right('hello', 18446744073709551616) hello Warnings: -Error 1292 Truncated incorrect DECIMAL value: '' -Error 1292 Truncated incorrect DECIMAL value: '' +Warning 1292 Truncated incorrect DECIMAL value: '' +Warning 1292 Truncated incorrect DECIMAL value: '' select right('hello', -18446744073709551617); right('hello', -18446744073709551617) Warnings: -Error 1292 Truncated incorrect DECIMAL value: '' -Error 1292 Truncated incorrect DECIMAL value: '' +Warning 1292 Truncated incorrect DECIMAL value: '' +Warning 1292 Truncated incorrect DECIMAL value: '' select right('hello', 18446744073709551617); right('hello', 18446744073709551617) hello Warnings: -Error 1292 Truncated incorrect DECIMAL value: '' -Error 1292 Truncated incorrect DECIMAL value: '' +Warning 1292 Truncated incorrect DECIMAL value: '' +Warning 1292 Truncated incorrect DECIMAL value: '' select substring('hello', 2, -1); substring('hello', 2, -1) @@ -1708,8 +1708,8 @@ select substring('hello', -18446744073709551615, 1); substring('hello', -18446744073709551615, 1) Warnings: -Error 1292 Truncated incorrect DECIMAL value: '' -Error 1292 Truncated incorrect DECIMAL value: '' +Warning 1292 Truncated incorrect DECIMAL value: '' +Warning 1292 Truncated incorrect DECIMAL value: '' select substring('hello', 18446744073709551615, 1); substring('hello', 18446744073709551615, 1) @@ -1717,26 +1717,26 @@ select substring('hello', -18446744073709551616, 1); substring('hello', -18446744073709551616, 1) Warnings: -Error 1292 Truncated incorrect DECIMAL value: '' -Error 1292 Truncated incorrect DECIMAL value: '' +Warning 1292 Truncated incorrect DECIMAL value: '' +Warning 1292 Truncated incorrect DECIMAL value: '' select substring('hello', 18446744073709551616, 1); substring('hello', 18446744073709551616, 1) Warnings: -Error 1292 Truncated incorrect DECIMAL value: '' -Error 1292 Truncated incorrect DECIMAL value: '' +Warning 1292 Truncated incorrect DECIMAL value: '' +Warning 1292 Truncated incorrect DECIMAL value: '' select substring('hello', -18446744073709551617, 1); substring('hello', -18446744073709551617, 1) Warnings: -Error 1292 Truncated incorrect DECIMAL value: '' -Error 1292 Truncated incorrect DECIMAL value: '' +Warning 1292 Truncated incorrect DECIMAL value: '' +Warning 1292 Truncated incorrect DECIMAL value: '' select substring('hello', 18446744073709551617, 1); substring('hello', 18446744073709551617, 1) Warnings: -Error 1292 Truncated incorrect DECIMAL value: '' -Error 1292 Truncated incorrect DECIMAL value: '' +Warning 1292 Truncated incorrect DECIMAL value: '' +Warning 1292 Truncated incorrect DECIMAL value: '' select substring('hello', 1, -1); substring('hello', 1, -1) @@ -1762,8 +1762,8 @@ select substring('hello', 1, -18446744073709551615); substring('hello', 1, -18446744073709551615) Warnings: -Error 1292 Truncated incorrect DECIMAL value: '' -Error 1292 Truncated incorrect DECIMAL value: '' +Warning 1292 Truncated incorrect DECIMAL value: '' +Warning 1292 Truncated incorrect DECIMAL value: '' select substring('hello', 1, 18446744073709551615); substring('hello', 1, 18446744073709551615) hello @@ -1771,26 +1771,26 @@ select substring('hello', 1, -18446744073709551616); substring('hello', 1, -18446744073709551616) Warnings: -Error 1292 Truncated incorrect DECIMAL value: '' -Error 1292 Truncated incorrect DECIMAL value: '' +Warning 1292 Truncated incorrect DECIMAL value: '' +Warning 1292 Truncated incorrect DECIMAL value: '' select substring('hello', 1, 18446744073709551616); substring('hello', 1, 18446744073709551616) hello Warnings: -Error 1292 Truncated incorrect DECIMAL value: '' -Error 1292 Truncated incorrect DECIMAL value: '' +Warning 1292 Truncated incorrect DECIMAL value: '' +Warning 1292 Truncated incorrect DECIMAL value: '' select substring('hello', 1, -18446744073709551617); substring('hello', 1, -18446744073709551617) Warnings: -Error 1292 Truncated incorrect DECIMAL value: '' -Error 1292 Truncated incorrect DECIMAL value: '' +Warning 1292 Truncated incorrect DECIMAL value: '' +Warning 1292 Truncated incorrect DECIMAL value: '' select substring('hello', 1, 18446744073709551617); substring('hello', 1, 18446744073709551617) hello Warnings: -Error 1292 Truncated incorrect DECIMAL value: '' -Error 1292 Truncated incorrect DECIMAL value: '' +Warning 1292 Truncated incorrect DECIMAL value: '' +Warning 1292 Truncated incorrect DECIMAL value: '' select substring('hello', -1, -1); substring('hello', -1, -1) @@ -1816,10 +1816,10 @@ select substring('hello', -18446744073709551615, -18446744073709551615); substring('hello', -18446744073709551615, -18446744073709551615) Warnings: -Error 1292 Truncated incorrect DECIMAL value: '' -Error 1292 Truncated incorrect DECIMAL value: '' -Error 1292 Truncated incorrect DECIMAL value: '' -Error 1292 Truncated incorrect DECIMAL value: '' +Warning 1292 Truncated incorrect DECIMAL value: '' +Warning 1292 Truncated incorrect DECIMAL value: '' +Warning 1292 Truncated incorrect DECIMAL value: '' +Warning 1292 Truncated incorrect DECIMAL value: '' select substring('hello', 18446744073709551615, 18446744073709551615); substring('hello', 18446744073709551615, 18446744073709551615) @@ -1827,34 +1827,34 @@ select substring('hello', -18446744073709551616, -18446744073709551616); substring('hello', -18446744073709551616, -18446744073709551616) Warnings: -Error 1292 Truncated incorrect DECIMAL value: '' -Error 1292 Truncated incorrect DECIMAL value: '' -Error 1292 Truncated incorrect DECIMAL value: '' -Error 1292 Truncated incorrect DECIMAL value: '' +Warning 1292 Truncated incorrect DECIMAL value: '' +Warning 1292 Truncated incorrect DECIMAL value: '' +Warning 1292 Truncated incorrect DECIMAL value: '' +Warning 1292 Truncated incorrect DECIMAL value: '' select substring('hello', 18446744073709551616, 18446744073709551616); substring('hello', 18446744073709551616, 18446744073709551616) Warnings: -Error 1292 Truncated incorrect DECIMAL value: '' -Error 1292 Truncated incorrect DECIMAL value: '' -Error 1292 Truncated incorrect DECIMAL value: '' -Error 1292 Truncated incorrect DECIMAL value: '' +Warning 1292 Truncated incorrect DECIMAL value: '' +Warning 1292 Truncated incorrect DECIMAL value: '' +Warning 1292 Truncated incorrect DECIMAL value: '' +Warning 1292 Truncated incorrect DECIMAL value: '' select substring('hello', -18446744073709551617, -18446744073709551617); substring('hello', -18446744073709551617, -18446744073709551617) Warnings: -Error 1292 Truncated incorrect DECIMAL value: '' -Error 1292 Truncated incorrect DECIMAL value: '' -Error 1292 Truncated incorrect DECIMAL value: '' -Error 1292 Truncated incorrect DECIMAL value: '' +Warning 1292 Truncated incorrect DECIMAL value: '' +Warning 1292 Truncated incorrect DECIMAL value: '' +Warning 1292 Truncated incorrect DECIMAL value: '' +Warning 1292 Truncated incorrect DECIMAL value: '' select substring('hello', 18446744073709551617, 18446744073709551617); substring('hello', 18446744073709551617, 18446744073709551617) Warnings: -Error 1292 Truncated incorrect DECIMAL value: '' -Error 1292 Truncated incorrect DECIMAL value: '' -Error 1292 Truncated incorrect DECIMAL value: '' -Error 1292 Truncated incorrect DECIMAL value: '' +Warning 1292 Truncated incorrect DECIMAL value: '' +Warning 1292 Truncated incorrect DECIMAL value: '' +Warning 1292 Truncated incorrect DECIMAL value: '' +Warning 1292 Truncated incorrect DECIMAL value: '' select insert('hello', -1, 1, 'hi'); insert('hello', -1, 1, 'hi') hello @@ -1880,7 +1880,7 @@ select insert('hello', -18446744073709551615, 1, 'hi'); insert('hello', -18446744073709551615, 1, 'hi') hello Warnings: -Error 1292 Truncated incorrect DECIMAL value: '' +Warning 1292 Truncated incorrect DECIMAL value: '' select insert('hello', 18446744073709551615, 1, 'hi'); insert('hello', 18446744073709551615, 1, 'hi') hello @@ -1888,22 +1888,22 @@ select insert('hello', -18446744073709551616, 1, 'hi'); insert('hello', -18446744073709551616, 1, 'hi') hello Warnings: -Error 1292 Truncated incorrect DECIMAL value: '' +Warning 1292 Truncated incorrect DECIMAL value: '' select insert('hello', 18446744073709551616, 1, 'hi'); insert('hello', 18446744073709551616, 1, 'hi') hello Warnings: -Error 1292 Truncated incorrect DECIMAL value: '' +Warning 1292 Truncated incorrect DECIMAL value: '' select insert('hello', -18446744073709551617, 1, 'hi'); insert('hello', -18446744073709551617, 1, 'hi') hello Warnings: -Error 1292 Truncated incorrect DECIMAL value: '' +Warning 1292 Truncated incorrect DECIMAL value: '' select insert('hello', 18446744073709551617, 1, 'hi'); insert('hello', 18446744073709551617, 1, 'hi') hello Warnings: -Error 1292 Truncated incorrect DECIMAL value: '' +Warning 1292 Truncated incorrect DECIMAL value: '' select insert('hello', 1, -1, 'hi'); insert('hello', 1, -1, 'hi') hi @@ -1929,7 +1929,7 @@ select insert('hello', 1, -18446744073709551615, 'hi'); insert('hello', 1, -18446744073709551615, 'hi') hi Warnings: -Error 1292 Truncated incorrect DECIMAL value: '' +Warning 1292 Truncated incorrect DECIMAL value: '' select insert('hello', 1, 18446744073709551615, 'hi'); insert('hello', 1, 18446744073709551615, 'hi') hi @@ -1937,22 +1937,22 @@ select insert('hello', 1, -18446744073709551616, 'hi'); insert('hello', 1, -18446744073709551616, 'hi') hi Warnings: -Error 1292 Truncated incorrect DECIMAL value: '' +Warning 1292 Truncated incorrect DECIMAL value: '' select insert('hello', 1, 18446744073709551616, 'hi'); insert('hello', 1, 18446744073709551616, 'hi') hi Warnings: -Error 1292 Truncated incorrect DECIMAL value: '' +Warning 1292 Truncated incorrect DECIMAL value: '' select insert('hello', 1, -18446744073709551617, 'hi'); insert('hello', 1, -18446744073709551617, 'hi') hi Warnings: -Error 1292 Truncated incorrect DECIMAL value: '' +Warning 1292 Truncated incorrect DECIMAL value: '' select insert('hello', 1, 18446744073709551617, 'hi'); insert('hello', 1, 18446744073709551617, 'hi') hi Warnings: -Error 1292 Truncated incorrect DECIMAL value: '' +Warning 1292 Truncated incorrect DECIMAL value: '' select insert('hello', -1, -1, 'hi'); insert('hello', -1, -1, 'hi') hello @@ -1978,8 +1978,8 @@ select insert('hello', -18446744073709551615, -18446744073709551615, 'hi'); insert('hello', -18446744073709551615, -18446744073709551615, 'hi') hello Warnings: -Error 1292 Truncated incorrect DECIMAL value: '' -Error 1292 Truncated incorrect DECIMAL value: '' +Warning 1292 Truncated incorrect DECIMAL value: '' +Warning 1292 Truncated incorrect DECIMAL value: '' select insert('hello', 18446744073709551615, 18446744073709551615, 'hi'); insert('hello', 18446744073709551615, 18446744073709551615, 'hi') hello @@ -1987,26 +1987,26 @@ select insert('hello', -18446744073709551616, -18446744073709551616, 'hi'); insert('hello', -18446744073709551616, -18446744073709551616, 'hi') hello Warnings: -Error 1292 Truncated incorrect DECIMAL value: '' -Error 1292 Truncated incorrect DECIMAL value: '' +Warning 1292 Truncated incorrect DECIMAL value: '' +Warning 1292 Truncated incorrect DECIMAL value: '' select insert('hello', 18446744073709551616, 18446744073709551616, 'hi'); insert('hello', 18446744073709551616, 18446744073709551616, 'hi') hello Warnings: -Error 1292 Truncated incorrect DECIMAL value: '' -Error 1292 Truncated incorrect DECIMAL value: '' +Warning 1292 Truncated incorrect DECIMAL value: '' +Warning 1292 Truncated incorrect DECIMAL value: '' select insert('hello', -18446744073709551617, -18446744073709551617, 'hi'); insert('hello', -18446744073709551617, -18446744073709551617, 'hi') hello Warnings: -Error 1292 Truncated incorrect DECIMAL value: '' -Error 1292 Truncated incorrect DECIMAL value: '' +Warning 1292 Truncated incorrect DECIMAL value: '' +Warning 1292 Truncated incorrect DECIMAL value: '' select insert('hello', 18446744073709551617, 18446744073709551617, 'hi'); insert('hello', 18446744073709551617, 18446744073709551617, 'hi') hello Warnings: -Error 1292 Truncated incorrect DECIMAL value: '' -Error 1292 Truncated incorrect DECIMAL value: '' +Warning 1292 Truncated incorrect DECIMAL value: '' +Warning 1292 Truncated incorrect DECIMAL value: '' select repeat('hello', -1); repeat('hello', -1) @@ -2038,8 +2038,8 @@ select repeat('hello', -18446744073709551615); repeat('hello', -18446744073709551615) Warnings: -Error 1292 Truncated incorrect DECIMAL value: '' -Error 1292 Truncated incorrect DECIMAL value: '' +Warning 1292 Truncated incorrect DECIMAL value: '' +Warning 1292 Truncated incorrect DECIMAL value: '' select repeat('hello', 18446744073709551615); repeat('hello', 18446744073709551615) NULL @@ -2049,27 +2049,27 @@ select repeat('hello', -18446744073709551616); repeat('hello', -18446744073709551616) Warnings: -Error 1292 Truncated incorrect DECIMAL value: '' -Error 1292 Truncated incorrect DECIMAL value: '' +Warning 1292 Truncated incorrect DECIMAL value: '' +Warning 1292 Truncated incorrect DECIMAL value: '' select repeat('hello', 18446744073709551616); repeat('hello', 18446744073709551616) NULL Warnings: -Error 1292 Truncated incorrect DECIMAL value: '' -Error 1292 Truncated incorrect DECIMAL value: '' +Warning 1292 Truncated incorrect DECIMAL value: '' +Warning 1292 Truncated incorrect DECIMAL value: '' Warning 1301 Result of repeat() was larger than max_allowed_packet (1048576) - truncated select repeat('hello', -18446744073709551617); repeat('hello', -18446744073709551617) Warnings: -Error 1292 Truncated incorrect DECIMAL value: '' -Error 1292 Truncated incorrect DECIMAL value: '' +Warning 1292 Truncated incorrect DECIMAL value: '' +Warning 1292 Truncated incorrect DECIMAL value: '' select repeat('hello', 18446744073709551617); repeat('hello', 18446744073709551617) NULL Warnings: -Error 1292 Truncated incorrect DECIMAL value: '' -Error 1292 Truncated incorrect DECIMAL value: '' +Warning 1292 Truncated incorrect DECIMAL value: '' +Warning 1292 Truncated incorrect DECIMAL value: '' Warning 1301 Result of repeat() was larger than max_allowed_packet (1048576) - truncated select space(-1); space(-1) @@ -2102,8 +2102,8 @@ select space(-18446744073709551615); space(-18446744073709551615) Warnings: -Error 1292 Truncated incorrect DECIMAL value: '' -Error 1292 Truncated incorrect DECIMAL value: '' +Warning 1292 Truncated incorrect DECIMAL value: '' +Warning 1292 Truncated incorrect DECIMAL value: '' select space(18446744073709551615); space(18446744073709551615) NULL @@ -2113,27 +2113,27 @@ select space(-18446744073709551616); space(-18446744073709551616) Warnings: -Error 1292 Truncated incorrect DECIMAL value: '' -Error 1292 Truncated incorrect DECIMAL value: '' +Warning 1292 Truncated incorrect DECIMAL value: '' +Warning 1292 Truncated incorrect DECIMAL value: '' select space(18446744073709551616); space(18446744073709551616) NULL Warnings: -Error 1292 Truncated incorrect DECIMAL value: '' -Error 1292 Truncated incorrect DECIMAL value: '' +Warning 1292 Truncated incorrect DECIMAL value: '' +Warning 1292 Truncated incorrect DECIMAL value: '' Warning 1301 Result of repeat() was larger than max_allowed_packet (1048576) - truncated select space(-18446744073709551617); space(-18446744073709551617) Warnings: -Error 1292 Truncated incorrect DECIMAL value: '' -Error 1292 Truncated incorrect DECIMAL value: '' +Warning 1292 Truncated incorrect DECIMAL value: '' +Warning 1292 Truncated incorrect DECIMAL value: '' select space(18446744073709551617); space(18446744073709551617) NULL Warnings: -Error 1292 Truncated incorrect DECIMAL value: '' -Error 1292 Truncated incorrect DECIMAL value: '' +Warning 1292 Truncated incorrect DECIMAL value: '' +Warning 1292 Truncated incorrect DECIMAL value: '' Warning 1301 Result of repeat() was larger than max_allowed_packet (1048576) - truncated select rpad('hello', -1, '1'); rpad('hello', -1, '1') @@ -2166,8 +2166,8 @@ select rpad('hello', -18446744073709551615, '1'); rpad('hello', -18446744073709551615, '1') NULL Warnings: -Error 1292 Truncated incorrect DECIMAL value: '' -Error 1292 Truncated incorrect DECIMAL value: '' +Warning 1292 Truncated incorrect DECIMAL value: '' +Warning 1292 Truncated incorrect DECIMAL value: '' select rpad('hello', 18446744073709551615, '1'); rpad('hello', 18446744073709551615, '1') NULL @@ -2177,27 +2177,27 @@ select rpad('hello', -18446744073709551616, '1'); rpad('hello', -18446744073709551616, '1') NULL Warnings: -Error 1292 Truncated incorrect DECIMAL value: '' -Error 1292 Truncated incorrect DECIMAL value: '' +Warning 1292 Truncated incorrect DECIMAL value: '' +Warning 1292 Truncated incorrect DECIMAL value: '' select rpad('hello', 18446744073709551616, '1'); rpad('hello', 18446744073709551616, '1') NULL Warnings: -Error 1292 Truncated incorrect DECIMAL value: '' -Error 1292 Truncated incorrect DECIMAL value: '' +Warning 1292 Truncated incorrect DECIMAL value: '' +Warning 1292 Truncated incorrect DECIMAL value: '' Warning 1301 Result of rpad() was larger than max_allowed_packet (1048576) - truncated select rpad('hello', -18446744073709551617, '1'); rpad('hello', -18446744073709551617, '1') NULL Warnings: -Error 1292 Truncated incorrect DECIMAL value: '' -Error 1292 Truncated incorrect DECIMAL value: '' +Warning 1292 Truncated incorrect DECIMAL value: '' +Warning 1292 Truncated incorrect DECIMAL value: '' select rpad('hello', 18446744073709551617, '1'); rpad('hello', 18446744073709551617, '1') NULL Warnings: -Error 1292 Truncated incorrect DECIMAL value: '' -Error 1292 Truncated incorrect DECIMAL value: '' +Warning 1292 Truncated incorrect DECIMAL value: '' +Warning 1292 Truncated incorrect DECIMAL value: '' Warning 1301 Result of rpad() was larger than max_allowed_packet (1048576) - truncated select lpad('hello', -1, '1'); lpad('hello', -1, '1') @@ -2230,8 +2230,8 @@ select lpad('hello', -18446744073709551615, '1'); lpad('hello', -18446744073709551615, '1') NULL Warnings: -Error 1292 Truncated incorrect DECIMAL value: '' -Error 1292 Truncated incorrect DECIMAL value: '' +Warning 1292 Truncated incorrect DECIMAL value: '' +Warning 1292 Truncated incorrect DECIMAL value: '' select lpad('hello', 18446744073709551615, '1'); lpad('hello', 18446744073709551615, '1') NULL @@ -2241,27 +2241,27 @@ select lpad('hello', -18446744073709551616, '1'); lpad('hello', -18446744073709551616, '1') NULL Warnings: -Error 1292 Truncated incorrect DECIMAL value: '' -Error 1292 Truncated incorrect DECIMAL value: '' +Warning 1292 Truncated incorrect DECIMAL value: '' +Warning 1292 Truncated incorrect DECIMAL value: '' select lpad('hello', 18446744073709551616, '1'); lpad('hello', 18446744073709551616, '1') NULL Warnings: -Error 1292 Truncated incorrect DECIMAL value: '' -Error 1292 Truncated incorrect DECIMAL value: '' +Warning 1292 Truncated incorrect DECIMAL value: '' +Warning 1292 Truncated incorrect DECIMAL value: '' Warning 1301 Result of lpad() was larger than max_allowed_packet (1048576) - truncated select lpad('hello', -18446744073709551617, '1'); lpad('hello', -18446744073709551617, '1') NULL Warnings: -Error 1292 Truncated incorrect DECIMAL value: '' -Error 1292 Truncated incorrect DECIMAL value: '' +Warning 1292 Truncated incorrect DECIMAL value: '' +Warning 1292 Truncated incorrect DECIMAL value: '' select lpad('hello', 18446744073709551617, '1'); lpad('hello', 18446744073709551617, '1') NULL Warnings: -Error 1292 Truncated incorrect DECIMAL value: '' -Error 1292 Truncated incorrect DECIMAL value: '' +Warning 1292 Truncated incorrect DECIMAL value: '' +Warning 1292 Truncated incorrect DECIMAL value: '' Warning 1301 Result of lpad() was larger than max_allowed_packet (1048576) - truncated SET @orig_sql_mode = @@SQL_MODE; SET SQL_MODE=traditional; @@ -2269,12 +2269,12 @@ SELECT CHAR(0xff,0x8f USING utf8); CHAR(0xff,0x8f USING utf8) NULL Warnings: -Error 1300 Invalid utf8 character string: 'FF8F' +Warning 1300 Invalid utf8 character string: 'FF8F' SELECT CHAR(0xff,0x8f USING utf8) IS NULL; CHAR(0xff,0x8f USING utf8) IS NULL 1 Warnings: -Error 1300 Invalid utf8 character string: 'FF8F' +Warning 1300 Invalid utf8 character string: 'FF8F' SET SQL_MODE=@orig_sql_mode; select substring('abc', cast(2 as unsigned int)); substring('abc', cast(2 as unsigned int)) diff --git a/mysql-test/r/join_outer.result b/mysql-test/r/join_outer.result index 1e4fc91b8bd..bc77072f67a 100644 --- a/mysql-test/r/join_outer.result +++ b/mysql-test/r/join_outer.result @@ -942,25 +942,29 @@ group_concat(t1.b,t2.c) aaaaa bbbbb Warnings: -Warning 1260 2 line(s) were cut by GROUP_CONCAT() +Warning 1260 Row 1 was cut by GROUP_CONCAT() +Warning 1260 Row 2 was cut by GROUP_CONCAT() select group_concat(t1.b,t2.c) from t1 inner join t2 using(a) group by t1.a; group_concat(t1.b,t2.c) aaaaa bbbbb Warnings: -Warning 1260 2 line(s) were cut by GROUP_CONCAT() +Warning 1260 Row 1 was cut by GROUP_CONCAT() +Warning 1260 Row 2 was cut by GROUP_CONCAT() select group_concat(t1.b,t2.c) from t1 left join t2 using(a) group by a; group_concat(t1.b,t2.c) aaaaa bbbbb Warnings: -Warning 1260 2 line(s) were cut by GROUP_CONCAT() +Warning 1260 Row 1 was cut by GROUP_CONCAT() +Warning 1260 Row 2 was cut by GROUP_CONCAT() select group_concat(t1.b,t2.c) from t1 inner join t2 using(a) group by a; group_concat(t1.b,t2.c) aaaaa bbbbb Warnings: -Warning 1260 2 line(s) were cut by GROUP_CONCAT() +Warning 1260 Row 1 was cut by GROUP_CONCAT() +Warning 1260 Row 2 was cut by GROUP_CONCAT() drop table t1, t2; set group_concat_max_len=default; create table t1 (gid smallint(5) unsigned not null, x int(11) not null, y int(11) not null, art int(11) not null, primary key (gid,x,y)); diff --git a/mysql-test/r/merge.result b/mysql-test/r/merge.result index 893ea5acf88..a2248d3d878 100644 --- a/mysql-test/r/merge.result +++ b/mysql-test/r/merge.result @@ -914,7 +914,7 @@ SELECT * FROM tm1; ERROR HY000: Unable to open underlying table which is differently defined or of non-MyISAM type or doesn't exist CHECK TABLE tm1; Table Op Msg_type Msg_text -test.tm1 check Error Table 'test.t2' is differently defined or of non-MyISAM type or doesn't exist +test.tm1 check Warning Table 'test.t2' is differently defined or of non-MyISAM type or doesn't exist test.tm1 check Error Unable to open underlying table which is differently defined or of non-MyISAM type or doesn't exist test.tm1 check error Corrupt ALTER TABLE t2 MODIFY a INT; diff --git a/mysql-test/r/myisam-system.result b/mysql-test/r/myisam-system.result index e0629d955ae..b3ba8066f5c 100644 --- a/mysql-test/r/myisam-system.result +++ b/mysql-test/r/myisam-system.result @@ -2,7 +2,7 @@ drop table if exists t1,t2; create table t1 (a int) engine=myisam; drop table if exists t1; Warnings: -Error 2 Can't find file: 't1' (errno: 2) +Warning 2 Can't find file: 't1' (errno: 2) create table t1 (a int) engine=myisam; drop table t1; Got one of the listed errors diff --git a/mysql-test/r/partition.result b/mysql-test/r/partition.result index 2d54a66fe11..a76cb2ba225 100644 --- a/mysql-test/r/partition.result +++ b/mysql-test/r/partition.result @@ -1226,7 +1226,6 @@ COMMIT; END| CALL test.p1(12); Warnings: -Note 1051 Unknown table 't1' Warning 1196 Some non-transactional changed tables couldn't be rolled back CALL test.p1(13); Warnings: diff --git a/mysql-test/r/ps.result b/mysql-test/r/ps.result index 1f8a077af40..06e6b8167fd 100644 --- a/mysql-test/r/ps.result +++ b/mysql-test/r/ps.result @@ -2748,17 +2748,21 @@ Warnings: Note 1051 Unknown table 't1' call proc_1(); Level Code Message +Note 1051 Unknown table 't1' drop table if exists t2; Warnings: Note 1051 Unknown table 't2' call proc_1(); Level Code Message +Note 1051 Unknown table 't2' drop table if exists t1, t2; Warnings: Note 1051 Unknown table 't1' Note 1051 Unknown table 't2' call proc_1(); Level Code Message +Note 1051 Unknown table 't1' +Note 1051 Unknown table 't2' drop procedure proc_1; create function func_1() returns int begin show warnings; return 1; end| ERROR 0A000: Not allowed to return a result set from a function diff --git a/mysql-test/r/query_cache.result b/mysql-test/r/query_cache.result index 6cabc24d0eb..89057603c3d 100644 --- a/mysql-test/r/query_cache.result +++ b/mysql-test/r/query_cache.result @@ -889,7 +889,7 @@ select group_concat(a) FROM t1 group by b; group_concat(a) 1234567890 Warnings: -Warning 1260 1 line(s) were cut by GROUP_CONCAT() +Warning 1260 Row 1 was cut by GROUP_CONCAT() set group_concat_max_len=1024; select group_concat(a) FROM t1 group by b; group_concat(a) @@ -992,19 +992,19 @@ COUNT(*) 0 Warnings: Warning 1292 Incorrect datetime value: '20050327 invalid' for column 'date' at row 1 -Warning 1292 Incorrect datetime value: '20050327 invalid' for column 'date' at row 0 +Warning 1292 Incorrect datetime value: '20050327 invalid' for column 'date' at row 1 SELECT COUNT(*) FROM t1 WHERE date BETWEEN '20050326' AND '20050328 invalid'; COUNT(*) 0 Warnings: Warning 1292 Incorrect datetime value: '20050328 invalid' for column 'date' at row 1 -Warning 1292 Incorrect datetime value: '20050328 invalid' for column 'date' at row 0 +Warning 1292 Incorrect datetime value: '20050328 invalid' for column 'date' at row 1 SELECT COUNT(*) FROM t1 WHERE date BETWEEN '20050326' AND '20050327 invalid'; COUNT(*) 0 Warnings: Warning 1292 Incorrect datetime value: '20050327 invalid' for column 'date' at row 1 -Warning 1292 Incorrect datetime value: '20050327 invalid' for column 'date' at row 0 +Warning 1292 Incorrect datetime value: '20050327 invalid' for column 'date' at row 1 show status like "Qcache_queries_in_cache"; Variable_name Value Qcache_queries_in_cache 0 diff --git a/mysql-test/r/signal.result b/mysql-test/r/signal.result new file mode 100644 index 00000000000..56140733c33 --- /dev/null +++ b/mysql-test/r/signal.result @@ -0,0 +1,2362 @@ +# +# PART 1: syntax +# +# +# Test every new reserved and non reserved keywords +# +drop table if exists signal_non_reserved; +create table signal_non_reserved ( +class_origin int, +subclass_origin int, +constraint_catalog int, +constraint_schema int, +constraint_name int, +catalog_name int, +schema_name int, +table_name int, +column_name int, +cursor_name int, +message_text int, +sqlcode int +); +drop table signal_non_reserved; +drop table if exists diag_non_reserved; +create table diag_non_reserved ( +diagnostics int, +current int, +stacked int, +exception int +); +drop table diag_non_reserved; +drop table if exists diag_cond_non_reserved; +create table diag_cond_non_reserved ( +condition_identifier int, +condition_number int, +condition_name int, +connection_name int, +message_length int, +message_octet_length int, +parameter_mode int, +parameter_name int, +parameter_ordinal_position int, +returned_sqlstate int, +routine_catalog int, +routine_name int, +routine_schema int, +server_name int, +specific_name int, +trigger_catalog int, +trigger_name int, +trigger_schema int +); +drop table diag_cond_non_reserved; +drop table if exists diag_stmt_non_reserved; +create table diag_stmt_non_reserved ( +number int, +more int, +command_function int, +command_function_code int, +dynamic_function int, +dynamic_function_code int, +row_count int, +transactions_committed int, +transactions_rolled_back int, +transaction_active int +); +drop table diag_stmt_non_reserved; +drop table if exists test_reserved; +create table test_reserved (signal int); +ERROR 42000: You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near 'signal int)' at line 1 +create table test_reserved (resignal int); +ERROR 42000: You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near 'resignal int)' at line 1 +create table test_reserved (condition int); +ERROR 42000: You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near 'condition int)' at line 1 +# +# Test the SIGNAL syntax +# +drop procedure if exists test_invalid; +drop procedure if exists test_signal_syntax; +drop function if exists test_signal_func; +create procedure test_invalid() +begin +SIGNAL; +end $$ +ERROR 42000: You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near '; +end' at line 3 +create procedure test_invalid() +begin +SIGNAL foo; +end $$ +ERROR 42000: Undefined CONDITION: foo +create procedure test_invalid() +begin +DECLARE foo CONDITION FOR 1234; +SIGNAL foo; +end $$ +ERROR HY000: SIGNAL/RESIGNAL can only use a CONDITION defined with SQLSTATE +create procedure test_signal_syntax() +begin +DECLARE foo CONDITION FOR SQLSTATE '12345'; +SIGNAL foo; +end $$ +drop procedure test_signal_syntax $$ +create procedure test_signal_syntax() +begin +SIGNAL SQLSTATE '23000'; +end $$ +drop procedure test_signal_syntax $$ +create procedure test_signal_syntax() +begin +SIGNAL SQLSTATE VALUE '23000'; +end $$ +drop procedure test_signal_syntax $$ +create procedure test_signal_syntax() +begin +DECLARE foo CONDITION FOR SQLSTATE '12345'; +SIGNAL foo SET CLASS_ORIGIN = 'foo'; +end $$ +drop procedure test_signal_syntax $$ +create procedure test_signal_syntax() +begin +DECLARE foo CONDITION FOR SQLSTATE '12345'; +SIGNAL foo SET SUBCLASS_ORIGIN = 'foo'; +end $$ +drop procedure test_signal_syntax $$ +create procedure test_signal_syntax() +begin +DECLARE foo CONDITION FOR SQLSTATE '12345'; +SIGNAL foo SET CONSTRAINT_CATALOG = 'foo'; +end $$ +drop procedure test_signal_syntax $$ +create procedure test_signal_syntax() +begin +DECLARE foo CONDITION FOR SQLSTATE '12345'; +SIGNAL foo SET CONSTRAINT_SCHEMA = 'foo'; +end $$ +drop procedure test_signal_syntax $$ +create procedure test_signal_syntax() +begin +DECLARE foo CONDITION FOR SQLSTATE '12345'; +SIGNAL foo SET CONSTRAINT_NAME = 'foo'; +end $$ +drop procedure test_signal_syntax $$ +create procedure test_signal_syntax() +begin +DECLARE foo CONDITION FOR SQLSTATE '12345'; +SIGNAL foo SET CATALOG_NAME = 'foo'; +end $$ +drop procedure test_signal_syntax $$ +create procedure test_signal_syntax() +begin +DECLARE foo CONDITION FOR SQLSTATE '12345'; +SIGNAL foo SET SCHEMA_NAME = 'foo'; +end $$ +drop procedure test_signal_syntax $$ +create procedure test_signal_syntax() +begin +DECLARE foo CONDITION FOR SQLSTATE '12345'; +SIGNAL foo SET TABLE_NAME = 'foo'; +end $$ +drop procedure test_signal_syntax $$ +create procedure test_signal_syntax() +begin +DECLARE foo CONDITION FOR SQLSTATE '12345'; +SIGNAL foo SET COLUMN_NAME = 'foo'; +end $$ +drop procedure test_signal_syntax $$ +create procedure test_signal_syntax() +begin +DECLARE foo CONDITION FOR SQLSTATE '12345'; +SIGNAL foo SET CURSOR_NAME = 'foo'; +end $$ +drop procedure test_signal_syntax $$ +create procedure test_signal_syntax() +begin +DECLARE foo CONDITION FOR SQLSTATE '12345'; +SIGNAL foo SET MESSAGE_TEXT = 'foo'; +end $$ +drop procedure test_signal_syntax $$ +create procedure test_signal_syntax() +begin +DECLARE foo CONDITION FOR SQLSTATE '12345'; +SIGNAL foo SET MYSQL_ERRNO = 'foo'; +end $$ +drop procedure test_signal_syntax $$ +create procedure test_invalid() +begin +DECLARE foo CONDITION FOR SQLSTATE '12345'; +SIGNAL foo SET CLASS_ORIGIN = 'foo', CLASS_ORIGIN = 'bar'; +end $$ +ERROR 42000: Duplicate condition information item 'CLASS_ORIGIN' +create procedure test_invalid() +begin +DECLARE foo CONDITION FOR SQLSTATE '12345'; +SIGNAL foo SET MESSAGE_TEXT = 'foo', MESSAGE_TEXT = 'bar'; +end $$ +ERROR 42000: Duplicate condition information item 'MESSAGE_TEXT' +create procedure test_invalid() +begin +DECLARE foo CONDITION FOR SQLSTATE '12345'; +SIGNAL foo SET MYSQL_ERRNO = 'foo', MYSQL_ERRNO = 'bar'; +end $$ +ERROR 42000: Duplicate condition information item 'MYSQL_ERRNO' +create procedure test_signal_syntax() +begin +DECLARE foo CONDITION FOR SQLSTATE '12345'; +SIGNAL foo SET +CLASS_ORIGIN = 'foo', +SUBCLASS_ORIGIN = 'foo', +CONSTRAINT_CATALOG = 'foo', +CONSTRAINT_SCHEMA = 'foo', +CONSTRAINT_NAME = 'foo', +CATALOG_NAME = 'foo', +SCHEMA_NAME = 'foo', +TABLE_NAME = 'foo', +COLUMN_NAME = 'foo', +CURSOR_NAME = 'foo', +MESSAGE_TEXT = 'foo', +MYSQL_ERRNO = 'foo'; +end $$ +drop procedure test_signal_syntax $$ +SIGNAL SQLSTATE '00000' $$ +ERROR 42000: Bad SQLSTATE: '00000' +SIGNAL SQLSTATE '00001' $$ +ERROR 42000: Bad SQLSTATE: '00001' +create procedure test_invalid() +begin +SIGNAL SQLSTATE '00000'; +end $$ +ERROR 42000: Bad SQLSTATE: '00000' +create procedure test_invalid() +begin +SIGNAL SQLSTATE '00001'; +end $$ +ERROR 42000: Bad SQLSTATE: '00001' +# +# Test conditions information that SIGNAL can not set +# +create procedure test_invalid() +begin +SIGNAL SQLSTATE '12345' SET bla_bla = 'foo'; +end $$ +ERROR 42000: You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near 'bla_bla = 'foo'; +end' at line 3 +create procedure test_invalid() +begin +SIGNAL SQLSTATE '12345' SET CONDITION_IDENTIFIER = 'foo'; +end $$ +ERROR 42000: You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near 'CONDITION_IDENTIFIER = 'foo'; +end' at line 3 +create procedure test_invalid() +begin +SIGNAL SQLSTATE '12345' SET CONDITION_NUMBER = 'foo'; +end $$ +ERROR 42000: You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near 'CONDITION_NUMBER = 'foo'; +end' at line 3 +create procedure test_invalid() +begin +SIGNAL SQLSTATE '12345' SET CONNECTION_NAME = 'foo'; +end $$ +ERROR 42000: You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near 'CONNECTION_NAME = 'foo'; +end' at line 3 +create procedure test_invalid() +begin +SIGNAL SQLSTATE '12345' SET MESSAGE_LENGTH = 'foo'; +end $$ +ERROR 42000: You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near 'MESSAGE_LENGTH = 'foo'; +end' at line 3 +create procedure test_invalid() +begin +SIGNAL SQLSTATE '12345' SET MESSAGE_OCTET_LENGTH = 'foo'; +end $$ +ERROR 42000: You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near 'MESSAGE_OCTET_LENGTH = 'foo'; +end' at line 3 +create procedure test_invalid() +begin +SIGNAL SQLSTATE '12345' SET PARAMETER_MODE = 'foo'; +end $$ +ERROR 42000: You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near 'PARAMETER_MODE = 'foo'; +end' at line 3 +create procedure test_invalid() +begin +SIGNAL SQLSTATE '12345' SET PARAMETER_NAME = 'foo'; +end $$ +ERROR 42000: You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near 'PARAMETER_NAME = 'foo'; +end' at line 3 +create procedure test_invalid() +begin +SIGNAL SQLSTATE '12345' SET PARAMETER_ORDINAL_POSITION = 'foo'; +end $$ +ERROR 42000: You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near 'PARAMETER_ORDINAL_POSITION = 'foo'; +end' at line 3 +create procedure test_invalid() +begin +SIGNAL SQLSTATE '12345' SET RETURNED_SQLSTATE = 'foo'; +end $$ +ERROR 42000: You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near 'RETURNED_SQLSTATE = 'foo'; +end' at line 3 +create procedure test_invalid() +begin +SIGNAL SQLSTATE '12345' SET ROUTINE_CATALOG = 'foo'; +end $$ +ERROR 42000: You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near 'ROUTINE_CATALOG = 'foo'; +end' at line 3 +create procedure test_invalid() +begin +SIGNAL SQLSTATE '12345' SET ROUTINE_NAME = 'foo'; +end $$ +ERROR 42000: You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near 'ROUTINE_NAME = 'foo'; +end' at line 3 +create procedure test_invalid() +begin +SIGNAL SQLSTATE '12345' SET ROUTINE_SCHEMA = 'foo'; +end $$ +ERROR 42000: You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near 'ROUTINE_SCHEMA = 'foo'; +end' at line 3 +create procedure test_invalid() +begin +SIGNAL SQLSTATE '12345' SET SERVER_NAME = 'foo'; +end $$ +ERROR 42000: You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near 'SERVER_NAME = 'foo'; +end' at line 3 +create procedure test_invalid() +begin +SIGNAL SQLSTATE '12345' SET SPECIFIC_NAME = 'foo'; +end $$ +ERROR 42000: You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near 'SPECIFIC_NAME = 'foo'; +end' at line 3 +create procedure test_invalid() +begin +SIGNAL SQLSTATE '12345' SET TRIGGER_CATALOG = 'foo'; +end $$ +ERROR 42000: You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near 'TRIGGER_CATALOG = 'foo'; +end' at line 3 +create procedure test_invalid() +begin +SIGNAL SQLSTATE '12345' SET TRIGGER_NAME = 'foo'; +end $$ +ERROR 42000: You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near 'TRIGGER_NAME = 'foo'; +end' at line 3 +create procedure test_invalid() +begin +SIGNAL SQLSTATE '12345' SET TRIGGER_SCHEMA = 'foo'; +end $$ +ERROR 42000: You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near 'TRIGGER_SCHEMA = 'foo'; +end' at line 3 +# +# Test the RESIGNAL syntax +# +drop procedure if exists test_invalid; +drop procedure if exists test_resignal_syntax; +create procedure test_invalid() +begin +RESIGNAL foo; +end $$ +ERROR 42000: Undefined CONDITION: foo +create procedure test_resignal_syntax() +begin +RESIGNAL; +end $$ +drop procedure test_resignal_syntax $$ +create procedure test_invalid() +begin +DECLARE foo CONDITION FOR 1234; +RESIGNAL foo; +end $$ +ERROR HY000: SIGNAL/RESIGNAL can only use a CONDITION defined with SQLSTATE +create procedure test_resignal_syntax() +begin +DECLARE foo CONDITION FOR SQLSTATE '12345'; +RESIGNAL foo; +end $$ +drop procedure test_resignal_syntax $$ +create procedure test_resignal_syntax() +begin +RESIGNAL SQLSTATE '23000'; +end $$ +drop procedure test_resignal_syntax $$ +create procedure test_resignal_syntax() +begin +RESIGNAL SQLSTATE VALUE '23000'; +end $$ +drop procedure test_resignal_syntax $$ +create procedure test_resignal_syntax() +begin +RESIGNAL SET CLASS_ORIGIN = 'foo'; +end $$ +drop procedure test_resignal_syntax $$ +create procedure test_resignal_syntax() +begin +DECLARE foo CONDITION FOR SQLSTATE '12345'; +RESIGNAL foo SET CLASS_ORIGIN = 'foo'; +end $$ +drop procedure test_resignal_syntax $$ +create procedure test_resignal_syntax() +begin +RESIGNAL SET SUBCLASS_ORIGIN = 'foo'; +end $$ +drop procedure test_resignal_syntax $$ +create procedure test_resignal_syntax() +begin +DECLARE foo CONDITION FOR SQLSTATE '12345'; +RESIGNAL foo SET SUBCLASS_ORIGIN = 'foo'; +end $$ +drop procedure test_resignal_syntax $$ +create procedure test_resignal_syntax() +begin +RESIGNAL SET CONSTRAINT_CATALOG = 'foo'; +end $$ +drop procedure test_resignal_syntax $$ +create procedure test_resignal_syntax() +begin +DECLARE foo CONDITION FOR SQLSTATE '12345'; +RESIGNAL foo SET CONSTRAINT_CATALOG = 'foo'; +end $$ +drop procedure test_resignal_syntax $$ +create procedure test_resignal_syntax() +begin +RESIGNAL SET CONSTRAINT_SCHEMA = 'foo'; +end $$ +drop procedure test_resignal_syntax $$ +create procedure test_resignal_syntax() +begin +DECLARE foo CONDITION FOR SQLSTATE '12345'; +RESIGNAL foo SET CONSTRAINT_SCHEMA = 'foo'; +end $$ +drop procedure test_resignal_syntax $$ +create procedure test_resignal_syntax() +begin +RESIGNAL SET CONSTRAINT_NAME = 'foo'; +end $$ +drop procedure test_resignal_syntax $$ +create procedure test_resignal_syntax() +begin +DECLARE foo CONDITION FOR SQLSTATE '12345'; +RESIGNAL foo SET CONSTRAINT_NAME = 'foo'; +end $$ +drop procedure test_resignal_syntax $$ +create procedure test_resignal_syntax() +begin +RESIGNAL SET CATALOG_NAME = 'foo'; +end $$ +drop procedure test_resignal_syntax $$ +create procedure test_resignal_syntax() +begin +DECLARE foo CONDITION FOR SQLSTATE '12345'; +RESIGNAL foo SET CATALOG_NAME = 'foo'; +end $$ +drop procedure test_resignal_syntax $$ +create procedure test_resignal_syntax() +begin +RESIGNAL SET SCHEMA_NAME = 'foo'; +end $$ +drop procedure test_resignal_syntax $$ +create procedure test_resignal_syntax() +begin +DECLARE foo CONDITION FOR SQLSTATE '12345'; +RESIGNAL foo SET SCHEMA_NAME = 'foo'; +end $$ +drop procedure test_resignal_syntax $$ +create procedure test_resignal_syntax() +begin +RESIGNAL SET TABLE_NAME = 'foo'; +end $$ +drop procedure test_resignal_syntax $$ +create procedure test_resignal_syntax() +begin +DECLARE foo CONDITION FOR SQLSTATE '12345'; +RESIGNAL foo SET TABLE_NAME = 'foo'; +end $$ +drop procedure test_resignal_syntax $$ +create procedure test_resignal_syntax() +begin +RESIGNAL SET COLUMN_NAME = 'foo'; +end $$ +drop procedure test_resignal_syntax $$ +create procedure test_resignal_syntax() +begin +DECLARE foo CONDITION FOR SQLSTATE '12345'; +RESIGNAL foo SET COLUMN_NAME = 'foo'; +end $$ +drop procedure test_resignal_syntax $$ +create procedure test_resignal_syntax() +begin +RESIGNAL SET CURSOR_NAME = 'foo'; +end $$ +drop procedure test_resignal_syntax $$ +create procedure test_resignal_syntax() +begin +DECLARE foo CONDITION FOR SQLSTATE '12345'; +RESIGNAL foo SET CURSOR_NAME = 'foo'; +end $$ +drop procedure test_resignal_syntax $$ +create procedure test_resignal_syntax() +begin +RESIGNAL SET MESSAGE_TEXT = 'foo'; +end $$ +drop procedure test_resignal_syntax $$ +create procedure test_resignal_syntax() +begin +DECLARE foo CONDITION FOR SQLSTATE '12345'; +RESIGNAL foo SET MESSAGE_TEXT = 'foo'; +end $$ +drop procedure test_resignal_syntax $$ +create procedure test_resignal_syntax() +begin +RESIGNAL SET MYSQL_ERRNO = 'foo'; +end $$ +drop procedure test_resignal_syntax $$ +create procedure test_resignal_syntax() +begin +DECLARE foo CONDITION FOR SQLSTATE '12345'; +RESIGNAL foo SET MYSQL_ERRNO = 'foo'; +end $$ +drop procedure test_resignal_syntax $$ +create procedure test_invalid() +begin +DECLARE foo CONDITION FOR SQLSTATE '12345'; +RESIGNAL foo SET CLASS_ORIGIN = 'foo', CLASS_ORIGIN = 'bar'; +end $$ +ERROR 42000: Duplicate condition information item 'CLASS_ORIGIN' +create procedure test_invalid() +begin +DECLARE foo CONDITION FOR SQLSTATE '12345'; +RESIGNAL foo SET MESSAGE_TEXT = 'foo', MESSAGE_TEXT = 'bar'; +end $$ +ERROR 42000: Duplicate condition information item 'MESSAGE_TEXT' +create procedure test_invalid() +begin +DECLARE foo CONDITION FOR SQLSTATE '12345'; +RESIGNAL foo SET MYSQL_ERRNO = 'foo', MYSQL_ERRNO = 'bar'; +end $$ +ERROR 42000: Duplicate condition information item 'MYSQL_ERRNO' +create procedure test_resignal_syntax() +begin +DECLARE foo CONDITION FOR SQLSTATE '12345'; +RESIGNAL foo SET +CLASS_ORIGIN = 'foo', +SUBCLASS_ORIGIN = 'foo', +CONSTRAINT_CATALOG = 'foo', +CONSTRAINT_SCHEMA = 'foo', +CONSTRAINT_NAME = 'foo', +CATALOG_NAME = 'foo', +SCHEMA_NAME = 'foo', +TABLE_NAME = 'foo', +COLUMN_NAME = 'foo', +CURSOR_NAME = 'foo', +MESSAGE_TEXT = 'foo'; +end $$ +drop procedure test_resignal_syntax $$ +create procedure test_invalid() +begin +RESIGNAL SQLSTATE '00000'; +end $$ +ERROR 42000: Bad SQLSTATE: '00000' +create procedure test_invalid() +begin +RESIGNAL SQLSTATE '00001'; +end $$ +ERROR 42000: Bad SQLSTATE: '00001' +# +# PART 2: non preparable statements +# +prepare stmt from 'SIGNAL SQLSTATE \'23000\''; +ERROR HY000: This command is not supported in the prepared statement protocol yet +prepare stmt from 'RESIGNAL SQLSTATE \'23000\''; +ERROR HY000: This command is not supported in the prepared statement protocol yet +# +# PART 3: runtime execution +# +drop procedure if exists test_signal; +drop procedure if exists test_resignal; +drop table if exists t_warn; +drop table if exists t_cursor; +create table t_warn(a integer(2)); +create table t_cursor(a integer); +# +# SIGNAL can also appear in a query +# +SIGNAL foo; +ERROR 42000: Undefined CONDITION: foo +SIGNAL SQLSTATE '01000'; +Warnings: +Warning 1640 Unhandled user-defined warning condition +SIGNAL SQLSTATE '02000'; +ERROR 02000: Unhandled user-defined not found condition +SIGNAL SQLSTATE '23000'; +ERROR 23000: Unhandled user-defined exception condition +SIGNAL SQLSTATE VALUE '23000'; +ERROR 23000: Unhandled user-defined exception condition +SIGNAL SQLSTATE 'HY000' SET MYSQL_ERRNO = 65536; +ERROR 42000: Variable 'MYSQL_ERRNO' can't be set to the value of '65536' +SIGNAL SQLSTATE 'HY000' SET MYSQL_ERRNO = 99999; +ERROR 42000: Variable 'MYSQL_ERRNO' can't be set to the value of '99999' +SIGNAL SQLSTATE 'HY000' SET MYSQL_ERRNO = 4294967295; +ERROR 42000: Variable 'MYSQL_ERRNO' can't be set to the value of '4294967295' +SIGNAL SQLSTATE 'HY000' SET MYSQL_ERRNO = 0; +ERROR 42000: Variable 'MYSQL_ERRNO' can't be set to the value of '0' +SIGNAL SQLSTATE 'HY000' SET MYSQL_ERRNO = -1; +ERROR 42000: You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near '-1' at line 1 +SIGNAL SQLSTATE 'HY000' SET MYSQL_ERRNO = 65535; +ERROR HY000: Unhandled user-defined exception condition +# +# RESIGNAL can also appear in a query +# +RESIGNAL; +ERROR 0K000: RESIGNAL when handler not active +RESIGNAL foo; +ERROR 42000: Undefined CONDITION: foo +RESIGNAL SQLSTATE '12345'; +ERROR 0K000: RESIGNAL when handler not active +RESIGNAL SQLSTATE VALUE '12345'; +ERROR 0K000: RESIGNAL when handler not active +# +# Different kind of SIGNAL conditions +# +create procedure test_signal() +begin +# max range +DECLARE foo CONDITION FOR SQLSTATE 'AABBB'; +SIGNAL foo SET MYSQL_ERRNO = 65535; +end $$ +call test_signal() $$ +ERROR AABBB: Unhandled user-defined exception condition +drop procedure test_signal $$ +create procedure test_signal() +begin +# max range +DECLARE foo CONDITION FOR SQLSTATE 'AABBB'; +SIGNAL foo SET MYSQL_ERRNO = 65536; +end $$ +call test_signal() $$ +ERROR 42000: Variable 'MYSQL_ERRNO' can't be set to the value of '65536' +drop procedure test_signal $$ +create procedure test_signal() +begin +# Error +DECLARE foo CONDITION FOR SQLSTATE '99999'; +SIGNAL foo SET MYSQL_ERRNO = 9999; +end $$ +call test_signal() $$ +ERROR 99999: Unhandled user-defined exception condition +drop procedure test_signal $$ +create procedure test_signal() +begin +# warning +DECLARE too_few_records CONDITION FOR SQLSTATE '01000'; +SIGNAL too_few_records SET MYSQL_ERRNO = 1261; +end $$ +call test_signal() $$ +Warnings: +Warning 1261 Unhandled user-defined warning condition +drop procedure test_signal $$ +create procedure test_signal() +begin +# Not found +DECLARE sp_fetch_no_data CONDITION FOR SQLSTATE '02000'; +SIGNAL sp_fetch_no_data SET MYSQL_ERRNO = 1329; +end $$ +call test_signal() $$ +ERROR 02000: Unhandled user-defined not found condition +drop procedure test_signal $$ +create procedure test_signal() +begin +# Error +DECLARE sp_cursor_already_open CONDITION FOR SQLSTATE '24000'; +SIGNAL sp_cursor_already_open SET MYSQL_ERRNO = 1325; +end $$ +call test_signal() $$ +ERROR 24000: Unhandled user-defined exception condition +drop procedure test_signal $$ +create procedure test_signal() +begin +# Severe error +DECLARE lock_deadlock CONDITION FOR SQLSTATE '40001'; +SIGNAL lock_deadlock SET MYSQL_ERRNO = 1213; +end $$ +call test_signal() $$ +ERROR 40001: Unhandled user-defined exception condition +drop procedure test_signal $$ +create procedure test_signal() +begin +# Unknown -> error +DECLARE foo CONDITION FOR SQLSTATE "99999"; +SIGNAL foo; +end $$ +call test_signal() $$ +ERROR 99999: Unhandled user-defined exception condition +drop procedure test_signal $$ +create procedure test_signal() +begin +# warning, no subclass +DECLARE warn CONDITION FOR SQLSTATE "01000"; +SIGNAL warn; +end $$ +call test_signal() $$ +Warnings: +Warning 1640 Unhandled user-defined warning condition +drop procedure test_signal $$ +create procedure test_signal() +begin +# warning, with subclass +DECLARE warn CONDITION FOR SQLSTATE "01123"; +SIGNAL warn; +end $$ +call test_signal() $$ +Warnings: +Warning 1640 Unhandled user-defined warning condition +drop procedure test_signal $$ +create procedure test_signal() +begin +# Not found, no subclass +DECLARE not_found CONDITION FOR SQLSTATE "02000"; +SIGNAL not_found; +end $$ +call test_signal() $$ +ERROR 02000: Unhandled user-defined not found condition +drop procedure test_signal $$ +create procedure test_signal() +begin +# Not found, with subclass +DECLARE not_found CONDITION FOR SQLSTATE "02XXX"; +SIGNAL not_found; +end $$ +call test_signal() $$ +ERROR 02XXX: Unhandled user-defined not found condition +drop procedure test_signal $$ +create procedure test_signal() +begin +# Error, no subclass +DECLARE error CONDITION FOR SQLSTATE "12000"; +SIGNAL error; +end $$ +call test_signal() $$ +ERROR 12000: Unhandled user-defined exception condition +drop procedure test_signal $$ +create procedure test_signal() +begin +# Error, with subclass +DECLARE error CONDITION FOR SQLSTATE "12ABC"; +SIGNAL error; +end $$ +call test_signal() $$ +ERROR 12ABC: Unhandled user-defined exception condition +drop procedure test_signal $$ +create procedure test_signal() +begin +# Severe error, no subclass +DECLARE error CONDITION FOR SQLSTATE "40000"; +SIGNAL error; +end $$ +call test_signal() $$ +ERROR 40000: Unhandled user-defined exception condition +drop procedure test_signal $$ +create procedure test_signal() +begin +# Severe error, with subclass +DECLARE error CONDITION FOR SQLSTATE "40001"; +SIGNAL error; +end $$ +call test_signal() $$ +ERROR 40001: Unhandled user-defined exception condition +drop procedure test_signal $$ +# +# Test the scope of condition +# +create procedure test_signal() +begin +DECLARE foo CONDITION FOR SQLSTATE '99999'; +begin +DECLARE foo CONDITION FOR 8888; +end; +SIGNAL foo SET MYSQL_ERRNO=9999; /* outer */ +end $$ +call test_signal() $$ +ERROR 99999: Unhandled user-defined exception condition +drop procedure test_signal $$ +create procedure test_signal() +begin +DECLARE foo CONDITION FOR 9999; +begin +DECLARE foo CONDITION FOR SQLSTATE '88888'; +SIGNAL foo SET MYSQL_ERRNO=8888; /* inner */ +end; +end $$ +call test_signal() $$ +ERROR 88888: Unhandled user-defined exception condition +drop procedure test_signal $$ +# +# Test SET MYSQL_ERRNO +# +create procedure test_signal() +begin +DECLARE foo CONDITION FOR SQLSTATE '99999'; +SIGNAL foo SET MYSQL_ERRNO = 1111; +end $$ +call test_signal() $$ +ERROR 99999: Unhandled user-defined exception condition +drop procedure test_signal $$ +create procedure test_signal() +begin +DECLARE warn CONDITION FOR SQLSTATE "01000"; +SIGNAL warn SET MYSQL_ERRNO = 1111; +end $$ +call test_signal() $$ +Warnings: +Warning 1111 Unhandled user-defined warning condition +drop procedure test_signal $$ +create procedure test_signal() +begin +DECLARE not_found CONDITION FOR SQLSTATE "02000"; +SIGNAL not_found SET MYSQL_ERRNO = 1111; +end $$ +call test_signal() $$ +ERROR 02000: Unhandled user-defined not found condition +drop procedure test_signal $$ +create procedure test_signal() +begin +DECLARE error CONDITION FOR SQLSTATE "55000"; +SIGNAL error SET MYSQL_ERRNO = 1111; +end $$ +call test_signal() $$ +ERROR 55000: Unhandled user-defined exception condition +drop procedure test_signal $$ +# +# Test SET MESSAGE_TEXT +# +SIGNAL SQLSTATE '77777' SET MESSAGE_TEXT='' $$ +ERROR 77777: +create procedure test_signal() +begin +DECLARE foo CONDITION FOR SQLSTATE '77777'; +SIGNAL foo SET +MESSAGE_TEXT = "", +MYSQL_ERRNO=5678; +end $$ +call test_signal() $$ +ERROR 77777: +drop procedure test_signal $$ +create procedure test_signal() +begin +DECLARE foo CONDITION FOR SQLSTATE '99999'; +SIGNAL foo SET +MESSAGE_TEXT = "Something bad happened", +MYSQL_ERRNO=9999; +end $$ +call test_signal() $$ +ERROR 99999: Something bad happened +drop procedure test_signal $$ +create procedure test_signal() +begin +DECLARE warn CONDITION FOR SQLSTATE "01000"; +SIGNAL warn SET MESSAGE_TEXT = "Something bad happened"; +end $$ +call test_signal() $$ +Warnings: +Warning 1640 Something bad happened +drop procedure test_signal $$ +create procedure test_signal() +begin +DECLARE not_found CONDITION FOR SQLSTATE "02000"; +SIGNAL not_found SET MESSAGE_TEXT = "Something bad happened"; +end $$ +call test_signal() $$ +ERROR 02000: Something bad happened +drop procedure test_signal $$ +create procedure test_signal() +begin +DECLARE error CONDITION FOR SQLSTATE "55000"; +SIGNAL error SET MESSAGE_TEXT = "Something bad happened"; +end $$ +call test_signal() $$ +ERROR 55000: Something bad happened +drop procedure test_signal $$ +create procedure test_signal() +begin +DECLARE something CONDITION FOR SQLSTATE "01000"; +SIGNAL something SET MESSAGE_TEXT = _utf8 "This is a UTF8 text"; +end $$ +call test_signal() $$ +Warnings: +Warning 1640 This is a UTF8 text +drop procedure test_signal $$ +create procedure test_signal() +begin +DECLARE something CONDITION FOR SQLSTATE "01000"; +SIGNAL something SET MESSAGE_TEXT = ""; +end $$ +call test_signal() $$ +Warnings: +Warning 1640 +drop procedure test_signal $$ +create procedure test_signal() +begin +DECLARE warn CONDITION FOR SQLSTATE "01111"; +SIGNAL warn SET MESSAGE_TEXT = "á a"; +end $$ +call test_signal() $$ +Warnings: +Warning 1640 á a +show warnings $$ +Level Code Message +Warning 1640 á a +drop procedure test_signal $$ +# +# Test SET complex expressions +# +create procedure test_signal() +begin +DECLARE error CONDITION FOR SQLSTATE '99999'; +SIGNAL error SET +MYSQL_ERRNO = NULL; +end $$ +call test_signal() $$ +ERROR 42000: Variable 'MYSQL_ERRNO' can't be set to the value of 'NULL' +drop procedure test_signal $$ +create procedure test_signal() +begin +DECLARE error CONDITION FOR SQLSTATE '99999'; +SIGNAL error SET +CLASS_ORIGIN = NULL; +end $$ +call test_signal() $$ +ERROR 42000: Variable 'CLASS_ORIGIN' can't be set to the value of 'NULL' +drop procedure test_signal $$ +create procedure test_signal() +begin +DECLARE error CONDITION FOR SQLSTATE '99999'; +SIGNAL error SET +SUBCLASS_ORIGIN = NULL; +end $$ +call test_signal() $$ +ERROR 42000: Variable 'SUBCLASS_ORIGIN' can't be set to the value of 'NULL' +drop procedure test_signal $$ +create procedure test_signal() +begin +DECLARE error CONDITION FOR SQLSTATE '99999'; +SIGNAL error SET +CONSTRAINT_CATALOG = NULL; +end $$ +call test_signal() $$ +ERROR 42000: Variable 'CONSTRAINT_CATALOG' can't be set to the value of 'NULL' +drop procedure test_signal $$ +create procedure test_signal() +begin +DECLARE error CONDITION FOR SQLSTATE '99999'; +SIGNAL error SET +CONSTRAINT_SCHEMA = NULL; +end $$ +call test_signal() $$ +ERROR 42000: Variable 'CONSTRAINT_SCHEMA' can't be set to the value of 'NULL' +drop procedure test_signal $$ +create procedure test_signal() +begin +DECLARE error CONDITION FOR SQLSTATE '99999'; +SIGNAL error SET +CONSTRAINT_NAME = NULL; +end $$ +call test_signal() $$ +ERROR 42000: Variable 'CONSTRAINT_NAME' can't be set to the value of 'NULL' +drop procedure test_signal $$ +create procedure test_signal() +begin +DECLARE error CONDITION FOR SQLSTATE '99999'; +SIGNAL error SET +CATALOG_NAME = NULL; +end $$ +call test_signal() $$ +ERROR 42000: Variable 'CATALOG_NAME' can't be set to the value of 'NULL' +drop procedure test_signal $$ +create procedure test_signal() +begin +DECLARE error CONDITION FOR SQLSTATE '99999'; +SIGNAL error SET +SCHEMA_NAME = NULL; +end $$ +call test_signal() $$ +ERROR 42000: Variable 'SCHEMA_NAME' can't be set to the value of 'NULL' +drop procedure test_signal $$ +create procedure test_signal() +begin +DECLARE error CONDITION FOR SQLSTATE '99999'; +SIGNAL error SET +TABLE_NAME = NULL; +end $$ +call test_signal() $$ +ERROR 42000: Variable 'TABLE_NAME' can't be set to the value of 'NULL' +drop procedure test_signal $$ +create procedure test_signal() +begin +DECLARE error CONDITION FOR SQLSTATE '99999'; +SIGNAL error SET +COLUMN_NAME = NULL; +end $$ +call test_signal() $$ +ERROR 42000: Variable 'COLUMN_NAME' can't be set to the value of 'NULL' +drop procedure test_signal $$ +create procedure test_signal() +begin +DECLARE error CONDITION FOR SQLSTATE '99999'; +SIGNAL error SET +CURSOR_NAME = NULL; +end $$ +call test_signal() $$ +ERROR 42000: Variable 'CURSOR_NAME' can't be set to the value of 'NULL' +drop procedure test_signal $$ +create procedure test_signal() +begin +DECLARE error CONDITION FOR SQLSTATE '99999'; +SIGNAL error SET +MESSAGE_TEXT = NULL; +end $$ +call test_signal() $$ +ERROR 42000: Variable 'MESSAGE_TEXT' can't be set to the value of 'NULL' +drop procedure test_signal $$ +create procedure test_signal() +begin +DECLARE something CONDITION FOR SQLSTATE '99999'; +DECLARE message_text VARCHAR(64) DEFAULT "Local string variable"; +DECLARE sqlcode INTEGER DEFAULT 1234; +SIGNAL something SET +MESSAGE_TEXT = message_text, +MYSQL_ERRNO = sqlcode; +end $$ +call test_signal() $$ +ERROR 99999: Local string variable +drop procedure test_signal $$ +create procedure test_signal(message_text VARCHAR(64), sqlcode INTEGER) +begin +DECLARE something CONDITION FOR SQLSTATE "12345"; +SIGNAL something SET +MESSAGE_TEXT = message_text, +MYSQL_ERRNO = sqlcode; +end $$ +call test_signal("Parameter string", NULL) $$ +ERROR 42000: Variable 'MYSQL_ERRNO' can't be set to the value of 'NULL' +call test_signal(NULL, 1234) $$ +ERROR 42000: Variable 'MESSAGE_TEXT' can't be set to the value of 'NULL' +call test_signal("Parameter string", 5678) $$ +ERROR 12345: Parameter string +drop procedure test_signal $$ +create procedure test_signal() +begin +DECLARE something CONDITION FOR SQLSTATE "AABBB"; +SIGNAL something SET +MESSAGE_TEXT = @message_text, +MYSQL_ERRNO = @sqlcode; +end $$ +call test_signal() $$ +ERROR 42000: Variable 'MESSAGE_TEXT' can't be set to the value of 'NULL' +set @sqlcode= 12 $$ +call test_signal() $$ +ERROR 42000: Variable 'MESSAGE_TEXT' can't be set to the value of 'NULL' +set @message_text= "User variable" $$ +call test_signal() $$ +ERROR AABBB: User variable +drop procedure test_signal $$ +create procedure test_invalid() +begin +DECLARE something CONDITION FOR SQLSTATE "AABBB"; +SIGNAL something SET +MESSAGE_TEXT = @message_text := 'illegal', +MYSQL_ERRNO = @sqlcode := 1234; +end $$ +ERROR 42000: You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near ' +MYSQL_ERRNO = @sqlcode := 1234; +end' at line 5 +create procedure test_signal() +begin +DECLARE aaa VARCHAR(64); +DECLARE bbb VARCHAR(64); +DECLARE ccc VARCHAR(64); +DECLARE ddd VARCHAR(64); +DECLARE eee VARCHAR(64); +DECLARE fff VARCHAR(64); +DECLARE ggg VARCHAR(64); +DECLARE hhh VARCHAR(64); +DECLARE iii VARCHAR(64); +DECLARE jjj VARCHAR(64); +DECLARE kkk VARCHAR(64); +DECLARE warn CONDITION FOR SQLSTATE "01234"; +set aaa= repeat("A", 64); +set bbb= repeat("B", 64); +set ccc= repeat("C", 64); +set ddd= repeat("D", 64); +set eee= repeat("E", 64); +set fff= repeat("F", 64); +set ggg= repeat("G", 64); +set hhh= repeat("H", 64); +set iii= repeat("I", 64); +set jjj= repeat("J", 64); +set kkk= repeat("K", 64); +SIGNAL warn SET +CLASS_ORIGIN = aaa, +SUBCLASS_ORIGIN = bbb, +CONSTRAINT_CATALOG = ccc, +CONSTRAINT_SCHEMA = ddd, +CONSTRAINT_NAME = eee, +CATALOG_NAME = fff, +SCHEMA_NAME = ggg, +TABLE_NAME = hhh, +COLUMN_NAME = iii, +CURSOR_NAME = jjj, +MESSAGE_TEXT = kkk, +MYSQL_ERRNO = 65535; +end $$ +call test_signal() $$ +Warnings: +Warning 65535 KKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKK +drop procedure test_signal $$ +create procedure test_signal() +begin +DECLARE warn CONDITION FOR SQLSTATE "01234"; +SIGNAL warn SET +MYSQL_ERRNO = 999999999999999999999999999999999999999999999999999; +end $$ +call test_signal() $$ +ERROR 42000: Variable 'MYSQL_ERRNO' can't be set to the value of '999999999999999999999999999999999999999999999999999' +drop procedure test_signal $$ +create procedure test_signal() +begin +DECLARE aaax VARCHAR(65); +DECLARE bbbx VARCHAR(65); +DECLARE cccx VARCHAR(65); +DECLARE dddx VARCHAR(65); +DECLARE eeex VARCHAR(65); +DECLARE fffx VARCHAR(65); +DECLARE gggx VARCHAR(65); +DECLARE hhhx VARCHAR(65); +DECLARE iiix VARCHAR(65); +DECLARE jjjx VARCHAR(65); +DECLARE kkkx VARCHAR(65); +DECLARE lllx VARCHAR(129); +DECLARE warn CONDITION FOR SQLSTATE "01234"; +set aaax= concat(repeat("A", 64), "X"); +set bbbx= concat(repeat("B", 64), "X"); +set cccx= concat(repeat("C", 64), "X"); +set dddx= concat(repeat("D", 64), "X"); +set eeex= concat(repeat("E", 64), "X"); +set fffx= concat(repeat("F", 64), "X"); +set gggx= concat(repeat("G", 64), "X"); +set hhhx= concat(repeat("H", 64), "X"); +set iiix= concat(repeat("I", 64), "X"); +set jjjx= concat(repeat("J", 64), "X"); +set kkkx= concat(repeat("K", 64), "X"); +set lllx= concat(repeat("1", 100), +repeat("2", 20), +repeat("8", 8), +"X"); +SIGNAL warn SET +CLASS_ORIGIN = aaax, +SUBCLASS_ORIGIN = bbbx, +CONSTRAINT_CATALOG = cccx, +CONSTRAINT_SCHEMA = dddx, +CONSTRAINT_NAME = eeex, +CATALOG_NAME = fffx, +SCHEMA_NAME = gggx, +TABLE_NAME = hhhx, +COLUMN_NAME = iiix, +CURSOR_NAME = jjjx, +MESSAGE_TEXT = lllx, +MYSQL_ERRNO = 10000; +end $$ +call test_signal() $$ +Warnings: +Warning 1645 Data truncated for condition item 'CLASS_ORIGIN' +Warning 1645 Data truncated for condition item 'SUBCLASS_ORIGIN' +Warning 1645 Data truncated for condition item 'CONSTRAINT_CATALOG' +Warning 1645 Data truncated for condition item 'CONSTRAINT_SCHEMA' +Warning 1645 Data truncated for condition item 'CONSTRAINT_NAME' +Warning 1645 Data truncated for condition item 'CATALOG_NAME' +Warning 1645 Data truncated for condition item 'SCHEMA_NAME' +Warning 1645 Data truncated for condition item 'TABLE_NAME' +Warning 1645 Data truncated for condition item 'COLUMN_NAME' +Warning 1645 Data truncated for condition item 'CURSOR_NAME' +Warning 1645 Data truncated for condition item 'MESSAGE_TEXT' +Warning 10000 11111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111112222222222222222222288888888 +drop procedure test_signal $$ +create procedure test_signal() +begin +DECLARE warn CONDITION FOR SQLSTATE "01234"; +DECLARE CONTINUE HANDLER for SQLSTATE "01234" + begin +select "Caught by SQLSTATE"; +end; +SIGNAL warn SET +MESSAGE_TEXT = "Raising a warning", +MYSQL_ERRNO = 1012; +end $$ +call test_signal() $$ +Caught by SQLSTATE +Caught by SQLSTATE +drop procedure test_signal $$ +create procedure test_signal() +begin +DECLARE warn CONDITION FOR SQLSTATE "01234"; +DECLARE CONTINUE HANDLER for 1012 +begin +select "Caught by number"; +end; +SIGNAL warn SET +MESSAGE_TEXT = "Raising a warning", +MYSQL_ERRNO = 1012; +end $$ +call test_signal() $$ +Caught by number +Caught by number +drop procedure test_signal $$ +create procedure test_signal() +begin +DECLARE warn CONDITION FOR SQLSTATE "01234"; +DECLARE CONTINUE HANDLER for SQLWARNING +begin +select "Caught by SQLWARNING"; +end; +SIGNAL warn SET +MESSAGE_TEXT = "Raising a warning", +MYSQL_ERRNO = 1012; +end $$ +call test_signal() $$ +Caught by SQLWARNING +Caught by SQLWARNING +drop procedure test_signal $$ +create procedure test_signal() +begin +DECLARE not_found CONDITION FOR SQLSTATE "02ABC"; +DECLARE CONTINUE HANDLER for SQLSTATE "02ABC" + begin +select "Caught by SQLSTATE"; +end; +SIGNAL not_found SET +MESSAGE_TEXT = "Raising a not found", +MYSQL_ERRNO = 1012; +end $$ +call test_signal() $$ +Caught by SQLSTATE +Caught by SQLSTATE +drop procedure test_signal $$ +create procedure test_signal() +begin +DECLARE not_found CONDITION FOR SQLSTATE "02ABC"; +DECLARE CONTINUE HANDLER for 1012 +begin +select "Caught by number"; +end; +SIGNAL not_found SET +MESSAGE_TEXT = "Raising a not found", +MYSQL_ERRNO = 1012; +end $$ +call test_signal() $$ +Caught by number +Caught by number +drop procedure test_signal $$ +create procedure test_signal() +begin +DECLARE not_found CONDITION FOR SQLSTATE "02ABC"; +DECLARE CONTINUE HANDLER for NOT FOUND +begin +select "Caught by NOT FOUND"; +end; +SIGNAL not_found SET +MESSAGE_TEXT = "Raising a not found", +MYSQL_ERRNO = 1012; +end $$ +call test_signal() $$ +Caught by NOT FOUND +Caught by NOT FOUND +drop procedure test_signal $$ +create procedure test_signal() +begin +DECLARE error CONDITION FOR SQLSTATE "55555"; +DECLARE CONTINUE HANDLER for SQLSTATE "55555" + begin +select "Caught by SQLSTATE"; +end; +SIGNAL error SET +MESSAGE_TEXT = "Raising an error", +MYSQL_ERRNO = 1012; +end $$ +call test_signal() $$ +Caught by SQLSTATE +Caught by SQLSTATE +drop procedure test_signal $$ +create procedure test_signal() +begin +DECLARE error CONDITION FOR SQLSTATE "55555"; +DECLARE CONTINUE HANDLER for 1012 +begin +select "Caught by number"; +end; +SIGNAL error SET +MESSAGE_TEXT = "Raising an error", +MYSQL_ERRNO = 1012; +end $$ +call test_signal() $$ +Caught by number +Caught by number +drop procedure test_signal $$ +create procedure test_signal() +begin +DECLARE error CONDITION FOR SQLSTATE "55555"; +DECLARE CONTINUE HANDLER for SQLEXCEPTION +begin +select "Caught by SQLEXCEPTION"; +end; +SIGNAL error SET +MESSAGE_TEXT = "Raising an error", +MYSQL_ERRNO = 1012; +end $$ +call test_signal() $$ +Caught by SQLEXCEPTION +Caught by SQLEXCEPTION +drop procedure test_signal $$ +# +# Test where SIGNAL can be used +# +create function test_signal_func() returns integer +begin +DECLARE warn CONDITION FOR SQLSTATE "01XXX"; +SIGNAL warn SET +MESSAGE_TEXT = "This function SIGNAL a warning", +MYSQL_ERRNO = 1012; +return 5; +end $$ +select test_signal_func() $$ +test_signal_func() +5 +Warnings: +Warning 1012 This function SIGNAL a warning +drop function test_signal_func $$ +create function test_signal_func() returns integer +begin +DECLARE not_found CONDITION FOR SQLSTATE "02XXX"; +SIGNAL not_found SET +MESSAGE_TEXT = "This function SIGNAL not found", +MYSQL_ERRNO = 1012; +return 5; +end $$ +select test_signal_func() $$ +ERROR 02XXX: This function SIGNAL not found +drop function test_signal_func $$ +create function test_signal_func() returns integer +begin +DECLARE error CONDITION FOR SQLSTATE "50000"; +SIGNAL error SET +MESSAGE_TEXT = "This function SIGNAL an error", +MYSQL_ERRNO = 1012; +return 5; +end $$ +select test_signal_func() $$ +ERROR 50000: This function SIGNAL an error +drop function test_signal_func $$ +drop table if exists t1 $$ +create table t1 (a integer) $$ +create trigger t1_ai after insert on t1 for each row +begin +DECLARE msg VARCHAR(128); +DECLARE warn CONDITION FOR SQLSTATE "01XXX"; +set msg= concat("This trigger SIGNAL a warning, a=", NEW.a); +SIGNAL warn SET +MESSAGE_TEXT = msg, +MYSQL_ERRNO = 1012; +end $$ +insert into t1 values (1), (2) $$ +Warnings: +Warning 1012 This trigger SIGNAL a warning, a=1 +Warning 1012 This trigger SIGNAL a warning, a=2 +drop trigger t1_ai $$ +create trigger t1_ai after insert on t1 for each row +begin +DECLARE msg VARCHAR(128); +DECLARE not_found CONDITION FOR SQLSTATE "02XXX"; +set msg= concat("This trigger SIGNAL a not found, a=", NEW.a); +SIGNAL not_found SET +MESSAGE_TEXT = msg, +MYSQL_ERRNO = 1012; +end $$ +insert into t1 values (3), (4) $$ +ERROR 02XXX: This trigger SIGNAL a not found, a=3 +drop trigger t1_ai $$ +create trigger t1_ai after insert on t1 for each row +begin +DECLARE msg VARCHAR(128); +DECLARE error CONDITION FOR SQLSTATE "03XXX"; +set msg= concat("This trigger SIGNAL an error, a=", NEW.a); +SIGNAL error SET +MESSAGE_TEXT = msg, +MYSQL_ERRNO = 1012; +end $$ +insert into t1 values (5), (6) $$ +ERROR 03XXX: This trigger SIGNAL an error, a=5 +drop table t1 $$ +create table t1 (errno integer, msg varchar(128)) $$ +create trigger t1_ai after insert on t1 for each row +begin +DECLARE warn CONDITION FOR SQLSTATE "01XXX"; +SIGNAL warn SET +MESSAGE_TEXT = NEW.msg, +MYSQL_ERRNO = NEW.errno; +end $$ +insert into t1 set errno=1012, msg='Warning message 1 in trigger' $$ +Warnings: +Warning 1012 Warning message 1 in trigger +insert into t1 set errno=1013, msg='Warning message 2 in trigger' $$ +Warnings: +Warning 1013 Warning message 2 in trigger +drop table t1 $$ +drop table if exists t1 $$ +drop procedure if exists p1 $$ +drop function if exists f1 $$ +create table t1 (s1 int) $$ +insert into t1 values (1) $$ +create procedure p1() +begin +declare a int; +declare c cursor for select f1() from t1; +declare continue handler for sqlstate '03000' + select "caught 03000"; +declare continue handler for 1326 +select "caught cursor is not open"; +select "Before open"; +open c; +select "Before fetch"; +fetch c into a; +select "Before close"; +close c; +end $$ +create function f1() returns int +begin +signal sqlstate '03000'; +return 5; +end $$ +drop table t1 $$ +drop procedure p1 $$ +drop function f1 $$ +# +# Test the RESIGNAL runtime +# +create procedure test_resignal() +begin +DECLARE warn CONDITION FOR SQLSTATE "01234"; +DECLARE CONTINUE HANDLER for 1012 +begin +select "before RESIGNAL"; +RESIGNAL; +select "after RESIGNAL"; +end; +SIGNAL warn SET +MESSAGE_TEXT = "Raising a warning", +MYSQL_ERRNO = 1012; +end $$ +call test_resignal() $$ +before RESIGNAL +before RESIGNAL +after RESIGNAL +after RESIGNAL +Warnings: +Warning 1012 Raising a warning +drop procedure test_resignal $$ +create procedure test_resignal() +begin +DECLARE not_found CONDITION FOR SQLSTATE "02222"; +DECLARE CONTINUE HANDLER for 1012 +begin +select "before RESIGNAL"; +RESIGNAL; +select "after RESIGNAL"; +end; +SIGNAL not_found SET +MESSAGE_TEXT = "Raising a not found", +MYSQL_ERRNO = 1012; +end $$ +call test_resignal() $$ +before RESIGNAL +before RESIGNAL +ERROR 02222: Raising a not found +drop procedure test_resignal $$ +create procedure test_resignal() +begin +DECLARE error CONDITION FOR SQLSTATE "55555"; +DECLARE CONTINUE HANDLER for 1012 +begin +select "before RESIGNAL"; +RESIGNAL; +select "after RESIGNAL"; +end; +SIGNAL error SET +MESSAGE_TEXT = "Raising an error", +MYSQL_ERRNO = 1012; +end $$ +call test_resignal() $$ +before RESIGNAL +before RESIGNAL +ERROR 55555: Raising an error +drop procedure test_resignal $$ +create procedure test_resignal() +begin +DECLARE CONTINUE HANDLER for sqlwarning +begin +select "before RESIGNAL"; +RESIGNAL; +select "after RESIGNAL"; +end; +insert into t_warn set a= 9999999999999999; +end $$ +call test_resignal() $$ +before RESIGNAL +before RESIGNAL +after RESIGNAL +after RESIGNAL +Warnings: +Warning 1264 Out of range value for column 'a' at row 1 +drop procedure test_resignal $$ +create procedure test_resignal() +begin +DECLARE x integer; +DECLARE c cursor for select * from t_cursor; +DECLARE CONTINUE HANDLER for not found +begin +select "before RESIGNAL"; +RESIGNAL; +select "after RESIGNAL"; +end; +open c; +fetch c into x; +close c; +end $$ +call test_resignal() $$ +before RESIGNAL +before RESIGNAL +ERROR 02000: No data - zero rows fetched, selected, or processed +drop procedure test_resignal $$ +create procedure test_resignal() +begin +DECLARE CONTINUE HANDLER for sqlexception +begin +select "before RESIGNAL"; +RESIGNAL; +select "after RESIGNAL"; +end; +drop table no_such_table; +end $$ +call test_resignal() $$ +before RESIGNAL +before RESIGNAL +ERROR 42S02: Unknown table 'no_such_table' +drop procedure test_resignal $$ +create procedure test_resignal() +begin +DECLARE warn CONDITION FOR SQLSTATE "01234"; +DECLARE CONTINUE HANDLER for 1012 +begin +select "before RESIGNAL"; +RESIGNAL SET +MESSAGE_TEXT = "RESIGNAL of a warning", +MYSQL_ERRNO = 5555 ; +select "after RESIGNAL"; +end; +SIGNAL warn SET +MESSAGE_TEXT = "Raising a warning", +MYSQL_ERRNO = 1012; +end $$ +call test_resignal() $$ +before RESIGNAL +before RESIGNAL +after RESIGNAL +after RESIGNAL +Warnings: +Warning 5555 RESIGNAL of a warning +drop procedure test_resignal $$ +create procedure test_resignal() +begin +DECLARE not_found CONDITION FOR SQLSTATE "02111"; +DECLARE CONTINUE HANDLER for 1012 +begin +select "before RESIGNAL"; +RESIGNAL SET +MESSAGE_TEXT = "RESIGNAL of a not found", +MYSQL_ERRNO = 5555 ; +select "after RESIGNAL"; +end; +SIGNAL not_found SET +MESSAGE_TEXT = "Raising a not found", +MYSQL_ERRNO = 1012; +end $$ +call test_resignal() $$ +before RESIGNAL +before RESIGNAL +ERROR 02111: RESIGNAL of a not found +drop procedure test_resignal $$ +create procedure test_resignal() +begin +DECLARE error CONDITION FOR SQLSTATE "33333"; +DECLARE CONTINUE HANDLER for 1012 +begin +select "before RESIGNAL"; +RESIGNAL SET +MESSAGE_TEXT = "RESIGNAL of an error", +MYSQL_ERRNO = 5555 ; +select "after RESIGNAL"; +end; +SIGNAL error SET +MESSAGE_TEXT = "Raising an error", +MYSQL_ERRNO = 1012; +end $$ +call test_resignal() $$ +before RESIGNAL +before RESIGNAL +ERROR 33333: RESIGNAL of an error +drop procedure test_resignal $$ +create procedure test_resignal() +begin +DECLARE CONTINUE HANDLER for sqlwarning +begin +select "before RESIGNAL"; +RESIGNAL SET +MESSAGE_TEXT = "RESIGNAL of a warning", +MYSQL_ERRNO = 5555 ; +select "after RESIGNAL"; +end; +insert into t_warn set a= 9999999999999999; +end $$ +call test_resignal() $$ +before RESIGNAL +before RESIGNAL +after RESIGNAL +after RESIGNAL +Warnings: +Warning 5555 RESIGNAL of a warning +drop procedure test_resignal $$ +create procedure test_resignal() +begin +DECLARE x integer; +DECLARE c cursor for select * from t_cursor; +DECLARE CONTINUE HANDLER for not found +begin +select "before RESIGNAL"; +RESIGNAL SET +MESSAGE_TEXT = "RESIGNAL of not found", +MYSQL_ERRNO = 5555 ; +select "after RESIGNAL"; +end; +open c; +fetch c into x; +close c; +end $$ +call test_resignal() $$ +before RESIGNAL +before RESIGNAL +ERROR 02000: RESIGNAL of not found +drop procedure test_resignal $$ +create procedure test_resignal() +begin +DECLARE CONTINUE HANDLER for sqlexception +begin +select "before RESIGNAL"; +RESIGNAL SET +MESSAGE_TEXT = "RESIGNAL of an error", +MYSQL_ERRNO = 5555 ; +select "after RESIGNAL"; +end; +drop table no_such_table; +end $$ +call test_resignal() $$ +before RESIGNAL +before RESIGNAL +ERROR 42S02: RESIGNAL of an error +drop procedure test_resignal $$ +create procedure test_resignal() +begin +DECLARE warn CONDITION FOR SQLSTATE "01111"; +DECLARE CONTINUE HANDLER for 1012 +begin +select "before RESIGNAL"; +RESIGNAL SQLSTATE "01222" SET +MESSAGE_TEXT = "RESIGNAL to warning", +MYSQL_ERRNO = 5555 ; +select "after RESIGNAL"; +end; +SIGNAL warn SET +MESSAGE_TEXT = "Raising a warning", +MYSQL_ERRNO = 1012; +end $$ +call test_resignal() $$ +before RESIGNAL +before RESIGNAL +after RESIGNAL +after RESIGNAL +Warnings: +Warning 1012 Raising a warning +Warning 5555 RESIGNAL to warning +drop procedure test_resignal $$ +create procedure test_resignal() +begin +DECLARE warn CONDITION FOR SQLSTATE "01111"; +DECLARE CONTINUE HANDLER for 1012 +begin +select "before RESIGNAL"; +RESIGNAL SQLSTATE "02222" SET +MESSAGE_TEXT = "RESIGNAL to not found", +MYSQL_ERRNO = 5555 ; +select "after RESIGNAL"; +end; +SIGNAL warn SET +MESSAGE_TEXT = "Raising a warning", +MYSQL_ERRNO = 1012; +end $$ +call test_resignal() $$ +before RESIGNAL +before RESIGNAL +ERROR 02222: RESIGNAL to not found +show warnings $$ +Level Code Message +Warning 1012 Raising a warning +Error 5555 RESIGNAL to not found +drop procedure test_resignal $$ +create procedure test_resignal() +begin +DECLARE warn CONDITION FOR SQLSTATE "01111"; +DECLARE CONTINUE HANDLER for 1012 +begin +select "before RESIGNAL"; +RESIGNAL SQLSTATE "33333" SET +MESSAGE_TEXT = "RESIGNAL to error", +MYSQL_ERRNO = 5555 ; +select "after RESIGNAL"; +end; +SIGNAL warn SET +MESSAGE_TEXT = "Raising a warning", +MYSQL_ERRNO = 1012; +end $$ +call test_resignal() $$ +before RESIGNAL +before RESIGNAL +ERROR 33333: RESIGNAL to error +show warnings $$ +Level Code Message +Warning 1012 Raising a warning +Error 5555 RESIGNAL to error +drop procedure test_resignal $$ +create procedure test_resignal() +begin +DECLARE not_found CONDITION FOR SQLSTATE "02ABC"; +DECLARE CONTINUE HANDLER for 1012 +begin +select "before RESIGNAL"; +RESIGNAL SQLSTATE "01222" SET +MESSAGE_TEXT = "RESIGNAL to warning", +MYSQL_ERRNO = 5555 ; +select "after RESIGNAL"; +end; +SIGNAL not_found SET +MESSAGE_TEXT = "Raising a not found", +MYSQL_ERRNO = 1012; +end $$ +call test_resignal() $$ +before RESIGNAL +before RESIGNAL +after RESIGNAL +after RESIGNAL +Warnings: +Error 1012 Raising a not found +Warning 5555 RESIGNAL to warning +drop procedure test_resignal $$ +create procedure test_resignal() +begin +DECLARE not_found CONDITION FOR SQLSTATE "02ABC"; +DECLARE CONTINUE HANDLER for 1012 +begin +select "before RESIGNAL"; +RESIGNAL SQLSTATE "02222" SET +MESSAGE_TEXT = "RESIGNAL to not found", +MYSQL_ERRNO = 5555 ; +select "after RESIGNAL"; +end; +SIGNAL not_found SET +MESSAGE_TEXT = "Raising a not found", +MYSQL_ERRNO = 1012; +end $$ +call test_resignal() $$ +before RESIGNAL +before RESIGNAL +ERROR 02222: RESIGNAL to not found +show warnings $$ +Level Code Message +Error 1012 Raising a not found +Error 5555 RESIGNAL to not found +drop procedure test_resignal $$ +create procedure test_resignal() +begin +DECLARE not_found CONDITION FOR SQLSTATE "02ABC"; +DECLARE CONTINUE HANDLER for 1012 +begin +select "before RESIGNAL"; +RESIGNAL SQLSTATE "33333" SET +MESSAGE_TEXT = "RESIGNAL to error", +MYSQL_ERRNO = 5555 ; +select "after RESIGNAL"; +end; +SIGNAL not_found SET +MESSAGE_TEXT = "Raising a not found", +MYSQL_ERRNO = 1012; +end $$ +call test_resignal() $$ +before RESIGNAL +before RESIGNAL +ERROR 33333: RESIGNAL to error +show warnings $$ +Level Code Message +Error 1012 Raising a not found +Error 5555 RESIGNAL to error +drop procedure test_resignal $$ +create procedure test_resignal() +begin +DECLARE error CONDITION FOR SQLSTATE "AAAAA"; +DECLARE CONTINUE HANDLER for 1012 +begin +select "before RESIGNAL"; +RESIGNAL SQLSTATE "01222" SET +MESSAGE_TEXT = "RESIGNAL to warning", +MYSQL_ERRNO = 5555 ; +select "after RESIGNAL"; +end; +SIGNAL error SET +MESSAGE_TEXT = "Raising an error", +MYSQL_ERRNO = 1012; +end $$ +call test_resignal() $$ +before RESIGNAL +before RESIGNAL +after RESIGNAL +after RESIGNAL +Warnings: +Error 1012 Raising an error +Warning 5555 RESIGNAL to warning +drop procedure test_resignal $$ +create procedure test_resignal() +begin +DECLARE error CONDITION FOR SQLSTATE "AAAAA"; +DECLARE CONTINUE HANDLER for 1012 +begin +select "before RESIGNAL"; +RESIGNAL SQLSTATE "02222" SET +MESSAGE_TEXT = "RESIGNAL to not found", +MYSQL_ERRNO = 5555 ; +select "after RESIGNAL"; +end; +SIGNAL error SET +MESSAGE_TEXT = "Raising an error", +MYSQL_ERRNO = 1012; +end $$ +call test_resignal() $$ +before RESIGNAL +before RESIGNAL +ERROR 02222: RESIGNAL to not found +show warnings $$ +Level Code Message +Error 1012 Raising an error +Error 5555 RESIGNAL to not found +drop procedure test_resignal $$ +create procedure test_resignal() +begin +DECLARE error CONDITION FOR SQLSTATE "AAAAA"; +DECLARE CONTINUE HANDLER for 1012 +begin +select "before RESIGNAL"; +RESIGNAL SQLSTATE "33333" SET +MESSAGE_TEXT = "RESIGNAL to error", +MYSQL_ERRNO = 5555 ; +select "after RESIGNAL"; +end; +SIGNAL error SET +MESSAGE_TEXT = "Raising an error", +MYSQL_ERRNO = 1012; +end $$ +call test_resignal() $$ +before RESIGNAL +before RESIGNAL +ERROR 33333: RESIGNAL to error +show warnings $$ +Level Code Message +Error 1012 Raising an error +Error 5555 RESIGNAL to error +drop procedure test_resignal $$ +create procedure test_resignal() +begin +DECLARE CONTINUE HANDLER for sqlwarning +begin +select "before RESIGNAL"; +RESIGNAL SQLSTATE "01111" SET +MESSAGE_TEXT = "RESIGNAL to a warning", +MYSQL_ERRNO = 5555 ; +select "after RESIGNAL"; +end; +insert into t_warn set a= 9999999999999999; +end $$ +call test_resignal() $$ +before RESIGNAL +before RESIGNAL +after RESIGNAL +after RESIGNAL +Warnings: +Warning 1264 Out of range value for column 'a' at row 1 +Warning 5555 RESIGNAL to a warning +drop procedure test_resignal $$ +create procedure test_resignal() +begin +DECLARE CONTINUE HANDLER for sqlwarning +begin +select "before RESIGNAL"; +RESIGNAL SQLSTATE "02444" SET +MESSAGE_TEXT = "RESIGNAL to a not found", +MYSQL_ERRNO = 5555 ; +select "after RESIGNAL"; +end; +insert into t_warn set a= 9999999999999999; +end $$ +call test_resignal() $$ +before RESIGNAL +before RESIGNAL +ERROR 02444: RESIGNAL to a not found +show warnings $$ +Level Code Message +Warning 1264 Out of range value for column 'a' at row 1 +Error 5555 RESIGNAL to a not found +drop procedure test_resignal $$ +create procedure test_resignal() +begin +DECLARE CONTINUE HANDLER for sqlwarning +begin +select "before RESIGNAL"; +RESIGNAL SQLSTATE "44444" SET +MESSAGE_TEXT = "RESIGNAL to an error", +MYSQL_ERRNO = 5555 ; +select "after RESIGNAL"; +end; +insert into t_warn set a= 9999999999999999; +end $$ +call test_resignal() $$ +before RESIGNAL +before RESIGNAL +ERROR 44444: RESIGNAL to an error +show warnings $$ +Level Code Message +Warning 1264 Out of range value for column 'a' at row 1 +Error 5555 RESIGNAL to an error +drop procedure test_resignal $$ +create procedure test_resignal() +begin +DECLARE x integer; +DECLARE c cursor for select * from t_cursor; +DECLARE CONTINUE HANDLER for not found +begin +select "before RESIGNAL"; +RESIGNAL SQLSTATE "01111" SET +MESSAGE_TEXT = "RESIGNAL to a warning", +MYSQL_ERRNO = 5555 ; +select "after RESIGNAL"; +end; +open c; +fetch c into x; +close c; +end $$ +call test_resignal() $$ +before RESIGNAL +before RESIGNAL +after RESIGNAL +after RESIGNAL +Warnings: +Error 1329 No data - zero rows fetched, selected, or processed +Warning 5555 RESIGNAL to a warning +drop procedure test_resignal $$ +create procedure test_resignal() +begin +DECLARE x integer; +DECLARE c cursor for select * from t_cursor; +DECLARE CONTINUE HANDLER for not found +begin +select "before RESIGNAL"; +RESIGNAL SQLSTATE "02444" SET +MESSAGE_TEXT = "RESIGNAL to a not found", +MYSQL_ERRNO = 5555 ; +select "after RESIGNAL"; +end; +open c; +fetch c into x; +close c; +end $$ +call test_resignal() $$ +before RESIGNAL +before RESIGNAL +ERROR 02444: RESIGNAL to a not found +show warnings $$ +Level Code Message +Error 1329 No data - zero rows fetched, selected, or processed +Error 5555 RESIGNAL to a not found +drop procedure test_resignal $$ +create procedure test_resignal() +begin +DECLARE x integer; +DECLARE c cursor for select * from t_cursor; +DECLARE CONTINUE HANDLER for not found +begin +select "before RESIGNAL"; +RESIGNAL SQLSTATE "44444" SET +MESSAGE_TEXT = "RESIGNAL to an error", +MYSQL_ERRNO = 5555 ; +select "after RESIGNAL"; +end; +open c; +fetch c into x; +close c; +end $$ +call test_resignal() $$ +before RESIGNAL +before RESIGNAL +ERROR 44444: RESIGNAL to an error +show warnings $$ +Level Code Message +Error 1329 No data - zero rows fetched, selected, or processed +Error 5555 RESIGNAL to an error +drop procedure test_resignal $$ +create procedure test_resignal() +begin +DECLARE CONTINUE HANDLER for sqlexception +begin +select "before RESIGNAL"; +RESIGNAL SQLSTATE "01111" SET +MESSAGE_TEXT = "RESIGNAL to a warning", +MYSQL_ERRNO = 5555 ; +select "after RESIGNAL"; +end; +drop table no_such_table; +end $$ +call test_resignal() $$ +before RESIGNAL +before RESIGNAL +after RESIGNAL +after RESIGNAL +Warnings: +Error 1051 Unknown table 'no_such_table' +Warning 5555 RESIGNAL to a warning +drop procedure test_resignal $$ +create procedure test_resignal() +begin +DECLARE CONTINUE HANDLER for sqlexception +begin +select "before RESIGNAL"; +RESIGNAL SQLSTATE "02444" SET +MESSAGE_TEXT = "RESIGNAL to a not found", +MYSQL_ERRNO = 5555 ; +select "after RESIGNAL"; +end; +drop table no_such_table; +end $$ +call test_resignal() $$ +before RESIGNAL +before RESIGNAL +ERROR 02444: RESIGNAL to a not found +show warnings $$ +Level Code Message +Error 1051 Unknown table 'no_such_table' +Error 5555 RESIGNAL to a not found +drop procedure test_resignal $$ +create procedure test_resignal() +begin +DECLARE CONTINUE HANDLER for sqlexception +begin +select "before RESIGNAL"; +RESIGNAL SQLSTATE "44444" SET +MESSAGE_TEXT = "RESIGNAL to an error", +MYSQL_ERRNO = 5555 ; +select "after RESIGNAL"; +end; +drop table no_such_table; +end $$ +call test_resignal() $$ +before RESIGNAL +before RESIGNAL +ERROR 44444: RESIGNAL to an error +show warnings $$ +Level Code Message +Error 1051 Unknown table 'no_such_table' +Error 5555 RESIGNAL to an error +drop procedure test_resignal $$ +# +# More complex cases +# +drop procedure if exists peter_p1 $$ +drop procedure if exists peter_p2 $$ +CREATE PROCEDURE peter_p1 () +BEGIN +DECLARE x CONDITION FOR 1231; +DECLARE EXIT HANDLER FOR x +BEGIN +SELECT '2'; +RESIGNAL SET MYSQL_ERRNO = 9999; +END; +BEGIN +DECLARE EXIT HANDLER FOR x +BEGIN +SELECT '1'; +RESIGNAL SET SCHEMA_NAME = 'test'; +END; +SET @@sql_mode=NULL; +END; +END +$$ +CREATE PROCEDURE peter_p2 () +BEGIN +DECLARE x CONDITION for 9999; +DECLARE EXIT HANDLER FOR x +BEGIN +SELECT '3'; +RESIGNAL SET MESSAGE_TEXT = 'Hi, I am a useless error message'; +END; +CALL peter_p1(); +END +$$ +CALL peter_p2() $$ +1 +1 +2 +2 +3 +3 +ERROR 42000: Hi, I am a useless error message +show warnings $$ +Level Code Message +Error 9999 Hi, I am a useless error message +drop procedure peter_p1 $$ +drop procedure peter_p2 $$ +CREATE PROCEDURE peter_p1 () +BEGIN +DECLARE x CONDITION FOR SQLSTATE '42000'; +DECLARE EXIT HANDLER FOR x +BEGIN +SELECT '2'; +RESIGNAL x SET MYSQL_ERRNO = 9999; +END; +BEGIN +DECLARE EXIT HANDLER FOR x +BEGIN +SELECT '1'; +RESIGNAL x SET +SCHEMA_NAME = 'test', +MYSQL_ERRNO= 1231; +END; +/* Raises ER_WRONG_VALUE_FOR_VAR : 1231, SQLSTATE 42000 */ +SET @@sql_mode=NULL; +END; +END +$$ +CREATE PROCEDURE peter_p2 () +BEGIN +DECLARE x CONDITION for SQLSTATE '42000'; +DECLARE EXIT HANDLER FOR x +BEGIN +SELECT '3'; +RESIGNAL x SET +MESSAGE_TEXT = 'Hi, I am a useless error message', +MYSQL_ERRNO = 9999; +END; +CALL peter_p1(); +END +$$ +CALL peter_p2() $$ +1 +1 +2 +2 +3 +3 +ERROR 42000: Hi, I am a useless error message +show warnings $$ +Level Code Message +Error 1231 Variable 'sql_mode' can't be set to the value of 'NULL' +Error 1231 Variable 'sql_mode' can't be set to the value of 'NULL' +Error 9999 Variable 'sql_mode' can't be set to the value of 'NULL' +Error 9999 Hi, I am a useless error message +drop procedure peter_p1 $$ +drop procedure peter_p2 $$ +drop procedure if exists peter_p3 $$ +Warnings: +Note 1305 PROCEDURE peter_p3 does not exist +create procedure peter_p3() +begin +declare continue handler for sqlexception +resignal sqlstate '99002' set mysql_errno = 2; +signal sqlstate '99001' set mysql_errno = 1, message_text = "Original"; +end $$ +call peter_p3() $$ +ERROR 99002: Original +show warnings $$ +Level Code Message +Error 1 Original +Error 2 Original +drop procedure peter_p3 $$ +drop table t_warn; +drop table t_cursor; +# +# Miscelaneous test cases +# +create procedure test_signal() +begin +DECLARE foo CONDITION FOR SQLSTATE '12345'; +SIGNAL foo SET MYSQL_ERRNO = 0x12; /* 18 */ +end $$ +call test_signal $$ +ERROR 12345: Unhandled user-defined exception condition +drop procedure test_signal $$ +create procedure test_signal() +begin +DECLARE foo CONDITION FOR SQLSTATE '12345'; +SIGNAL foo SET MYSQL_ERRNO = 0b00010010; /* 18 */ +end $$ +call test_signal $$ +ERROR 12345: Unhandled user-defined exception condition +drop procedure test_signal $$ +create procedure test_signal() +begin +DECLARE foo CONDITION FOR SQLSTATE '12345'; +SIGNAL foo SET MYSQL_ERRNO = '65'; /* 65 */ +end $$ +call test_signal $$ +ERROR 12345: Unhandled user-defined exception condition +drop procedure test_signal $$ +create procedure test_signal() +begin +DECLARE foo CONDITION FOR SQLSTATE '12345'; +SIGNAL foo SET MYSQL_ERRNO = 'A'; /* illegal */ +end $$ +call test_signal $$ +ERROR 42000: Variable 'MYSQL_ERRNO' can't be set to the value of 'A' +drop procedure test_signal $$ +create procedure test_signal() +begin +DECLARE foo CONDITION FOR SQLSTATE '12345'; +SIGNAL foo SET MYSQL_ERRNO = "65"; /* 65 */ +end $$ +call test_signal $$ +ERROR 12345: Unhandled user-defined exception condition +drop procedure test_signal $$ +create procedure test_signal() +begin +DECLARE foo CONDITION FOR SQLSTATE '12345'; +SIGNAL foo SET MYSQL_ERRNO = "A"; /* illegal */ +end $$ +call test_signal $$ +ERROR 42000: Variable 'MYSQL_ERRNO' can't be set to the value of 'A' +drop procedure test_signal $$ +create procedure test_signal() +begin +DECLARE foo CONDITION FOR SQLSTATE '12345'; +SIGNAL foo SET MYSQL_ERRNO = `65`; /* illegal */ +end $$ +call test_signal $$ +ERROR 42S22: Unknown column '65' in 'field list' +drop procedure test_signal $$ +create procedure test_signal() +begin +DECLARE foo CONDITION FOR SQLSTATE '12345'; +SIGNAL foo SET MYSQL_ERRNO = `A`; /* illegal */ +end $$ +call test_signal $$ +ERROR 42S22: Unknown column 'A' in 'field list' +drop procedure test_signal $$ +create procedure test_signal() +begin +DECLARE foo CONDITION FOR SQLSTATE '12345'; +SIGNAL foo SET MYSQL_ERRNO = 3.141592; /* 3 */ +end $$ +call test_signal $$ +ERROR 12345: Unhandled user-defined exception condition +drop procedure test_signal $$ +create procedure test_signal() +begin +DECLARE foo CONDITION FOR SQLSTATE '12345'; +SIGNAL foo SET MYSQL_ERRNO = 1000, +MESSAGE_TEXT= 0x41; /* A */ +end $$ +call test_signal $$ +ERROR 12345: A +drop procedure test_signal $$ +create procedure test_signal() +begin +DECLARE foo CONDITION FOR SQLSTATE '12345'; +SIGNAL foo SET MYSQL_ERRNO = 1000, +MESSAGE_TEXT= 0b01000001; /* A */ +end $$ +call test_signal $$ +ERROR 12345: A +drop procedure test_signal $$ +create procedure test_signal() +begin +DECLARE foo CONDITION FOR SQLSTATE '12345'; +SIGNAL foo SET MYSQL_ERRNO = 1000, +MESSAGE_TEXT = "Hello"; +end $$ +call test_signal $$ +ERROR 12345: Hello +drop procedure test_signal $$ +create procedure test_signal() +begin +DECLARE foo CONDITION FOR SQLSTATE '12345'; +SIGNAL foo SET MYSQL_ERRNO = 1000, +MESSAGE_TEXT = 'Hello'; +end $$ +call test_signal $$ +ERROR 12345: Hello +drop procedure test_signal $$ +create procedure test_signal() +begin +DECLARE foo CONDITION FOR SQLSTATE '12345'; +SIGNAL foo SET MYSQL_ERRNO = 1000, +MESSAGE_TEXT = `Hello`; +end $$ +call test_signal $$ +ERROR 42S22: Unknown column 'Hello' in 'field list' +drop procedure test_signal $$ +create procedure test_signal() +begin +DECLARE foo CONDITION FOR SQLSTATE '12345'; +SIGNAL foo SET MYSQL_ERRNO = 1000, +MESSAGE_TEXT = 65.4321; +end $$ +call test_signal $$ +ERROR 12345: 65.4321 +drop procedure test_signal $$ +create procedure test_signal() +begin +DECLARE céèçà foo CONDITION FOR SQLSTATE '12345'; +SIGNAL céèçà SET MYSQL_ERRNO = 1000; +end $$ +ERROR 42000: You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near 'èçà foo CONDITION FOR SQLSTATE '12345'; +SIGNAL céèçà SET MYSQL_ERRNO = 1' at line 3 +create procedure test_signal() +begin +DECLARE "céèçà" CONDITION FOR SQLSTATE '12345'; +SIGNAL "céèçà" SET MYSQL_ERRNO = 1000; +end $$ +ERROR 42000: You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near '"céèçà" CONDITION FOR SQLSTATE '12345'; +SIGNAL "céèçà" SET MYSQL_ERRNO =' at line 3 +create procedure test_signal() +begin +DECLARE 'céèçà' CONDITION FOR SQLSTATE '12345'; +SIGNAL 'céèçà' SET MYSQL_ERRNO = 1000; +end $$ +ERROR 42000: You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near ''céèçà' CONDITION FOR SQLSTATE '12345'; +SIGNAL 'céèçà' SET MYSQL_ERRNO =' at line 3 +create procedure test_signal() +begin +DECLARE `céèçà` CONDITION FOR SQLSTATE '12345'; +SIGNAL `céèçà` SET MYSQL_ERRNO = 1000; +end $$ +call test_signal $$ +ERROR 12345: Unhandled user-defined exception condition +drop procedure test_signal $$ +create procedure test_signal() +begin +SIGNAL SQLSTATE '77777' SET MYSQL_ERRNO = 1000, MESSAGE_TEXT='ÁÂÃÅÄ'; +end $$ +drop procedure test_signal $$ diff --git a/mysql-test/r/signal_code.result b/mysql-test/r/signal_code.result new file mode 100644 index 00000000000..63db6656636 --- /dev/null +++ b/mysql-test/r/signal_code.result @@ -0,0 +1,35 @@ +use test; +drop procedure if exists signal_proc; +drop function if exists signal_func; +create procedure signal_proc() +begin +DECLARE foo CONDITION FOR SQLSTATE '12345'; +SIGNAL foo; +SIGNAL foo SET MESSAGE_TEXT = "This is an error message"; +RESIGNAL foo; +RESIGNAL foo SET MESSAGE_TEXT = "This is an error message"; +end $$ +create function signal_func() returns int +begin +DECLARE foo CONDITION FOR SQLSTATE '12345'; +SIGNAL foo; +SIGNAL foo SET MESSAGE_TEXT = "This is an error message"; +RESIGNAL foo; +RESIGNAL foo SET MESSAGE_TEXT = "This is an error message"; +return 0; +end $$ +show procedure code signal_proc; +Pos Instruction +0 stmt 136 "SIGNAL foo" +1 stmt 136 "SIGNAL foo SET MESSAGE_TEXT = "This i..." +2 stmt 137 "RESIGNAL foo" +3 stmt 137 "RESIGNAL foo SET MESSAGE_TEXT = "This..." +drop procedure signal_proc; +show function code signal_func; +Pos Instruction +0 stmt 136 "SIGNAL foo" +1 stmt 136 "SIGNAL foo SET MESSAGE_TEXT = "This i..." +2 stmt 137 "RESIGNAL foo" +3 stmt 137 "RESIGNAL foo SET MESSAGE_TEXT = "This..." +4 freturn 3 0 +drop function signal_func; diff --git a/mysql-test/r/signal_demo1.result b/mysql-test/r/signal_demo1.result new file mode 100644 index 00000000000..752f23a48d6 --- /dev/null +++ b/mysql-test/r/signal_demo1.result @@ -0,0 +1,270 @@ +drop database if exists demo; +create database demo; +use demo; +create table ab_physical_person ( +person_id integer, +first_name VARCHAR(50), +middle_initial CHAR, +last_name VARCHAR(50), +primary key (person_id)); +create table ab_moral_person ( +company_id integer, +name VARCHAR(100), +primary key (company_id)); +create table in_inventory ( +item_id integer, +descr VARCHAR(50), +stock integer, +primary key (item_id)); +create table po_order ( +po_id integer auto_increment, +cust_type char, /* arc relationship, see cust_id */ +cust_id integer, /* FK to ab_physical_person *OR* ab_moral_person */ +primary key (po_id)); +create table po_order_line ( +po_id integer, /* FK to po_order.po_id */ +line_no integer, +item_id integer, /* FK to in_inventory.item_id */ +qty integer); +# +# Schema integrity enforcement +# +create procedure check_pk_person(in person_type char, in id integer) +begin +declare x integer; +declare msg varchar(128); +/* +Test integrity constraints for an 'arc' relationship. +Based on 'person_type', 'id' points to either a +physical person, or a moral person. +*/ +case person_type +when 'P' then +begin +select count(person_id) from ab_physical_person +where ab_physical_person.person_id = id +into x; +if (x != 1) +then +set msg= concat('No such physical person, PK:', id); +SIGNAL SQLSTATE '45000' SET +MESSAGE_TEXT = msg, +MYSQL_ERRNO = 10000; +end if; +end; +when 'M' then +begin +select count(company_id) from ab_moral_person +where ab_moral_person.company_id = id +into x; +if (x != 1) +then +set msg= concat('No such moral person, PK:', id); +SIGNAL SQLSTATE '45000' SET +MESSAGE_TEXT = msg, +MYSQL_ERRNO = 10000; +end if; +end; +else +begin +set msg= concat('No such person type:', person_type); +SIGNAL SQLSTATE '45000' SET +MESSAGE_TEXT = msg, +MYSQL_ERRNO = 20000; +end; +end case; +end +$$ +create procedure check_pk_inventory(in id integer) +begin +declare x integer; +declare msg varchar(128); +select count(item_id) from in_inventory +where in_inventory.item_id = id +into x; +if (x != 1) +then +set msg= concat('Failed integrity constraint, table in_inventory, PK:', +id); +SIGNAL SQLSTATE '45000' SET +MESSAGE_TEXT = msg, +MYSQL_ERRNO = 10000; +end if; +end +$$ +create procedure check_pk_order(in id integer) +begin +declare x integer; +declare msg varchar(128); +select count(po_id) from po_order +where po_order.po_id = id +into x; +if (x != 1) +then +set msg= concat('Failed integrity constraint, table po_order, PK:', id); +SIGNAL SQLSTATE '45000' SET +MESSAGE_TEXT = msg, +MYSQL_ERRNO = 10000; +end if; +end +$$ +create trigger po_order_bi before insert on po_order +for each row +begin +call check_pk_person(NEW.cust_type, NEW.cust_id); +end +$$ +create trigger po_order_bu before update on po_order +for each row +begin +call check_pk_person(NEW.cust_type, NEW.cust_id); +end +$$ +create trigger po_order_line_bi before insert on po_order_line +for each row +begin +call check_pk_order(NEW.po_id); +call check_pk_inventory(NEW.item_id); +end +$$ +create trigger po_order_line_bu before update on po_order_line +for each row +begin +call check_pk_order(NEW.po_id); +call check_pk_inventory(NEW.item_id); +end +$$ +# +# Application helpers +# +create procedure po_create_order( +in p_cust_type char, +in p_cust_id integer, +out id integer) +begin +insert into po_order set cust_type = p_cust_type, cust_id = p_cust_id; +set id = last_insert_id(); +end +$$ +create procedure po_add_order_line( +in po integer, +in line integer, +in item integer, +in q integer) +begin +insert into po_order_line set +po_id = po, line_no = line, item_id = item, qty = q; +end +$$ +# +# Create sample data +# +insert into ab_physical_person values +( 1, "John", "A", "Doe"), +( 2, "Marry", "B", "Smith") +; +insert into ab_moral_person values +( 3, "ACME real estate, INC"), +( 4, "Local school") +; +insert into in_inventory values +( 100, "Table, dinner", 5), +( 101, "Chair", 20), +( 200, "Table, coffee", 3), +( 300, "School table", 25), +( 301, "School chairs", 50) +; +select * from ab_physical_person order by person_id; +person_id first_name middle_initial last_name +1 John A Doe +2 Marry B Smith +select * from ab_moral_person order by company_id; +company_id name +3 ACME real estate, INC +4 Local school +select * from in_inventory order by item_id; +item_id descr stock +100 Table, dinner 5 +101 Chair 20 +200 Table, coffee 3 +300 School table 25 +301 School chairs 50 +# +# Entering an order +# +set @my_po = 0; +/* John Doe wants 1 table and 4 chairs */ +call po_create_order("P", 1, @my_po); +call po_add_order_line (@my_po, 1, 100, 1); +call po_add_order_line (@my_po, 2, 101, 4); +/* Marry Smith wants a coffee table */ +call po_create_order("P", 2, @my_po); +call po_add_order_line (@my_po, 1, 200, 1); +# +# Entering bad data in an order +# +call po_add_order_line (@my_po, 1, 999, 1); +ERROR 45000: Failed integrity constraint, table in_inventory, PK:999 +# +# Entering bad data in an unknown order +# +call po_add_order_line (99, 1, 100, 1); +ERROR 45000: Failed integrity constraint, table po_order, PK:99 +# +# Entering an order for an unknown company +# +call po_create_order("M", 7, @my_po); +ERROR 45000: No such moral person, PK:7 +# +# Entering an order for an unknown person type +# +call po_create_order("X", 1, @my_po); +ERROR 45000: No such person type:X +/* The local school wants 10 class tables and 20 chairs */ +call po_create_order("M", 4, @my_po); +call po_add_order_line (@my_po, 1, 300, 10); +call po_add_order_line (@my_po, 2, 301, 20); +select * from po_order; +po_id cust_type cust_id +1 P 1 +2 P 2 +3 M 4 +select * from po_order_line; +po_id line_no item_id qty +1 1 100 1 +1 2 101 4 +2 1 200 1 +3 1 300 10 +3 2 301 20 +select po_id as "PO#", +( case cust_type +when "P" then concat (pp.first_name, +" ", +pp.middle_initial, +" ", +pp.last_name) +when "M" then mp.name +end ) as "Sold to" + from po_order po +left join ab_physical_person pp on po.cust_id = pp.person_id +left join ab_moral_person mp on po.cust_id = company_id +; +PO# Sold to +1 John A Doe +2 Marry B Smith +3 Local school +select po_id as "PO#", +ol.line_no as "Line", +ol.item_id as "Item", +inv.descr as "Description", +ol.qty as "Quantity" + from po_order_line ol, in_inventory inv +where inv.item_id = ol.item_id +order by ol.item_id, ol.line_no; +PO# Line Item Description Quantity +1 1 100 Table, dinner 1 +1 2 101 Chair 4 +2 1 200 Table, coffee 1 +3 1 300 School table 10 +3 2 301 School chairs 20 +drop database demo; diff --git a/mysql-test/r/signal_demo2.result b/mysql-test/r/signal_demo2.result new file mode 100644 index 00000000000..223030b0624 --- /dev/null +++ b/mysql-test/r/signal_demo2.result @@ -0,0 +1,197 @@ +drop database if exists demo; +create database demo; +use demo; +create procedure proc_top_a(p1 integer) +begin +## DECLARE CONTINUE HANDLER for SQLEXCEPTION, NOT FOUND +begin +end; +select "Starting ..."; +call proc_middle_a(p1); +select "The end"; +end +$$ +create procedure proc_middle_a(p1 integer) +begin +DECLARE l integer; +# without RESIGNAL: +# Should be: DECLARE EXIT HANDLER for SQLEXCEPTION, NOT FOUND +DECLARE EXIT HANDLER for 1 /* not sure how to handle exceptions */ +begin +select "Oops ... now what ?"; +end; +select "In prod_middle()"; +create temporary table t1(a integer, b integer); +select GET_LOCK("user_mutex", 10) into l; +insert into t1 set a = p1, b = p1; +call proc_bottom_a(p1); +select RELEASE_LOCK("user_mutex") into l; +drop temporary table t1; +end +$$ +create procedure proc_bottom_a(p1 integer) +begin +select "In proc_bottom()"; +if (p1 = 1) then +begin +select "Doing something that works ..."; +select * from t1; +end; +end if; +if (p1 = 2) then +begin +select "Doing something that fail (simulate an error) ..."; +drop table no_such_table; +end; +end if; +if (p1 = 3) then +begin +select "Doing something that *SHOULD* works ..."; +select * from t1; +end; +end if; +end +$$ +call proc_top_a(1); +Starting ... +Starting ... +In prod_middle() +In prod_middle() +In proc_bottom() +In proc_bottom() +Doing something that works ... +Doing something that works ... +a b +1 1 +The end +The end +call proc_top_a(2); +Starting ... +Starting ... +In prod_middle() +In prod_middle() +In proc_bottom() +In proc_bottom() +Doing something that fail (simulate an error) ... +Doing something that fail (simulate an error) ... +ERROR 42S02: Unknown table 'no_such_table' +call proc_top_a(3); +Starting ... +Starting ... +In prod_middle() +In prod_middle() +ERROR 42S01: Table 't1' already exists +call proc_top_a(1); +Starting ... +Starting ... +In prod_middle() +In prod_middle() +ERROR 42S01: Table 't1' already exists +drop temporary table if exists t1; +create procedure proc_top_b(p1 integer) +begin +select "Starting ..."; +call proc_middle_b(p1); +select "The end"; +end +$$ +create procedure proc_middle_b(p1 integer) +begin +DECLARE l integer; +DECLARE EXIT HANDLER for SQLEXCEPTION, NOT FOUND +begin +begin +DECLARE CONTINUE HANDLER for SQLEXCEPTION, NOT FOUND +begin +/* Ignore errors from the cleanup code */ +end; +select "Doing cleanup !"; +select RELEASE_LOCK("user_mutex") into l; +drop temporary table t1; +end; +RESIGNAL; +end; +select "In prod_middle()"; +create temporary table t1(a integer, b integer); +select GET_LOCK("user_mutex", 10) into l; +insert into t1 set a = p1, b = p1; +call proc_bottom_b(p1); +select RELEASE_LOCK("user_mutex") into l; +drop temporary table t1; +end +$$ +create procedure proc_bottom_b(p1 integer) +begin +select "In proc_bottom()"; +if (p1 = 1) then +begin +select "Doing something that works ..."; +select * from t1; +end; +end if; +if (p1 = 2) then +begin +select "Doing something that fail (simulate an error) ..."; +drop table no_such_table; +end; +end if; +if (p1 = 3) then +begin +select "Doing something that *SHOULD* works ..."; +select * from t1; +end; +end if; +end +$$ +call proc_top_b(1); +Starting ... +Starting ... +In prod_middle() +In prod_middle() +In proc_bottom() +In proc_bottom() +Doing something that works ... +Doing something that works ... +a b +1 1 +The end +The end +call proc_top_b(2); +Starting ... +Starting ... +In prod_middle() +In prod_middle() +In proc_bottom() +In proc_bottom() +Doing something that fail (simulate an error) ... +Doing something that fail (simulate an error) ... +Doing cleanup ! +Doing cleanup ! +ERROR 42S02: Unknown table 'no_such_table' +call proc_top_b(3); +Starting ... +Starting ... +In prod_middle() +In prod_middle() +In proc_bottom() +In proc_bottom() +Doing something that *SHOULD* works ... +Doing something that *SHOULD* works ... +a b +3 3 +The end +The end +call proc_top_b(1); +Starting ... +Starting ... +In prod_middle() +In prod_middle() +In proc_bottom() +In proc_bottom() +Doing something that works ... +Doing something that works ... +a b +1 1 +The end +The end +drop database demo; diff --git a/mysql-test/r/signal_demo3.result b/mysql-test/r/signal_demo3.result new file mode 100644 index 00000000000..fea41ec2ef9 --- /dev/null +++ b/mysql-test/r/signal_demo3.result @@ -0,0 +1,143 @@ +SET @start_global_value = @@global.max_error_count; +SELECT @start_global_value; +@start_global_value +64 +SET @start_session_value = @@session.max_error_count; +SELECT @start_session_value; +@start_session_value +64 +drop database if exists demo; +create database demo; +use demo; +create procedure proc_1() +begin +declare exit handler for sqlexception +resignal sqlstate '45000' set message_text='Oops in proc_1'; +call proc_2(); +end +$$ +create procedure proc_2() +begin +declare exit handler for sqlexception +resignal sqlstate '45000' set message_text='Oops in proc_2'; +call proc_3(); +end +$$ +create procedure proc_3() +begin +declare exit handler for sqlexception +resignal sqlstate '45000' set message_text='Oops in proc_3'; +call proc_4(); +end +$$ +create procedure proc_4() +begin +declare exit handler for sqlexception +resignal sqlstate '45000' set message_text='Oops in proc_4'; +call proc_5(); +end +$$ +create procedure proc_5() +begin +declare exit handler for sqlexception +resignal sqlstate '45000' set message_text='Oops in proc_5'; +call proc_6(); +end +$$ +create procedure proc_6() +begin +declare exit handler for sqlexception +resignal sqlstate '45000' set message_text='Oops in proc_6'; +call proc_7(); +end +$$ +create procedure proc_7() +begin +declare exit handler for sqlexception +resignal sqlstate '45000' set message_text='Oops in proc_7'; +call proc_8(); +end +$$ +create procedure proc_8() +begin +declare exit handler for sqlexception +resignal sqlstate '45000' set message_text='Oops in proc_8'; +call proc_9(); +end +$$ +create procedure proc_9() +begin +declare exit handler for sqlexception +resignal sqlstate '45000' set message_text='Oops in proc_9'; +## Do something that fails, to see how errors are reported +drop table oops_it_is_not_here; +end +$$ +call proc_1(); +ERROR 45000: Oops in proc_1 +show warnings; +Level Code Message +Error 1051 Unknown table 'oops_it_is_not_here' +Error 1642 Oops in proc_9 +Error 1642 Oops in proc_8 +Error 1642 Oops in proc_7 +Error 1642 Oops in proc_6 +Error 1642 Oops in proc_5 +Error 1642 Oops in proc_4 +Error 1642 Oops in proc_3 +Error 1642 Oops in proc_2 +Error 1642 Oops in proc_1 +SET @@session.max_error_count = 5; +SELECT @@session.max_error_count; +@@session.max_error_count +5 +call proc_1(); +ERROR 45000: Oops in proc_1 +show warnings; +Level Code Message +Error 1642 Oops in proc_5 +Error 1642 Oops in proc_4 +Error 1642 Oops in proc_3 +Error 1642 Oops in proc_2 +Error 1642 Oops in proc_1 +SET @@session.max_error_count = 7; +SELECT @@session.max_error_count; +@@session.max_error_count +7 +call proc_1(); +ERROR 45000: Oops in proc_1 +show warnings; +Level Code Message +Error 1642 Oops in proc_7 +Error 1642 Oops in proc_6 +Error 1642 Oops in proc_5 +Error 1642 Oops in proc_4 +Error 1642 Oops in proc_3 +Error 1642 Oops in proc_2 +Error 1642 Oops in proc_1 +SET @@session.max_error_count = 9; +SELECT @@session.max_error_count; +@@session.max_error_count +9 +call proc_1(); +ERROR 45000: Oops in proc_1 +show warnings; +Level Code Message +Error 1642 Oops in proc_9 +Error 1642 Oops in proc_8 +Error 1642 Oops in proc_7 +Error 1642 Oops in proc_6 +Error 1642 Oops in proc_5 +Error 1642 Oops in proc_4 +Error 1642 Oops in proc_3 +Error 1642 Oops in proc_2 +Error 1642 Oops in proc_1 +drop database demo; +SET @@global.max_error_count = @start_global_value; +SELECT @@global.max_error_count; +@@global.max_error_count +64 +SET @@session.max_error_count = @start_session_value; +SELECT @@session.max_error_count; +@@session.max_error_count +64 diff --git a/mysql-test/r/signal_sqlmode.result b/mysql-test/r/signal_sqlmode.result new file mode 100644 index 00000000000..8fed85eb4a9 --- /dev/null +++ b/mysql-test/r/signal_sqlmode.result @@ -0,0 +1,86 @@ +SET @save_sql_mode=@@sql_mode; +SET sql_mode=''; +drop procedure if exists p; +drop procedure if exists p2; +drop procedure if exists p3; +create procedure p() +begin +declare utf8_var VARCHAR(128) CHARACTER SET UTF8; +set utf8_var = concat(repeat('A', 128), 'X'); +select length(utf8_var), utf8_var; +end +$$ +create procedure p2() +begin +declare msg VARCHAR(129) CHARACTER SET UTF8; +set msg = concat(repeat('A', 128), 'X'); +select length(msg), msg; +signal sqlstate '55555' set message_text = msg; +end +$$ +create procedure p3() +begin +declare name VARCHAR(65) CHARACTER SET UTF8; +set name = concat(repeat('A', 64), 'X'); +select length(name), name; +signal sqlstate '55555' set +message_text = 'Message', +table_name = name; +end +$$ +call p; +length(utf8_var) utf8_var +128 AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA +Warnings: +Warning 1265 Data truncated for column 'utf8_var' at row 1 +call p2; +length(msg) msg +129 AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAX +ERROR 55555: AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA +call p3; +length(name) name +65 AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAX +ERROR 55555: Message +drop procedure p; +drop procedure p2; +drop procedure p3; +SET sql_mode='STRICT_ALL_TABLES'; +create procedure p() +begin +declare utf8_var VARCHAR(128) CHARACTER SET UTF8; +set utf8_var = concat(repeat('A', 128), 'X'); +select length(utf8_var), utf8_var; +end +$$ +create procedure p2() +begin +declare msg VARCHAR(129) CHARACTER SET UTF8; +set msg = concat(repeat('A', 128), 'X'); +select length(msg), msg; +signal sqlstate '55555' set message_text = msg; +end +$$ +create procedure p3() +begin +declare name VARCHAR(65) CHARACTER SET UTF8; +set name = concat(repeat('A', 64), 'X'); +select length(name), name; +signal sqlstate '55555' set +message_text = 'Message', +table_name = name; +end +$$ +call p; +ERROR 22001: Data too long for column 'utf8_var' at row 1 +call p2; +length(msg) msg +129 AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAX +ERROR HY000: Data too long for condition item 'MESSAGE_TEXT' +call p3; +length(name) name +65 AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAX +ERROR HY000: Data too long for condition item 'TABLE_NAME' +drop procedure p; +drop procedure p2; +drop procedure p3; +SET @@sql_mode=@save_sql_mode; diff --git a/mysql-test/r/sp-dynamic.result b/mysql-test/r/sp-dynamic.result index 34b76a9424f..cdfeb8ab020 100644 --- a/mysql-test/r/sp-dynamic.result +++ b/mysql-test/r/sp-dynamic.result @@ -97,8 +97,6 @@ end| call p1()| a 1 -Warnings: -Note 1051 Unknown table 't1' call p1()| a 1 @@ -371,9 +369,6 @@ call p1(@a)| create table t1 (a int) @rsql create table t2 (a int) -Warnings: -Note 1051 Unknown table 't1' -Note 1051 Unknown table 't2' select @a| @a 0 @@ -382,9 +377,6 @@ call p1(@a)| create table t1 (a int) @rsql create table t2 (a int) -Warnings: -Note 1051 Unknown table 't1' -Note 1051 Unknown table 't2' select @a| @a 0 diff --git a/mysql-test/r/sp-vars.result b/mysql-test/r/sp-vars.result index f5420a62f63..f532a5284a9 100644 --- a/mysql-test/r/sp-vars.result +++ b/mysql-test/r/sp-vars.result @@ -110,24 +110,6 @@ v7 v8 v9 v10 v11 v12 v13 v14 v15 v16 v17 v18 v19 v20 12.00 12.12 12.00 12.12 Warnings: -Warning 1264 Out of range value for column 'v1' at row 1 -Warning 1264 Out of range value for column 'v1u' at row 1 -Warning 1264 Out of range value for column 'v2' at row 1 -Warning 1264 Out of range value for column 'v2u' at row 1 -Warning 1264 Out of range value for column 'v3' at row 1 -Warning 1264 Out of range value for column 'v3u' at row 1 -Warning 1264 Out of range value for column 'v4' at row 1 -Warning 1264 Out of range value for column 'v4u' at row 1 -Warning 1264 Out of range value for column 'v5' at row 1 -Warning 1264 Out of range value for column 'v5u' at row 1 -Warning 1264 Out of range value for column 'v6' at row 1 -Warning 1264 Out of range value for column 'v6u' at row 1 -Warning 1366 Incorrect integer value: 'String 10 ' for column 'v10' at row 1 -Warning 1366 Incorrect integer value: 'String10' for column 'v11' at row 1 -Warning 1265 Data truncated for column 'v12' at row 1 -Warning 1265 Data truncated for column 'v13' at row 1 -Warning 1366 Incorrect integer value: 'Hello, world' for column 'v16' at row 1 -Note 1265 Data truncated for column 'v18' at row 1 Note 1265 Data truncated for column 'v20' at row 1 CALL sp_vars_check_assignment(); i1 i2 i3 i4 @@ -143,21 +125,6 @@ d1 d2 d3 d1 d2 d3 1234.00 1234.12 1234.12 Warnings: -Warning 1264 Out of range value for column 'i1' at row 1 -Warning 1264 Out of range value for column 'i2' at row 1 -Warning 1264 Out of range value for column 'i3' at row 1 -Warning 1264 Out of range value for column 'i4' at row 1 -Warning 1264 Out of range value for column 'i1' at row 1 -Warning 1264 Out of range value for column 'i2' at row 1 -Warning 1264 Out of range value for column 'i3' at row 1 -Warning 1264 Out of range value for column 'i4' at row 1 -Warning 1264 Out of range value for column 'u1' at row 1 -Warning 1264 Out of range value for column 'u2' at row 1 -Warning 1264 Out of range value for column 'u3' at row 1 -Warning 1264 Out of range value for column 'u4' at row 1 -Warning 1264 Out of range value for column 'u1' at row 1 -Warning 1264 Out of range value for column 'u2' at row 1 -Note 1265 Data truncated for column 'd3' at row 1 Note 1265 Data truncated for column 'd3' at row 1 SELECT sp_vars_check_ret1(); sp_vars_check_ret1() @@ -198,24 +165,6 @@ v7 v8 v9 v10 v11 v12 v13 v14 v15 v16 v17 v18 v19 v20 12.00 12.12 12.00 12.12 Warnings: -Warning 1264 Out of range value for column 'v1' at row 1 -Warning 1264 Out of range value for column 'v1u' at row 1 -Warning 1264 Out of range value for column 'v2' at row 1 -Warning 1264 Out of range value for column 'v2u' at row 1 -Warning 1264 Out of range value for column 'v3' at row 1 -Warning 1264 Out of range value for column 'v3u' at row 1 -Warning 1264 Out of range value for column 'v4' at row 1 -Warning 1264 Out of range value for column 'v4u' at row 1 -Warning 1264 Out of range value for column 'v5' at row 1 -Warning 1264 Out of range value for column 'v5u' at row 1 -Warning 1264 Out of range value for column 'v6' at row 1 -Warning 1264 Out of range value for column 'v6u' at row 1 -Warning 1366 Incorrect integer value: 'String 10 ' for column 'v10' at row 1 -Warning 1366 Incorrect integer value: 'String10' for column 'v11' at row 1 -Warning 1265 Data truncated for column 'v12' at row 1 -Warning 1265 Data truncated for column 'v13' at row 1 -Warning 1366 Incorrect integer value: 'Hello, world' for column 'v16' at row 1 -Note 1265 Data truncated for column 'v18' at row 1 Note 1265 Data truncated for column 'v20' at row 1 CALL sp_vars_check_assignment(); i1 i2 i3 i4 @@ -231,21 +180,6 @@ d1 d2 d3 d1 d2 d3 1234.00 1234.12 1234.12 Warnings: -Warning 1264 Out of range value for column 'i1' at row 1 -Warning 1264 Out of range value for column 'i2' at row 1 -Warning 1264 Out of range value for column 'i3' at row 1 -Warning 1264 Out of range value for column 'i4' at row 1 -Warning 1264 Out of range value for column 'i1' at row 1 -Warning 1264 Out of range value for column 'i2' at row 1 -Warning 1264 Out of range value for column 'i3' at row 1 -Warning 1264 Out of range value for column 'i4' at row 1 -Warning 1264 Out of range value for column 'u1' at row 1 -Warning 1264 Out of range value for column 'u2' at row 1 -Warning 1264 Out of range value for column 'u3' at row 1 -Warning 1264 Out of range value for column 'u4' at row 1 -Warning 1264 Out of range value for column 'u1' at row 1 -Warning 1264 Out of range value for column 'u2' at row 1 -Note 1265 Data truncated for column 'd3' at row 1 Note 1265 Data truncated for column 'd3' at row 1 SELECT sp_vars_check_ret1(); sp_vars_check_ret1() @@ -451,10 +385,6 @@ FF HEX(v10) FF Warnings: -Warning 1264 Out of range value for column 'v8' at row 1 -Warning 1264 Out of range value for column 'v9' at row 1 -Warning 1264 Out of range value for column 'v10' at row 1 -Warning 1264 Out of range value for column 'v1' at row 1 Warning 1264 Out of range value for column 'v5' at row 1 DROP PROCEDURE p1; diff --git a/mysql-test/r/sp.result b/mysql-test/r/sp.result index 67514c314f4..d8389c78845 100644 --- a/mysql-test/r/sp.result +++ b/mysql-test/r/sp.result @@ -526,8 +526,6 @@ end| delete from t1| create table t3 ( s char(16), d int)| call into_test4()| -Warnings: -Warning 1329 No data - zero rows fetched, selected, or processed select * from t3| s d into4 NULL @@ -1120,8 +1118,6 @@ end| select f9()| f9() 6 -Warnings: -Note 1051 Unknown table 't3' select f9() from t1 limit 1| f9() 6 @@ -1162,8 +1158,6 @@ drop temporary table t3| select f12_1()| f12_1() 3 -Warnings: -Note 1051 Unknown table 't3' select f12_1() from t1 limit 1| f12_1() 3 @@ -2069,12 +2063,7 @@ end if; insert into t4 values (2, rc, t3); end| call bug1863(10)| -Warnings: -Note 1051 Unknown table 'temp_t1' -Warning 1329 No data - zero rows fetched, selected, or processed call bug1863(10)| -Warnings: -Warning 1329 No data - zero rows fetched, selected, or processed select * from t4| f1 rc t3 2 0 NULL @@ -2339,11 +2328,7 @@ begin end| call bug4579_1()| call bug4579_1()| -Warnings: -Warning 1329 No data - zero rows fetched, selected, or processed call bug4579_1()| -Warnings: -Warning 1329 No data - zero rows fetched, selected, or processed drop procedure bug4579_1| drop procedure bug4579_2| drop table t3| @@ -3736,9 +3721,6 @@ Table Create Table tm1 CREATE TEMPORARY TABLE `tm1` ( `spv1` decimal(3,3) DEFAULT NULL ) ENGINE=MyISAM DEFAULT CHARSET=latin1 -Warnings: -Warning 1264 Out of range value for column 'spv1' at row 1 -Warning 1366 Incorrect decimal value: 'test' for column 'spv1' at row 1 call bug12589_2()| Table Create Table tm1 CREATE TEMPORARY TABLE `tm1` ( @@ -6106,35 +6088,6 @@ bug5274_f2() x Warnings: Warning 1265 Data truncated for column 'bug5274_f1' at row 1 -Warning 1265 Data truncated for column 'bug5274_f1' at row 1 -Warning 1265 Data truncated for column 'bug5274_f1' at row 1 -Warning 1265 Data truncated for column 'bug5274_f1' at row 1 -Warning 1265 Data truncated for column 'bug5274_f1' at row 1 -Warning 1265 Data truncated for column 'bug5274_f1' at row 1 -Warning 1265 Data truncated for column 'bug5274_f1' at row 1 -Warning 1265 Data truncated for column 'bug5274_f1' at row 1 -Warning 1265 Data truncated for column 'bug5274_f1' at row 1 -Warning 1265 Data truncated for column 'bug5274_f1' at row 1 -Warning 1265 Data truncated for column 'bug5274_f1' at row 1 -Warning 1265 Data truncated for column 'bug5274_f1' at row 1 -Warning 1265 Data truncated for column 'bug5274_f1' at row 1 -Warning 1265 Data truncated for column 'bug5274_f1' at row 1 -Warning 1265 Data truncated for column 'bug5274_f1' at row 1 -Warning 1265 Data truncated for column 'bug5274_f1' at row 1 -Warning 1265 Data truncated for column 'bug5274_f1' at row 1 -Warning 1265 Data truncated for column 'bug5274_f1' at row 1 -Warning 1265 Data truncated for column 'bug5274_f1' at row 1 -Warning 1265 Data truncated for column 'bug5274_f1' at row 1 -Warning 1265 Data truncated for column 'bug5274_f1' at row 1 -Warning 1265 Data truncated for column 'bug5274_f1' at row 1 -Warning 1265 Data truncated for column 'bug5274_f1' at row 1 -Warning 1265 Data truncated for column 'bug5274_f1' at row 1 -Warning 1265 Data truncated for column 'bug5274_f1' at row 1 -Warning 1265 Data truncated for column 'bug5274_f1' at row 1 -Warning 1265 Data truncated for column 'bug5274_f1' at row 1 -Warning 1265 Data truncated for column 'bug5274_f1' at row 1 -Warning 1265 Data truncated for column 'bug5274_f1' at row 1 -Warning 1265 Data truncated for column 'bug5274_f1' at row 1 DROP FUNCTION bug5274_f1| DROP FUNCTION bug5274_f2| drop procedure if exists proc_21513| @@ -6229,20 +6182,17 @@ f1(2) 0 Warnings: Warning 1329 No data - zero rows fetched, selected, or processed -Warning 1329 No data - zero rows fetched, selected, or processed PREPARE s1 FROM 'SELECT f1(2)'; EXECUTE s1; f1(2) 0 Warnings: Warning 1329 No data - zero rows fetched, selected, or processed -Warning 1329 No data - zero rows fetched, selected, or processed EXECUTE s1; f1(2) 0 Warnings: Warning 1329 No data - zero rows fetched, selected, or processed -Warning 1329 No data - zero rows fetched, selected, or processed DROP PROCEDURE p1; DROP PROCEDURE p2; DROP FUNCTION f1; @@ -6254,6 +6204,7 @@ create procedure mysqltest_db1.sp_bug28551() begin end; call mysqltest_db1.sp_bug28551(); show warnings; Level Code Message +Note 1008 Can't drop database 'mysqltest_db1'; database doesn't exist drop database mysqltest_db1; drop database if exists mysqltest_db1; drop table if exists test.t1; diff --git a/mysql-test/r/sp_notembedded.result b/mysql-test/r/sp_notembedded.result index 831616f491b..228fe008447 100644 --- a/mysql-test/r/sp_notembedded.result +++ b/mysql-test/r/sp_notembedded.result @@ -21,9 +21,11 @@ end| call bug4902_2()| show warnings| Level Code Message +Note 1305 PROCEDURE bug4902_2 does not exist call bug4902_2()| show warnings| Level Code Message +Note 1305 PROCEDURE bug4902_2 does not exist drop procedure bug4902_2| drop table if exists t1| create table t1 ( diff --git a/mysql-test/r/strict.result b/mysql-test/r/strict.result index 241f4198bf7..a9e0d7f457d 100644 --- a/mysql-test/r/strict.result +++ b/mysql-test/r/strict.result @@ -315,8 +315,8 @@ MOD(col1,0) NULL NULL Warnings: -Error 1365 Division by 0 -Error 1365 Division by 0 +Warning 1365 Division by 0 +Warning 1365 Division by 0 INSERT INTO t1 (col1) VALUES(-129); ERROR 22003: Out of range value for column 'col1' at row 1 INSERT INTO t1 (col1) VALUES(128); @@ -343,7 +343,7 @@ SELECT MOD(col1,0) FROM t1 WHERE col1 > 0 LIMIT 1; MOD(col1,0) NULL Warnings: -Error 1365 Division by 0 +Warning 1365 Division by 0 UPDATE t1 SET col1 = col1 - 50 WHERE col1 < 0; ERROR 22003: Out of range value for column 'col1' at row 1 UPDATE t1 SET col2=col2 + 50 WHERE col2 > 0; @@ -353,16 +353,16 @@ ERROR 22012: Division by 0 set @@sql_mode='ERROR_FOR_DIVISION_BY_ZERO'; INSERT INTO t1 values (1/0,1/0); Warnings: -Error 1365 Division by 0 -Error 1365 Division by 0 +Warning 1365 Division by 0 +Warning 1365 Division by 0 set @@sql_mode='ansi,traditional'; SELECT MOD(col1,0) FROM t1 WHERE col1 > 0 LIMIT 2; MOD(col1,0) NULL NULL Warnings: -Error 1365 Division by 0 -Error 1365 Division by 0 +Warning 1365 Division by 0 +Warning 1365 Division by 0 INSERT INTO t1 (col1) VALUES (''); ERROR HY000: Incorrect integer value: '' for column 'col1' at row 1 INSERT INTO t1 (col1) VALUES ('a59b'); @@ -374,8 +374,8 @@ Warnings: Warning 1265 Data truncated for column 'col1' at row 1 INSERT IGNORE INTO t1 values (1/0,1/0); Warnings: -Error 1365 Division by 0 -Error 1365 Division by 0 +Warning 1365 Division by 0 +Warning 1365 Division by 0 set @@sql_mode='ansi'; INSERT INTO t1 values (1/0,1/0); set @@sql_mode='ansi,traditional'; @@ -457,8 +457,8 @@ Warnings: Warning 1265 Data truncated for column 'col1' at row 1 INSERT IGNORE INTO t1 values (1/0,1/0); Warnings: -Error 1365 Division by 0 -Error 1365 Division by 0 +Warning 1365 Division by 0 +Warning 1365 Division by 0 INSERT IGNORE INTO t1 VALUES(-32769,-1),(32768,65536); Warnings: Warning 1264 Out of range value for column 'col1' at row 1 @@ -541,8 +541,8 @@ Warnings: Warning 1265 Data truncated for column 'col1' at row 1 INSERT IGNORE INTO t1 values (1/0,1/0); Warnings: -Error 1365 Division by 0 -Error 1365 Division by 0 +Warning 1365 Division by 0 +Warning 1365 Division by 0 INSERT IGNORE INTO t1 VALUES(-8388609,-1),(8388608,16777216); Warnings: Warning 1264 Out of range value for column 'col1' at row 1 @@ -625,8 +625,8 @@ Warnings: Warning 1265 Data truncated for column 'col1' at row 1 INSERT IGNORE INTO t1 values (1/0,1/0); Warnings: -Error 1365 Division by 0 -Error 1365 Division by 0 +Warning 1365 Division by 0 +Warning 1365 Division by 0 INSERT IGNORE INTO t1 values (-2147483649, -1),(2147643648,4294967296); Warnings: Warning 1264 Out of range value for column 'col1' at row 1 @@ -707,8 +707,8 @@ Warnings: Warning 1265 Data truncated for column 'col1' at row 1 INSERT IGNORE INTO t1 values (1/0,1/0); Warnings: -Error 1365 Division by 0 -Error 1365 Division by 0 +Warning 1365 Division by 0 +Warning 1365 Division by 0 INSERT IGNORE INTO t1 VALUES(-9223372036854775809,-1),(9223372036854775808,18446744073709551616); Warnings: Warning 1264 Out of range value for column 'col1' at row 1 @@ -794,7 +794,7 @@ Warnings: Note 1265 Data truncated for column 'col1' at row 1 INSERT IGNORE INTO t1 values (1/0); Warnings: -Error 1365 Division by 0 +Warning 1365 Division by 0 INSERT IGNORE INTO t1 VALUES(1000),(-1000); Warnings: Warning 1264 Out of range value for column 'col1' at row 1 @@ -861,7 +861,7 @@ Warnings: Warning 1265 Data truncated for column 'col1' at row 1 INSERT IGNORE INTO t1 (col1) VALUES (1/0); Warnings: -Error 1365 Division by 0 +Warning 1365 Division by 0 INSERT IGNORE INTO t1 VALUES (+3.4E+39,-3.4E+39); Warnings: Warning 1264 Out of range value for column 'col1' at row 1 @@ -910,7 +910,7 @@ Warnings: Warning 1265 Data truncated for column 'col1' at row 1 INSERT IGNORE INTO t1 (col1) values (1/0); Warnings: -Error 1365 Division by 0 +Warning 1365 Division by 0 INSERT IGNORE INTO t1 VALUES (+1.9E+309,-1.9E+309); ERROR 22007: Illegal double '1.9E+309' value found during parsing INSERT IGNORE INTO t1 VALUES ('+2.0E+309','-2.0E+309'); @@ -1080,13 +1080,13 @@ Warnings: Warning 1292 Truncated incorrect datetime value: '31.10.2004 15.30 abc' insert into t1 values(STR_TO_DATE('32.10.2004 15.30','%d.%m.%Y %H.%i')); Warnings: -Error 1411 Incorrect datetime value: '32.10.2004 15.30' for function str_to_date +Warning 1411 Incorrect datetime value: '32.10.2004 15.30' for function str_to_date insert into t1 values(STR_TO_DATE('2004.12.12 22:22:33 AM','%Y.%m.%d %r')); Warnings: -Error 1411 Incorrect time value: '22:22:33 AM' for function str_to_date +Warning 1411 Incorrect time value: '22:22:33 AM' for function str_to_date insert into t1 values(STR_TO_DATE('2004.12.12 abc','%Y.%m.%d %T')); Warnings: -Error 1411 Incorrect time value: 'abc' for function str_to_date +Warning 1411 Incorrect time value: 'abc' for function str_to_date insert into t1 values(STR_TO_DATE('31.10.2004 15.30','%d.%m.%Y %H.%i')); insert into t1 values(STR_TO_DATE('2004.12.12 11:22:33 AM','%Y.%m.%d %r')); insert into t1 values(STR_TO_DATE('2004.12.12 10:22:59','%Y.%m.%d %T')); @@ -1104,9 +1104,9 @@ select count(*) from t1 where STR_TO_DATE('2004.12.12 10:22:61','%Y.%m.%d %T') I count(*) 7 Warnings: -Error 1411 Incorrect datetime value: '2004.12.12 10:22:61' for function str_to_date -Error 1411 Incorrect datetime value: '2004.12.12 10:22:61' for function str_to_date -Error 1411 Incorrect datetime value: '2004.12.12 10:22:61' for function str_to_date +Warning 1411 Incorrect datetime value: '2004.12.12 10:22:61' for function str_to_date +Warning 1411 Incorrect datetime value: '2004.12.12 10:22:61' for function str_to_date +Warning 1411 Incorrect datetime value: '2004.12.12 10:22:61' for function str_to_date drop table t1; create table t1 (col1 char(3), col2 integer); insert into t1 (col1) values (cast(1000 as char(3))); diff --git a/mysql-test/r/trigger.result b/mysql-test/r/trigger.result index 4476735735c..000b08113c1 100644 --- a/mysql-test/r/trigger.result +++ b/mysql-test/r/trigger.result @@ -1073,7 +1073,7 @@ NULL SET @x=2; UPDATE t1 SET i1 = @x; Warnings: -Error 1365 Division by 0 +Warning 1365 Division by 0 SELECT @x; @x NULL @@ -1086,8 +1086,8 @@ NULL SET @x=4; UPDATE t1 SET i1 = @x; Warnings: -Error 1365 Division by 0 -Error 1365 Division by 0 +Warning 1365 Division by 0 +Warning 1365 Division by 0 SELECT @x; @x NULL @@ -1190,16 +1190,16 @@ create trigger t4_bu before update on t4 for each row set @t4_bu_called:=1| insert into t1 values(10, 10)| set @a:=1/0| Warnings: -Error 1365 Division by 0 +Warning 1365 Division by 0 select 1/0 from t1| 1/0 NULL Warnings: -Error 1365 Division by 0 +Warning 1365 Division by 0 create trigger t1_bi before insert on t1 for each row set @a:=1/0| insert into t1 values(20, 20)| Warnings: -Error 1365 Division by 0 +Warning 1365 Division by 0 drop trigger t1_bi| create trigger t1_bi before insert on t1 for each row begin @@ -1219,7 +1219,7 @@ end| set @check=0, @t4_bi_called=0, @t4_bu_called=0| insert into t1 values(30, 30)| Warnings: -Error 1365 Division by 0 +Warning 1365 Division by 0 select @check, @t4_bi_called, @t4_bu_called| @check @t4_bi_called @t4_bu_called 2 1 1 diff --git a/mysql-test/r/type_newdecimal.result b/mysql-test/r/type_newdecimal.result index c3d1e400b23..1ad46821bb7 100644 --- a/mysql-test/r/type_newdecimal.result +++ b/mysql-test/r/type_newdecimal.result @@ -185,7 +185,7 @@ select 1e10/0e0; 1e10/0e0 NULL Warnings: -Error 1365 Division by 0 +Warning 1365 Division by 0 create table wl1612 (col1 int, col2 decimal(38,10), col3 numeric(38,10)); insert into wl1612 values(1,12345678901234567890.1234567890,12345678901234567890.1234567890); select * from wl1612; @@ -205,27 +205,27 @@ NULL NULL NULL Warnings: -Error 1365 Division by 0 -Error 1365 Division by 0 -Error 1365 Division by 0 +Warning 1365 Division by 0 +Warning 1365 Division by 0 +Warning 1365 Division by 0 select col2/0 from wl1612; col2/0 NULL NULL NULL Warnings: -Error 1365 Division by 0 -Error 1365 Division by 0 -Error 1365 Division by 0 +Warning 1365 Division by 0 +Warning 1365 Division by 0 +Warning 1365 Division by 0 select col3/0 from wl1612; col3/0 NULL NULL NULL Warnings: -Error 1365 Division by 0 -Error 1365 Division by 0 -Error 1365 Division by 0 +Warning 1365 Division by 0 +Warning 1365 Division by 0 +Warning 1365 Division by 0 insert into wl1612 values(5,5000.0005,5000.0005); insert into wl1612 values(6,5000.0005,5000.0005); select sum(col2),sum(col3) from wl1612; @@ -788,12 +788,12 @@ select 1 / 1E-500; 1 / 1E-500 NULL Warnings: -Error 1365 Division by 0 +Warning 1365 Division by 0 select 1 / 0; 1 / 0 NULL Warnings: -Error 1365 Division by 0 +Warning 1365 Division by 0 set sql_mode='ansi,traditional'; CREATE TABLE Sow6_2f (col1 NUMERIC(4,2)); INSERT INTO Sow6_2f VALUES (10.55); @@ -819,11 +819,11 @@ NULL NULL NULL Warnings: -Error 1365 Division by 0 -Error 1365 Division by 0 -Error 1365 Division by 0 -Error 1365 Division by 0 -Error 1365 Division by 0 +Warning 1365 Division by 0 +Warning 1365 Division by 0 +Warning 1365 Division by 0 +Warning 1365 Division by 0 +Warning 1365 Division by 0 INSERT INTO Sow6_2f VALUES ('a59b'); ERROR HY000: Incorrect decimal value: 'a59b' for column 'col1' at row 1 drop table Sow6_2f; @@ -838,12 +838,12 @@ select 9999999999999999999999999999999999999999999999999999999999999999999999999 x 99999999999999999999999999999999999999999999999999999999999999999 Warnings: -Error 1292 Truncated incorrect DECIMAL value: '' +Warning 1292 Truncated incorrect DECIMAL value: '' select 9999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999 + 1 as x; x 100000000000000000000000000000000000000000000000000000000000000000 Warnings: -Error 1292 Truncated incorrect DECIMAL value: '' +Warning 1292 Truncated incorrect DECIMAL value: '' select 0.190287977636363637 + 0.040372670 * 0 - 0; 0.190287977636363637 + 0.040372670 * 0 - 0 0.190287977636363637 @@ -1380,15 +1380,15 @@ create table t1 (c1 decimal(64)); insert into t1 values( 89000000000000000000000000000000000000000000000000000000000000000000000000000000000000000); Warnings: -Error 1292 Truncated incorrect DECIMAL value: '' +Warning 1292 Truncated incorrect DECIMAL value: '' Warning 1264 Out of range value for column 'c1' at row 1 insert into t1 values( 99999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999 * 99999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999); Warnings: -Error 1292 Truncated incorrect DECIMAL value: '' -Error 1292 Truncated incorrect DECIMAL value: '' -Error 1292 Truncated incorrect DECIMAL value: '' +Warning 1292 Truncated incorrect DECIMAL value: '' +Warning 1292 Truncated incorrect DECIMAL value: '' +Warning 1292 Truncated incorrect DECIMAL value: '' Warning 1264 Out of range value for column 'c1' at row 1 insert into t1 values(1e100); Warnings: @@ -1432,7 +1432,7 @@ select cast(19999999999999999999 as unsigned); cast(19999999999999999999 as unsigned) 18446744073709551615 Warnings: -Error 1292 Truncated incorrect DECIMAL value: '' +Warning 1292 Truncated incorrect DECIMAL value: '' create table t1(a decimal(18)); insert into t1 values(123456789012345678); alter table t1 modify column a decimal(19); @@ -1444,12 +1444,12 @@ select cast(11.1234 as DECIMAL(3,2)); cast(11.1234 as DECIMAL(3,2)) 9.99 Warnings: -Error 1264 Out of range value for column 'cast(11.1234 as DECIMAL(3,2))' at row 1 +Warning 1264 Out of range value for column 'cast(11.1234 as DECIMAL(3,2))' at row 1 select * from (select cast(11.1234 as DECIMAL(3,2))) t; cast(11.1234 as DECIMAL(3,2)) 9.99 Warnings: -Error 1264 Out of range value for column 'cast(11.1234 as DECIMAL(3,2))' at row 1 +Warning 1264 Out of range value for column 'cast(11.1234 as DECIMAL(3,2))' at row 1 select cast(a as DECIMAL(3,2)) from (select 11.1233 as a UNION select 11.1234 @@ -1460,9 +1460,9 @@ cast(a as DECIMAL(3,2)) 9.99 9.99 Warnings: -Error 1264 Out of range value for column 'cast(a as DECIMAL(3,2))' at row 1 -Error 1264 Out of range value for column 'cast(a as DECIMAL(3,2))' at row 1 -Error 1264 Out of range value for column 'cast(a as DECIMAL(3,2))' at row 1 +Warning 1264 Out of range value for column 'cast(a as DECIMAL(3,2))' at row 1 +Warning 1264 Out of range value for column 'cast(a as DECIMAL(3,2))' at row 1 +Warning 1264 Out of range value for column 'cast(a as DECIMAL(3,2))' at row 1 select cast(a as DECIMAL(3,2)), count(*) from (select 11.1233 as a UNION select 11.1234 @@ -1471,10 +1471,10 @@ UNION select 12.1234 cast(a as DECIMAL(3,2)) count(*) 9.99 3 Warnings: -Error 1264 Out of range value for column 'cast(a as DECIMAL(3,2))' at row 1 -Error 1264 Out of range value for column 'cast(a as DECIMAL(3,2))' at row 1 -Error 1264 Out of range value for column 'cast(a as DECIMAL(3,2))' at row 1 -Error 1264 Out of range value for column 'cast(a as DECIMAL(3,2))' at row 1 +Warning 1264 Out of range value for column 'cast(a as DECIMAL(3,2))' at row 1 +Warning 1264 Out of range value for column 'cast(a as DECIMAL(3,2))' at row 1 +Warning 1264 Out of range value for column 'cast(a as DECIMAL(3,2))' at row 1 +Warning 1264 Out of range value for column 'cast(a as DECIMAL(3,2))' at row 1 create table t1 (s varchar(100)); insert into t1 values (0.00000000010000000000000000364321973154977415791655470655996396089904010295867919921875); drop table t1; @@ -1560,7 +1560,7 @@ select cast(143.481 as decimal(2,1)); cast(143.481 as decimal(2,1)) 9.9 Warnings: -Error 1264 Out of range value for column 'cast(143.481 as decimal(2,1))' at row 1 +Warning 1264 Out of range value for column 'cast(143.481 as decimal(2,1))' at row 1 select cast(-3.4 as decimal(2,1)); cast(-3.4 as decimal(2,1)) -3.4 @@ -1568,12 +1568,12 @@ select cast(99.6 as decimal(2,0)); cast(99.6 as decimal(2,0)) 99 Warnings: -Error 1264 Out of range value for column 'cast(99.6 as decimal(2,0))' at row 1 +Warning 1264 Out of range value for column 'cast(99.6 as decimal(2,0))' at row 1 select cast(-13.4 as decimal(2,1)); cast(-13.4 as decimal(2,1)) -9.9 Warnings: -Error 1264 Out of range value for column 'cast(-13.4 as decimal(2,1))' at row 1 +Warning 1264 Out of range value for column 'cast(-13.4 as decimal(2,1))' at row 1 select cast(98.6 as decimal(2,0)); cast(98.6 as decimal(2,0)) 99 @@ -1674,7 +1674,7 @@ CREATE TABLE t1 SELECT /* 82 */ 1000000000000000000000000000000000000000000000000000000000000000000000000000000001 AS c1; Warnings: -Error 1292 Truncated incorrect DECIMAL value: '' +Warning 1292 Truncated incorrect DECIMAL value: '' DESC t1; Field Type Null Key Default Extra c1 decimal(65,0) NO 0 @@ -1797,7 +1797,7 @@ CREATE TABLE t1 (a DECIMAL(30,30)); INSERT INTO t1 VALUES (0.1),(0.2),(0.3); CREATE TABLE t2 SELECT MIN(a + 0.0000000000000000000000000000001) AS c1 FROM t1; Warnings: -Note 1265 Data truncated for column 'c1' at row 3 +Note 1265 Data truncated for column 'c1' at row 4 DESC t2; Field Type Null Key Default Extra c1 decimal(32,30) YES NULL diff --git a/mysql-test/r/view.result b/mysql-test/r/view.result index b5e374aaf8c..e23e8930ddb 100644 --- a/mysql-test/r/view.result +++ b/mysql-test/r/view.result @@ -1111,8 +1111,8 @@ insert into v1 values(3); ERROR HY000: CHECK OPTION failed 'test.v1' insert ignore into v1 values (2),(3),(0); Warnings: -Error 1369 CHECK OPTION failed 'test.v1' -Error 1369 CHECK OPTION failed 'test.v1' +Warning 1369 CHECK OPTION failed 'test.v1' +Warning 1369 CHECK OPTION failed 'test.v1' select * from t1; a 1 @@ -1125,8 +1125,8 @@ create table t2 (a int); insert into t2 values (2),(3),(0); insert ignore into v1 SELECT a from t2; Warnings: -Error 1369 CHECK OPTION failed 'test.v1' -Error 1369 CHECK OPTION failed 'test.v1' +Warning 1369 CHECK OPTION failed 'test.v1' +Warning 1369 CHECK OPTION failed 'test.v1' select * from t1 order by a desc; a 1 @@ -1148,7 +1148,7 @@ a update v1 set a=a+1; update ignore v1,t2 set v1.a=v1.a+1 where v1.a=t2.a; Warnings: -Error 1369 CHECK OPTION failed 'test.v1' +Warning 1369 CHECK OPTION failed 'test.v1' select * from t1; a 1 @@ -1182,7 +1182,7 @@ insert into v1 values (1) on duplicate key update a=2; ERROR HY000: CHECK OPTION failed 'test.v1' insert ignore into v1 values (1) on duplicate key update a=2; Warnings: -Error 1369 CHECK OPTION failed 'test.v1' +Warning 1369 CHECK OPTION failed 'test.v1' select * from t1; a 1 @@ -1283,7 +1283,7 @@ insert ignore into v1 values (6); ERROR HY000: CHECK OPTION failed 'test.v1' insert ignore into v1 values (6),(3); Warnings: -Error 1369 CHECK OPTION failed 'test.v1' +Warning 1369 CHECK OPTION failed 'test.v1' select * from t1; s1 3 @@ -1328,9 +1328,9 @@ delete from t1; load data infile '../../std_data/loaddata3.dat' ignore into table v1 fields terminated by '' enclosed by '' ignore 1 lines; Warnings: Warning 1366 Incorrect integer value: 'error ' for column 'a' at row 3 -Error 1369 CHECK OPTION failed 'test.v1' +Warning 1369 CHECK OPTION failed 'test.v1' Warning 1366 Incorrect integer value: 'wrong end ' for column 'a' at row 4 -Error 1369 CHECK OPTION failed 'test.v1' +Warning 1369 CHECK OPTION failed 'test.v1' select * from t1 order by a,b; a b 1 row 1 @@ -1354,7 +1354,7 @@ concat('|',a,'|') concat('|',b,'|') delete from t1; load data infile '../../std_data/loaddata2.dat' ignore into table v1 fields terminated by ',' enclosed by ''''; Warnings: -Error 1369 CHECK OPTION failed 'test.v1' +Warning 1369 CHECK OPTION failed 'test.v1' Warning 1261 Row 2 doesn't contain data for all columns select concat('|',a,'|'), concat('|',b,'|') from t1; concat('|',a,'|') concat('|',b,'|') diff --git a/mysql-test/suite/binlog/r/binlog_index.result b/mysql-test/suite/binlog/r/binlog_index.result index d49ceb00501..69d877c5adc 100644 --- a/mysql-test/suite/binlog/r/binlog_index.result +++ b/mysql-test/suite/binlog/r/binlog_index.result @@ -34,7 +34,7 @@ purge binary logs TO 'master-bin.000002'; ERROR HY000: Fatal error during log purge show warnings; Level Code Message -Error 1377 a problem with deleting master-bin.000001; consider examining correspondence of your binlog index file to the actual binlog files +Warning 1377 a problem with deleting master-bin.000001; consider examining correspondence of your binlog index file to the actual binlog files Error 1377 Fatal error during log purge reset master; End of tests diff --git a/mysql-test/suite/binlog/r/binlog_unsafe.result b/mysql-test/suite/binlog/r/binlog_unsafe.result index 4c2c32ad8f1..3047ff54cf0 100644 --- a/mysql-test/suite/binlog/r/binlog_unsafe.result +++ b/mysql-test/suite/binlog/r/binlog_unsafe.result @@ -43,12 +43,6 @@ END| CALL proc(); Warnings: Note 1592 Statement may not be safe to log in statement format. -Note 1592 Statement may not be safe to log in statement format. -Note 1592 Statement may not be safe to log in statement format. -Note 1592 Statement may not be safe to log in statement format. -Note 1592 Statement may not be safe to log in statement format. -Note 1592 Statement may not be safe to log in statement format. -Note 1592 Statement may not be safe to log in statement format. ---- Insert from stored function ---- CREATE FUNCTION func() RETURNS INT @@ -67,12 +61,6 @@ func() 0 Warnings: Note 1592 Statement may not be safe to log in statement format. -Note 1592 Statement may not be safe to log in statement format. -Note 1592 Statement may not be safe to log in statement format. -Note 1592 Statement may not be safe to log in statement format. -Note 1592 Statement may not be safe to log in statement format. -Note 1592 Statement may not be safe to log in statement format. -Note 1592 Statement may not be safe to log in statement format. ---- Insert from trigger ---- CREATE TRIGGER trig BEFORE INSERT ON trigger_table @@ -90,12 +78,6 @@ INSERT INTO trigger_table VALUES ('bye.'); Warnings: Note 1592 Statement may not be safe to log in statement format. Note 1592 Statement may not be safe to log in statement format. -Note 1592 Statement may not be safe to log in statement format. -Note 1592 Statement may not be safe to log in statement format. -Note 1592 Statement may not be safe to log in statement format. -Note 1592 Statement may not be safe to log in statement format. -Note 1592 Statement may not be safe to log in statement format. -Note 1592 Statement may not be safe to log in statement format. ---- Insert from prepared statement ---- PREPARE p1 FROM 'INSERT INTO t1 VALUES (@@global.sync_binlog)'; PREPARE p2 FROM 'INSERT INTO t1 VALUES (@@session.insert_id)'; @@ -155,12 +137,6 @@ func5() 0 Warnings: Note 1592 Statement may not be safe to log in statement format. -Note 1592 Statement may not be safe to log in statement format. -Note 1592 Statement may not be safe to log in statement format. -Note 1592 Statement may not be safe to log in statement format. -Note 1592 Statement may not be safe to log in statement format. -Note 1592 Statement may not be safe to log in statement format. -Note 1592 Statement may not be safe to log in statement format. ==== Variables that should *not* be unsafe ==== INSERT INTO t1 VALUES (@@session.pseudo_thread_id); INSERT INTO t1 VALUES (@@session.pseudo_thread_id); @@ -215,9 +191,6 @@ END| CALL p1(); Warnings: Note 1592 Statement may not be safe to log in statement format. -Note 1592 Statement may not be safe to log in statement format. -Note 1592 Statement may not be safe to log in statement format. -Note 1592 Statement may not be safe to log in statement format. DROP PROCEDURE p1; DROP TABLE t1; DROP TABLE IF EXISTS t1; diff --git a/mysql-test/suite/funcs_1/r/innodb_func_view.result b/mysql-test/suite/funcs_1/r/innodb_func_view.result index 4beb0c8aaf2..172f410b949 100644 --- a/mysql-test/suite/funcs_1/r/innodb_func_view.result +++ b/mysql-test/suite/funcs_1/r/innodb_func_view.result @@ -945,8 +945,8 @@ AaBbCcDdEeFfGgHhIiJjÄäÜüÖö 9999999999999999999999999999999999.999999999999 0.000000000000000000000000000000 4 -1.000000000000000000000000000000 5 Warnings: -Error 1292 Truncated incorrect DECIMAL value: '' -Error 1292 Truncated incorrect DECIMAL value: '' +Warning 1292 Truncated incorrect DECIMAL value: '' +Warning 1292 Truncated incorrect DECIMAL value: '' SHOW CREATE VIEW v1; View Create View character_set_client collation_connection v1 CREATE ALGORITHM=UNDEFINED DEFINER=`root`@`localhost` SQL SECURITY DEFINER VIEW `v1` AS select left('AaBbCcDdEeFfGgHhIiJjÄäÜüÖö',`t1_values`.`my_decimal`) AS `LEFT('AaBbCcDdEeFfGgHhIiJjÄäÜüÖö', my_decimal)`,`t1_values`.`my_decimal` AS `my_decimal`,`t1_values`.`id` AS `id` from `t1_values` latin1 latin1_swedish_ci @@ -960,8 +960,8 @@ AaBbCcDdEeFfGgHhIiJjÄäÜüÖö 9999999999999999999999999999999999.999999999999 0.000000000000000000000000000000 4 -1.000000000000000000000000000000 5 Warnings: -Error 1292 Truncated incorrect DECIMAL value: '' -Error 1292 Truncated incorrect DECIMAL value: '' +Warning 1292 Truncated incorrect DECIMAL value: '' +Warning 1292 Truncated incorrect DECIMAL value: '' DROP VIEW v1; @@ -2587,9 +2587,9 @@ NULL NULL 1 0 0.000000000000000000000000000000 4 0 -1.000000000000000000000000000000 5 Warnings: -Error 1292 Truncated incorrect DECIMAL value: '' -Error 1292 Truncated incorrect DECIMAL value: '' -Error 1292 Truncated incorrect DECIMAL value: '' +Warning 1292 Truncated incorrect DECIMAL value: '' +Warning 1292 Truncated incorrect DECIMAL value: '' +Warning 1292 Truncated incorrect DECIMAL value: '' SHOW CREATE VIEW v1; View Create View character_set_client collation_connection v1 CREATE ALGORITHM=UNDEFINED DEFINER=`root`@`localhost` SQL SECURITY DEFINER VIEW `v1` AS select cast(`t1_values`.`my_decimal` as unsigned) AS `CAST(my_decimal AS UNSIGNED INTEGER)`,`t1_values`.`my_decimal` AS `my_decimal`,`t1_values`.`id` AS `id` from `t1_values` latin1 latin1_swedish_ci @@ -2603,9 +2603,9 @@ NULL NULL 1 0 0.000000000000000000000000000000 4 0 -1.000000000000000000000000000000 5 Warnings: -Error 1292 Truncated incorrect DECIMAL value: '' -Error 1292 Truncated incorrect DECIMAL value: '' -Error 1292 Truncated incorrect DECIMAL value: '' +Warning 1292 Truncated incorrect DECIMAL value: '' +Warning 1292 Truncated incorrect DECIMAL value: '' +Warning 1292 Truncated incorrect DECIMAL value: '' DROP VIEW v1; @@ -2955,8 +2955,8 @@ NULL NULL 1 0 0.000000000000000000000000000000 4 -1 -1.000000000000000000000000000000 5 Warnings: -Error 1292 Truncated incorrect DECIMAL value: '' -Error 1292 Truncated incorrect DECIMAL value: '' +Warning 1292 Truncated incorrect DECIMAL value: '' +Warning 1292 Truncated incorrect DECIMAL value: '' SHOW CREATE VIEW v1; View Create View character_set_client collation_connection v1 CREATE ALGORITHM=UNDEFINED DEFINER=`root`@`localhost` SQL SECURITY DEFINER VIEW `v1` AS select cast(`t1_values`.`my_decimal` as signed) AS `CAST(my_decimal AS SIGNED INTEGER)`,`t1_values`.`my_decimal` AS `my_decimal`,`t1_values`.`id` AS `id` from `t1_values` latin1 latin1_swedish_ci @@ -2970,8 +2970,8 @@ NULL NULL 1 0 0.000000000000000000000000000000 4 -1 -1.000000000000000000000000000000 5 Warnings: -Error 1292 Truncated incorrect DECIMAL value: '' -Error 1292 Truncated incorrect DECIMAL value: '' +Warning 1292 Truncated incorrect DECIMAL value: '' +Warning 1292 Truncated incorrect DECIMAL value: '' DROP VIEW v1; @@ -3282,10 +3282,10 @@ NULL NULL 1 -1.00 -1 5 -3333.33 -3333.3333 30 Warnings: -Error 1292 Truncated incorrect DECIMAL value: '' -Error 1264 Out of range value for column 'CAST(my_double AS DECIMAL(37,2))' at row 1 -Error 1292 Truncated incorrect DECIMAL value: '' -Error 1264 Out of range value for column 'CAST(my_double AS DECIMAL(37,2))' at row 1 +Warning 1292 Truncated incorrect DECIMAL value: '' +Warning 1264 Out of range value for column 'CAST(my_double AS DECIMAL(37,2))' at row 1 +Warning 1292 Truncated incorrect DECIMAL value: '' +Warning 1264 Out of range value for column 'CAST(my_double AS DECIMAL(37,2))' at row 1 SHOW CREATE VIEW v1; View Create View character_set_client collation_connection v1 CREATE ALGORITHM=UNDEFINED DEFINER=`root`@`localhost` SQL SECURITY DEFINER VIEW `v1` AS select cast(`t1_values`.`my_double` as decimal(37,2)) AS `CAST(my_double AS DECIMAL(37,2))`,`t1_values`.`my_double` AS `my_double`,`t1_values`.`id` AS `id` from `t1_values` latin1 latin1_swedish_ci @@ -3300,10 +3300,10 @@ NULL NULL 1 -1.00 -1 5 -3333.33 -3333.3333 30 Warnings: -Error 1292 Truncated incorrect DECIMAL value: '' -Error 1264 Out of range value for column 'CAST(my_double AS DECIMAL(37,2))' at row 1 -Error 1292 Truncated incorrect DECIMAL value: '' -Error 1264 Out of range value for column 'CAST(my_double AS DECIMAL(37,2))' at row 1 +Warning 1292 Truncated incorrect DECIMAL value: '' +Warning 1264 Out of range value for column 'CAST(my_double AS DECIMAL(37,2))' at row 1 +Warning 1292 Truncated incorrect DECIMAL value: '' +Warning 1264 Out of range value for column 'CAST(my_double AS DECIMAL(37,2))' at row 1 DROP VIEW v1; @@ -3372,9 +3372,9 @@ NULL NULL 1 -1.00 -1 5 -3333.33 -3333.3333 29 Warnings: -Error 1366 Incorrect decimal value: '' for column '' at row -1 -Error 1366 Incorrect decimal value: '' for column '' at row -1 -Error 1366 Incorrect decimal value: '' for column '' at row -1 +Warning 1366 Incorrect decimal value: '' for column '' at row -1 +Warning 1366 Incorrect decimal value: '' for column '' at row -1 +Warning 1366 Incorrect decimal value: '' for column '' at row -1 SHOW CREATE VIEW v1; View Create View character_set_client collation_connection v1 CREATE ALGORITHM=UNDEFINED DEFINER=`root`@`localhost` SQL SECURITY DEFINER VIEW `v1` AS select cast(`t1_values`.`my_varbinary_1000` as decimal(37,2)) AS `CAST(my_varbinary_1000 AS DECIMAL(37,2))`,`t1_values`.`my_varbinary_1000` AS `my_varbinary_1000`,`t1_values`.`id` AS `id` from `t1_values` latin1 latin1_swedish_ci @@ -3389,9 +3389,9 @@ NULL NULL 1 -1.00 -1 5 -3333.33 -3333.3333 29 Warnings: -Error 1366 Incorrect decimal value: '' for column '' at row -1 -Error 1366 Incorrect decimal value: '' for column '' at row -1 -Error 1366 Incorrect decimal value: '' for column '' at row -1 +Warning 1366 Incorrect decimal value: '' for column '' at row -1 +Warning 1366 Incorrect decimal value: '' for column '' at row -1 +Warning 1366 Incorrect decimal value: '' for column '' at row -1 DROP VIEW v1; @@ -3408,11 +3408,11 @@ NULL NULL 1 -1.00 -1 5 -3333.33 -3333.3333 28 Warnings: -Error 1366 Incorrect decimal value: '' for column '' at row -1 +Warning 1366 Incorrect decimal value: '' for column '' at row -1 Warning 1292 Truncated incorrect DECIMAL value: '' -Error 1366 Incorrect decimal value: '' for column '' at row -1 +Warning 1366 Incorrect decimal value: '' for column '' at row -1 Warning 1292 Truncated incorrect DECIMAL value: '<--------30 characters------->' -Error 1366 Incorrect decimal value: '' for column '' at row -1 +Warning 1366 Incorrect decimal value: '' for column '' at row -1 Warning 1292 Truncated incorrect DECIMAL value: ' ---@*$-- ' Warning 1292 Truncated incorrect DECIMAL value: '-1' Warning 1292 Truncated incorrect DECIMAL value: '-3333.3333' @@ -3430,11 +3430,11 @@ NULL NULL 1 -1.00 -1 -3333.33 -3333.3333 Warnings: -Error 1366 Incorrect decimal value: '' for column '' at row -1 +Warning 1366 Incorrect decimal value: '' for column '' at row -1 Warning 1292 Truncated incorrect DECIMAL value: '' -Error 1366 Incorrect decimal value: '' for column '' at row -1 +Warning 1366 Incorrect decimal value: '' for column '' at row -1 Warning 1292 Truncated incorrect DECIMAL value: '<--------30 characters------->' -Error 1366 Incorrect decimal value: '' for column '' at row -1 +Warning 1366 Incorrect decimal value: '' for column '' at row -1 Warning 1292 Truncated incorrect DECIMAL value: ' ---@*$-- ' Warning 1292 Truncated incorrect DECIMAL value: '-1' Warning 1292 Truncated incorrect DECIMAL value: '-3333.3333' @@ -3454,9 +3454,9 @@ NULL NULL 1 -1.00 -1 5 -3333.33 -3333.3333 27 Warnings: -Error 1366 Incorrect decimal value: '' for column '' at row -1 -Error 1366 Incorrect decimal value: '' for column '' at row -1 -Error 1366 Incorrect decimal value: '' for column '' at row -1 +Warning 1366 Incorrect decimal value: '' for column '' at row -1 +Warning 1366 Incorrect decimal value: '' for column '' at row -1 +Warning 1366 Incorrect decimal value: '' for column '' at row -1 SHOW CREATE VIEW v1; View Create View character_set_client collation_connection v1 CREATE ALGORITHM=UNDEFINED DEFINER=`root`@`localhost` SQL SECURITY DEFINER VIEW `v1` AS select cast(`t1_values`.`my_varchar_1000` as decimal(37,2)) AS `CAST(my_varchar_1000 AS DECIMAL(37,2))`,`t1_values`.`my_varchar_1000` AS `my_varchar_1000`,`t1_values`.`id` AS `id` from `t1_values` latin1 latin1_swedish_ci @@ -3471,9 +3471,9 @@ NULL NULL 1 -1.00 -1 5 -3333.33 -3333.3333 27 Warnings: -Error 1366 Incorrect decimal value: '' for column '' at row -1 -Error 1366 Incorrect decimal value: '' for column '' at row -1 -Error 1366 Incorrect decimal value: '' for column '' at row -1 +Warning 1366 Incorrect decimal value: '' for column '' at row -1 +Warning 1366 Incorrect decimal value: '' for column '' at row -1 +Warning 1366 Incorrect decimal value: '' for column '' at row -1 DROP VIEW v1; @@ -3490,11 +3490,11 @@ NULL NULL 1 -1.00 -1 5 -3333.33 -3333.3333 26 Warnings: -Error 1366 Incorrect decimal value: '' for column '' at row -1 +Warning 1366 Incorrect decimal value: '' for column '' at row -1 Warning 1292 Truncated incorrect DECIMAL value: ' ' -Error 1366 Incorrect decimal value: '' for column '' at row -1 +Warning 1366 Incorrect decimal value: '' for column '' at row -1 Warning 1292 Truncated incorrect DECIMAL value: '<--------30 characters------->' -Error 1366 Incorrect decimal value: '' for column '' at row -1 +Warning 1366 Incorrect decimal value: '' for column '' at row -1 Warning 1292 Truncated incorrect DECIMAL value: ' ---@*$-- ' SHOW CREATE VIEW v1; View Create View character_set_client collation_connection @@ -3510,11 +3510,11 @@ NULL NULL 1 -1.00 -1 5 -3333.33 -3333.3333 26 Warnings: -Error 1366 Incorrect decimal value: '' for column '' at row -1 +Warning 1366 Incorrect decimal value: '' for column '' at row -1 Warning 1292 Truncated incorrect DECIMAL value: ' ' -Error 1366 Incorrect decimal value: '' for column '' at row -1 +Warning 1366 Incorrect decimal value: '' for column '' at row -1 Warning 1292 Truncated incorrect DECIMAL value: '<--------30 characters------->' -Error 1366 Incorrect decimal value: '' for column '' at row -1 +Warning 1366 Incorrect decimal value: '' for column '' at row -1 Warning 1292 Truncated incorrect DECIMAL value: ' ---@*$-- ' DROP VIEW v1; diff --git a/mysql-test/suite/funcs_1/r/innodb_storedproc_02.result b/mysql-test/suite/funcs_1/r/innodb_storedproc_02.result index 65fc5b5afc9..3e2d084aa0c 100644 --- a/mysql-test/suite/funcs_1/r/innodb_storedproc_02.result +++ b/mysql-test/suite/funcs_1/r/innodb_storedproc_02.result @@ -550,9 +550,6 @@ exit handler 2 exit handler 2 exit handler 1 exit handler 1 -Warnings: -Note 1051 Unknown table 'tqq' -Note 1051 Unknown table 'tqq' create table res_t1(w char unique, x char); insert into res_t1 values ('a', 'b'); CREATE PROCEDURE h1 () diff --git a/mysql-test/suite/funcs_1/r/memory_func_view.result b/mysql-test/suite/funcs_1/r/memory_func_view.result index 4e48d9412d1..a386272b8ab 100644 --- a/mysql-test/suite/funcs_1/r/memory_func_view.result +++ b/mysql-test/suite/funcs_1/r/memory_func_view.result @@ -946,8 +946,8 @@ AaBbCcDdEeFfGgHhIiJjÄäÜüÖö 9999999999999999999999999999999999.999999999999 0.000000000000000000000000000000 4 -1.000000000000000000000000000000 5 Warnings: -Error 1292 Truncated incorrect DECIMAL value: '' -Error 1292 Truncated incorrect DECIMAL value: '' +Warning 1292 Truncated incorrect DECIMAL value: '' +Warning 1292 Truncated incorrect DECIMAL value: '' SHOW CREATE VIEW v1; View Create View character_set_client collation_connection v1 CREATE ALGORITHM=UNDEFINED DEFINER=`root`@`localhost` SQL SECURITY DEFINER VIEW `v1` AS select left('AaBbCcDdEeFfGgHhIiJjÄäÜüÖö',`t1_values`.`my_decimal`) AS `LEFT('AaBbCcDdEeFfGgHhIiJjÄäÜüÖö', my_decimal)`,`t1_values`.`my_decimal` AS `my_decimal`,`t1_values`.`id` AS `id` from `t1_values` latin1 latin1_swedish_ci @@ -961,8 +961,8 @@ AaBbCcDdEeFfGgHhIiJjÄäÜüÖö 9999999999999999999999999999999999.999999999999 0.000000000000000000000000000000 4 -1.000000000000000000000000000000 5 Warnings: -Error 1292 Truncated incorrect DECIMAL value: '' -Error 1292 Truncated incorrect DECIMAL value: '' +Warning 1292 Truncated incorrect DECIMAL value: '' +Warning 1292 Truncated incorrect DECIMAL value: '' DROP VIEW v1; @@ -2588,9 +2588,9 @@ NULL NULL 1 0 0.000000000000000000000000000000 4 0 -1.000000000000000000000000000000 5 Warnings: -Error 1292 Truncated incorrect DECIMAL value: '' -Error 1292 Truncated incorrect DECIMAL value: '' -Error 1292 Truncated incorrect DECIMAL value: '' +Warning 1292 Truncated incorrect DECIMAL value: '' +Warning 1292 Truncated incorrect DECIMAL value: '' +Warning 1292 Truncated incorrect DECIMAL value: '' SHOW CREATE VIEW v1; View Create View character_set_client collation_connection v1 CREATE ALGORITHM=UNDEFINED DEFINER=`root`@`localhost` SQL SECURITY DEFINER VIEW `v1` AS select cast(`t1_values`.`my_decimal` as unsigned) AS `CAST(my_decimal AS UNSIGNED INTEGER)`,`t1_values`.`my_decimal` AS `my_decimal`,`t1_values`.`id` AS `id` from `t1_values` latin1 latin1_swedish_ci @@ -2604,9 +2604,9 @@ NULL NULL 1 0 0.000000000000000000000000000000 4 0 -1.000000000000000000000000000000 5 Warnings: -Error 1292 Truncated incorrect DECIMAL value: '' -Error 1292 Truncated incorrect DECIMAL value: '' -Error 1292 Truncated incorrect DECIMAL value: '' +Warning 1292 Truncated incorrect DECIMAL value: '' +Warning 1292 Truncated incorrect DECIMAL value: '' +Warning 1292 Truncated incorrect DECIMAL value: '' DROP VIEW v1; @@ -2956,8 +2956,8 @@ NULL NULL 1 0 0.000000000000000000000000000000 4 -1 -1.000000000000000000000000000000 5 Warnings: -Error 1292 Truncated incorrect DECIMAL value: '' -Error 1292 Truncated incorrect DECIMAL value: '' +Warning 1292 Truncated incorrect DECIMAL value: '' +Warning 1292 Truncated incorrect DECIMAL value: '' SHOW CREATE VIEW v1; View Create View character_set_client collation_connection v1 CREATE ALGORITHM=UNDEFINED DEFINER=`root`@`localhost` SQL SECURITY DEFINER VIEW `v1` AS select cast(`t1_values`.`my_decimal` as signed) AS `CAST(my_decimal AS SIGNED INTEGER)`,`t1_values`.`my_decimal` AS `my_decimal`,`t1_values`.`id` AS `id` from `t1_values` latin1 latin1_swedish_ci @@ -2971,8 +2971,8 @@ NULL NULL 1 0 0.000000000000000000000000000000 4 -1 -1.000000000000000000000000000000 5 Warnings: -Error 1292 Truncated incorrect DECIMAL value: '' -Error 1292 Truncated incorrect DECIMAL value: '' +Warning 1292 Truncated incorrect DECIMAL value: '' +Warning 1292 Truncated incorrect DECIMAL value: '' DROP VIEW v1; @@ -3283,10 +3283,10 @@ NULL NULL 1 -1.00 -1 5 -3333.33 -3333.3333 30 Warnings: -Error 1292 Truncated incorrect DECIMAL value: '' -Error 1264 Out of range value for column 'CAST(my_double AS DECIMAL(37,2))' at row 1 -Error 1292 Truncated incorrect DECIMAL value: '' -Error 1264 Out of range value for column 'CAST(my_double AS DECIMAL(37,2))' at row 1 +Warning 1292 Truncated incorrect DECIMAL value: '' +Warning 1264 Out of range value for column 'CAST(my_double AS DECIMAL(37,2))' at row 1 +Warning 1292 Truncated incorrect DECIMAL value: '' +Warning 1264 Out of range value for column 'CAST(my_double AS DECIMAL(37,2))' at row 1 SHOW CREATE VIEW v1; View Create View character_set_client collation_connection v1 CREATE ALGORITHM=UNDEFINED DEFINER=`root`@`localhost` SQL SECURITY DEFINER VIEW `v1` AS select cast(`t1_values`.`my_double` as decimal(37,2)) AS `CAST(my_double AS DECIMAL(37,2))`,`t1_values`.`my_double` AS `my_double`,`t1_values`.`id` AS `id` from `t1_values` latin1 latin1_swedish_ci @@ -3301,10 +3301,10 @@ NULL NULL 1 -1.00 -1 5 -3333.33 -3333.3333 30 Warnings: -Error 1292 Truncated incorrect DECIMAL value: '' -Error 1264 Out of range value for column 'CAST(my_double AS DECIMAL(37,2))' at row 1 -Error 1292 Truncated incorrect DECIMAL value: '' -Error 1264 Out of range value for column 'CAST(my_double AS DECIMAL(37,2))' at row 1 +Warning 1292 Truncated incorrect DECIMAL value: '' +Warning 1264 Out of range value for column 'CAST(my_double AS DECIMAL(37,2))' at row 1 +Warning 1292 Truncated incorrect DECIMAL value: '' +Warning 1264 Out of range value for column 'CAST(my_double AS DECIMAL(37,2))' at row 1 DROP VIEW v1; @@ -3373,9 +3373,9 @@ NULL NULL 1 -1.00 -1 5 -3333.33 -3333.3333 29 Warnings: -Error 1366 Incorrect decimal value: '' for column '' at row -1 -Error 1366 Incorrect decimal value: '' for column '' at row -1 -Error 1366 Incorrect decimal value: '' for column '' at row -1 +Warning 1366 Incorrect decimal value: '' for column '' at row -1 +Warning 1366 Incorrect decimal value: '' for column '' at row -1 +Warning 1366 Incorrect decimal value: '' for column '' at row -1 SHOW CREATE VIEW v1; View Create View character_set_client collation_connection v1 CREATE ALGORITHM=UNDEFINED DEFINER=`root`@`localhost` SQL SECURITY DEFINER VIEW `v1` AS select cast(`t1_values`.`my_varbinary_1000` as decimal(37,2)) AS `CAST(my_varbinary_1000 AS DECIMAL(37,2))`,`t1_values`.`my_varbinary_1000` AS `my_varbinary_1000`,`t1_values`.`id` AS `id` from `t1_values` latin1 latin1_swedish_ci @@ -3390,9 +3390,9 @@ NULL NULL 1 -1.00 -1 5 -3333.33 -3333.3333 29 Warnings: -Error 1366 Incorrect decimal value: '' for column '' at row -1 -Error 1366 Incorrect decimal value: '' for column '' at row -1 -Error 1366 Incorrect decimal value: '' for column '' at row -1 +Warning 1366 Incorrect decimal value: '' for column '' at row -1 +Warning 1366 Incorrect decimal value: '' for column '' at row -1 +Warning 1366 Incorrect decimal value: '' for column '' at row -1 DROP VIEW v1; @@ -3409,11 +3409,11 @@ NULL NULL 1 -1.00 -1 5 -3333.33 -3333.3333 28 Warnings: -Error 1366 Incorrect decimal value: '' for column '' at row -1 +Warning 1366 Incorrect decimal value: '' for column '' at row -1 Warning 1292 Truncated incorrect DECIMAL value: '' -Error 1366 Incorrect decimal value: '' for column '' at row -1 +Warning 1366 Incorrect decimal value: '' for column '' at row -1 Warning 1292 Truncated incorrect DECIMAL value: '<--------30 characters------->' -Error 1366 Incorrect decimal value: '' for column '' at row -1 +Warning 1366 Incorrect decimal value: '' for column '' at row -1 Warning 1292 Truncated incorrect DECIMAL value: ' ---@*$-- ' Warning 1292 Truncated incorrect DECIMAL value: '-1' Warning 1292 Truncated incorrect DECIMAL value: '-3333.3333' @@ -3431,11 +3431,11 @@ NULL NULL 1 -1.00 -1 -3333.33 -3333.3333 Warnings: -Error 1366 Incorrect decimal value: '' for column '' at row -1 +Warning 1366 Incorrect decimal value: '' for column '' at row -1 Warning 1292 Truncated incorrect DECIMAL value: '' -Error 1366 Incorrect decimal value: '' for column '' at row -1 +Warning 1366 Incorrect decimal value: '' for column '' at row -1 Warning 1292 Truncated incorrect DECIMAL value: '<--------30 characters------->' -Error 1366 Incorrect decimal value: '' for column '' at row -1 +Warning 1366 Incorrect decimal value: '' for column '' at row -1 Warning 1292 Truncated incorrect DECIMAL value: ' ---@*$-- ' Warning 1292 Truncated incorrect DECIMAL value: '-1' Warning 1292 Truncated incorrect DECIMAL value: '-3333.3333' @@ -3455,9 +3455,9 @@ NULL NULL 1 -1.00 -1 5 -3333.33 -3333.3333 27 Warnings: -Error 1366 Incorrect decimal value: '' for column '' at row -1 -Error 1366 Incorrect decimal value: '' for column '' at row -1 -Error 1366 Incorrect decimal value: '' for column '' at row -1 +Warning 1366 Incorrect decimal value: '' for column '' at row -1 +Warning 1366 Incorrect decimal value: '' for column '' at row -1 +Warning 1366 Incorrect decimal value: '' for column '' at row -1 SHOW CREATE VIEW v1; View Create View character_set_client collation_connection v1 CREATE ALGORITHM=UNDEFINED DEFINER=`root`@`localhost` SQL SECURITY DEFINER VIEW `v1` AS select cast(`t1_values`.`my_varchar_1000` as decimal(37,2)) AS `CAST(my_varchar_1000 AS DECIMAL(37,2))`,`t1_values`.`my_varchar_1000` AS `my_varchar_1000`,`t1_values`.`id` AS `id` from `t1_values` latin1 latin1_swedish_ci @@ -3472,9 +3472,9 @@ NULL NULL 1 -1.00 -1 5 -3333.33 -3333.3333 27 Warnings: -Error 1366 Incorrect decimal value: '' for column '' at row -1 -Error 1366 Incorrect decimal value: '' for column '' at row -1 -Error 1366 Incorrect decimal value: '' for column '' at row -1 +Warning 1366 Incorrect decimal value: '' for column '' at row -1 +Warning 1366 Incorrect decimal value: '' for column '' at row -1 +Warning 1366 Incorrect decimal value: '' for column '' at row -1 DROP VIEW v1; @@ -3491,11 +3491,11 @@ NULL NULL 1 -1.00 -1 5 -3333.33 -3333.3333 26 Warnings: -Error 1366 Incorrect decimal value: '' for column '' at row -1 +Warning 1366 Incorrect decimal value: '' for column '' at row -1 Warning 1292 Truncated incorrect DECIMAL value: ' ' -Error 1366 Incorrect decimal value: '' for column '' at row -1 +Warning 1366 Incorrect decimal value: '' for column '' at row -1 Warning 1292 Truncated incorrect DECIMAL value: '<--------30 characters------->' -Error 1366 Incorrect decimal value: '' for column '' at row -1 +Warning 1366 Incorrect decimal value: '' for column '' at row -1 Warning 1292 Truncated incorrect DECIMAL value: ' ---@*$-- ' SHOW CREATE VIEW v1; View Create View character_set_client collation_connection @@ -3511,11 +3511,11 @@ NULL NULL 1 -1.00 -1 5 -3333.33 -3333.3333 26 Warnings: -Error 1366 Incorrect decimal value: '' for column '' at row -1 +Warning 1366 Incorrect decimal value: '' for column '' at row -1 Warning 1292 Truncated incorrect DECIMAL value: ' ' -Error 1366 Incorrect decimal value: '' for column '' at row -1 +Warning 1366 Incorrect decimal value: '' for column '' at row -1 Warning 1292 Truncated incorrect DECIMAL value: '<--------30 characters------->' -Error 1366 Incorrect decimal value: '' for column '' at row -1 +Warning 1366 Incorrect decimal value: '' for column '' at row -1 Warning 1292 Truncated incorrect DECIMAL value: ' ---@*$-- ' DROP VIEW v1; diff --git a/mysql-test/suite/funcs_1/r/memory_storedproc_02.result b/mysql-test/suite/funcs_1/r/memory_storedproc_02.result index 6b474621685..16dde71400e 100644 --- a/mysql-test/suite/funcs_1/r/memory_storedproc_02.result +++ b/mysql-test/suite/funcs_1/r/memory_storedproc_02.result @@ -551,9 +551,6 @@ exit handler 2 exit handler 2 exit handler 1 exit handler 1 -Warnings: -Note 1051 Unknown table 'tqq' -Note 1051 Unknown table 'tqq' create table res_t1(w char unique, x char); insert into res_t1 values ('a', 'b'); CREATE PROCEDURE h1 () diff --git a/mysql-test/suite/funcs_1/r/myisam_func_view.result b/mysql-test/suite/funcs_1/r/myisam_func_view.result index 4e48d9412d1..a386272b8ab 100644 --- a/mysql-test/suite/funcs_1/r/myisam_func_view.result +++ b/mysql-test/suite/funcs_1/r/myisam_func_view.result @@ -946,8 +946,8 @@ AaBbCcDdEeFfGgHhIiJjÄäÜüÖö 9999999999999999999999999999999999.999999999999 0.000000000000000000000000000000 4 -1.000000000000000000000000000000 5 Warnings: -Error 1292 Truncated incorrect DECIMAL value: '' -Error 1292 Truncated incorrect DECIMAL value: '' +Warning 1292 Truncated incorrect DECIMAL value: '' +Warning 1292 Truncated incorrect DECIMAL value: '' SHOW CREATE VIEW v1; View Create View character_set_client collation_connection v1 CREATE ALGORITHM=UNDEFINED DEFINER=`root`@`localhost` SQL SECURITY DEFINER VIEW `v1` AS select left('AaBbCcDdEeFfGgHhIiJjÄäÜüÖö',`t1_values`.`my_decimal`) AS `LEFT('AaBbCcDdEeFfGgHhIiJjÄäÜüÖö', my_decimal)`,`t1_values`.`my_decimal` AS `my_decimal`,`t1_values`.`id` AS `id` from `t1_values` latin1 latin1_swedish_ci @@ -961,8 +961,8 @@ AaBbCcDdEeFfGgHhIiJjÄäÜüÖö 9999999999999999999999999999999999.999999999999 0.000000000000000000000000000000 4 -1.000000000000000000000000000000 5 Warnings: -Error 1292 Truncated incorrect DECIMAL value: '' -Error 1292 Truncated incorrect DECIMAL value: '' +Warning 1292 Truncated incorrect DECIMAL value: '' +Warning 1292 Truncated incorrect DECIMAL value: '' DROP VIEW v1; @@ -2588,9 +2588,9 @@ NULL NULL 1 0 0.000000000000000000000000000000 4 0 -1.000000000000000000000000000000 5 Warnings: -Error 1292 Truncated incorrect DECIMAL value: '' -Error 1292 Truncated incorrect DECIMAL value: '' -Error 1292 Truncated incorrect DECIMAL value: '' +Warning 1292 Truncated incorrect DECIMAL value: '' +Warning 1292 Truncated incorrect DECIMAL value: '' +Warning 1292 Truncated incorrect DECIMAL value: '' SHOW CREATE VIEW v1; View Create View character_set_client collation_connection v1 CREATE ALGORITHM=UNDEFINED DEFINER=`root`@`localhost` SQL SECURITY DEFINER VIEW `v1` AS select cast(`t1_values`.`my_decimal` as unsigned) AS `CAST(my_decimal AS UNSIGNED INTEGER)`,`t1_values`.`my_decimal` AS `my_decimal`,`t1_values`.`id` AS `id` from `t1_values` latin1 latin1_swedish_ci @@ -2604,9 +2604,9 @@ NULL NULL 1 0 0.000000000000000000000000000000 4 0 -1.000000000000000000000000000000 5 Warnings: -Error 1292 Truncated incorrect DECIMAL value: '' -Error 1292 Truncated incorrect DECIMAL value: '' -Error 1292 Truncated incorrect DECIMAL value: '' +Warning 1292 Truncated incorrect DECIMAL value: '' +Warning 1292 Truncated incorrect DECIMAL value: '' +Warning 1292 Truncated incorrect DECIMAL value: '' DROP VIEW v1; @@ -2956,8 +2956,8 @@ NULL NULL 1 0 0.000000000000000000000000000000 4 -1 -1.000000000000000000000000000000 5 Warnings: -Error 1292 Truncated incorrect DECIMAL value: '' -Error 1292 Truncated incorrect DECIMAL value: '' +Warning 1292 Truncated incorrect DECIMAL value: '' +Warning 1292 Truncated incorrect DECIMAL value: '' SHOW CREATE VIEW v1; View Create View character_set_client collation_connection v1 CREATE ALGORITHM=UNDEFINED DEFINER=`root`@`localhost` SQL SECURITY DEFINER VIEW `v1` AS select cast(`t1_values`.`my_decimal` as signed) AS `CAST(my_decimal AS SIGNED INTEGER)`,`t1_values`.`my_decimal` AS `my_decimal`,`t1_values`.`id` AS `id` from `t1_values` latin1 latin1_swedish_ci @@ -2971,8 +2971,8 @@ NULL NULL 1 0 0.000000000000000000000000000000 4 -1 -1.000000000000000000000000000000 5 Warnings: -Error 1292 Truncated incorrect DECIMAL value: '' -Error 1292 Truncated incorrect DECIMAL value: '' +Warning 1292 Truncated incorrect DECIMAL value: '' +Warning 1292 Truncated incorrect DECIMAL value: '' DROP VIEW v1; @@ -3283,10 +3283,10 @@ NULL NULL 1 -1.00 -1 5 -3333.33 -3333.3333 30 Warnings: -Error 1292 Truncated incorrect DECIMAL value: '' -Error 1264 Out of range value for column 'CAST(my_double AS DECIMAL(37,2))' at row 1 -Error 1292 Truncated incorrect DECIMAL value: '' -Error 1264 Out of range value for column 'CAST(my_double AS DECIMAL(37,2))' at row 1 +Warning 1292 Truncated incorrect DECIMAL value: '' +Warning 1264 Out of range value for column 'CAST(my_double AS DECIMAL(37,2))' at row 1 +Warning 1292 Truncated incorrect DECIMAL value: '' +Warning 1264 Out of range value for column 'CAST(my_double AS DECIMAL(37,2))' at row 1 SHOW CREATE VIEW v1; View Create View character_set_client collation_connection v1 CREATE ALGORITHM=UNDEFINED DEFINER=`root`@`localhost` SQL SECURITY DEFINER VIEW `v1` AS select cast(`t1_values`.`my_double` as decimal(37,2)) AS `CAST(my_double AS DECIMAL(37,2))`,`t1_values`.`my_double` AS `my_double`,`t1_values`.`id` AS `id` from `t1_values` latin1 latin1_swedish_ci @@ -3301,10 +3301,10 @@ NULL NULL 1 -1.00 -1 5 -3333.33 -3333.3333 30 Warnings: -Error 1292 Truncated incorrect DECIMAL value: '' -Error 1264 Out of range value for column 'CAST(my_double AS DECIMAL(37,2))' at row 1 -Error 1292 Truncated incorrect DECIMAL value: '' -Error 1264 Out of range value for column 'CAST(my_double AS DECIMAL(37,2))' at row 1 +Warning 1292 Truncated incorrect DECIMAL value: '' +Warning 1264 Out of range value for column 'CAST(my_double AS DECIMAL(37,2))' at row 1 +Warning 1292 Truncated incorrect DECIMAL value: '' +Warning 1264 Out of range value for column 'CAST(my_double AS DECIMAL(37,2))' at row 1 DROP VIEW v1; @@ -3373,9 +3373,9 @@ NULL NULL 1 -1.00 -1 5 -3333.33 -3333.3333 29 Warnings: -Error 1366 Incorrect decimal value: '' for column '' at row -1 -Error 1366 Incorrect decimal value: '' for column '' at row -1 -Error 1366 Incorrect decimal value: '' for column '' at row -1 +Warning 1366 Incorrect decimal value: '' for column '' at row -1 +Warning 1366 Incorrect decimal value: '' for column '' at row -1 +Warning 1366 Incorrect decimal value: '' for column '' at row -1 SHOW CREATE VIEW v1; View Create View character_set_client collation_connection v1 CREATE ALGORITHM=UNDEFINED DEFINER=`root`@`localhost` SQL SECURITY DEFINER VIEW `v1` AS select cast(`t1_values`.`my_varbinary_1000` as decimal(37,2)) AS `CAST(my_varbinary_1000 AS DECIMAL(37,2))`,`t1_values`.`my_varbinary_1000` AS `my_varbinary_1000`,`t1_values`.`id` AS `id` from `t1_values` latin1 latin1_swedish_ci @@ -3390,9 +3390,9 @@ NULL NULL 1 -1.00 -1 5 -3333.33 -3333.3333 29 Warnings: -Error 1366 Incorrect decimal value: '' for column '' at row -1 -Error 1366 Incorrect decimal value: '' for column '' at row -1 -Error 1366 Incorrect decimal value: '' for column '' at row -1 +Warning 1366 Incorrect decimal value: '' for column '' at row -1 +Warning 1366 Incorrect decimal value: '' for column '' at row -1 +Warning 1366 Incorrect decimal value: '' for column '' at row -1 DROP VIEW v1; @@ -3409,11 +3409,11 @@ NULL NULL 1 -1.00 -1 5 -3333.33 -3333.3333 28 Warnings: -Error 1366 Incorrect decimal value: '' for column '' at row -1 +Warning 1366 Incorrect decimal value: '' for column '' at row -1 Warning 1292 Truncated incorrect DECIMAL value: '' -Error 1366 Incorrect decimal value: '' for column '' at row -1 +Warning 1366 Incorrect decimal value: '' for column '' at row -1 Warning 1292 Truncated incorrect DECIMAL value: '<--------30 characters------->' -Error 1366 Incorrect decimal value: '' for column '' at row -1 +Warning 1366 Incorrect decimal value: '' for column '' at row -1 Warning 1292 Truncated incorrect DECIMAL value: ' ---@*$-- ' Warning 1292 Truncated incorrect DECIMAL value: '-1' Warning 1292 Truncated incorrect DECIMAL value: '-3333.3333' @@ -3431,11 +3431,11 @@ NULL NULL 1 -1.00 -1 -3333.33 -3333.3333 Warnings: -Error 1366 Incorrect decimal value: '' for column '' at row -1 +Warning 1366 Incorrect decimal value: '' for column '' at row -1 Warning 1292 Truncated incorrect DECIMAL value: '' -Error 1366 Incorrect decimal value: '' for column '' at row -1 +Warning 1366 Incorrect decimal value: '' for column '' at row -1 Warning 1292 Truncated incorrect DECIMAL value: '<--------30 characters------->' -Error 1366 Incorrect decimal value: '' for column '' at row -1 +Warning 1366 Incorrect decimal value: '' for column '' at row -1 Warning 1292 Truncated incorrect DECIMAL value: ' ---@*$-- ' Warning 1292 Truncated incorrect DECIMAL value: '-1' Warning 1292 Truncated incorrect DECIMAL value: '-3333.3333' @@ -3455,9 +3455,9 @@ NULL NULL 1 -1.00 -1 5 -3333.33 -3333.3333 27 Warnings: -Error 1366 Incorrect decimal value: '' for column '' at row -1 -Error 1366 Incorrect decimal value: '' for column '' at row -1 -Error 1366 Incorrect decimal value: '' for column '' at row -1 +Warning 1366 Incorrect decimal value: '' for column '' at row -1 +Warning 1366 Incorrect decimal value: '' for column '' at row -1 +Warning 1366 Incorrect decimal value: '' for column '' at row -1 SHOW CREATE VIEW v1; View Create View character_set_client collation_connection v1 CREATE ALGORITHM=UNDEFINED DEFINER=`root`@`localhost` SQL SECURITY DEFINER VIEW `v1` AS select cast(`t1_values`.`my_varchar_1000` as decimal(37,2)) AS `CAST(my_varchar_1000 AS DECIMAL(37,2))`,`t1_values`.`my_varchar_1000` AS `my_varchar_1000`,`t1_values`.`id` AS `id` from `t1_values` latin1 latin1_swedish_ci @@ -3472,9 +3472,9 @@ NULL NULL 1 -1.00 -1 5 -3333.33 -3333.3333 27 Warnings: -Error 1366 Incorrect decimal value: '' for column '' at row -1 -Error 1366 Incorrect decimal value: '' for column '' at row -1 -Error 1366 Incorrect decimal value: '' for column '' at row -1 +Warning 1366 Incorrect decimal value: '' for column '' at row -1 +Warning 1366 Incorrect decimal value: '' for column '' at row -1 +Warning 1366 Incorrect decimal value: '' for column '' at row -1 DROP VIEW v1; @@ -3491,11 +3491,11 @@ NULL NULL 1 -1.00 -1 5 -3333.33 -3333.3333 26 Warnings: -Error 1366 Incorrect decimal value: '' for column '' at row -1 +Warning 1366 Incorrect decimal value: '' for column '' at row -1 Warning 1292 Truncated incorrect DECIMAL value: ' ' -Error 1366 Incorrect decimal value: '' for column '' at row -1 +Warning 1366 Incorrect decimal value: '' for column '' at row -1 Warning 1292 Truncated incorrect DECIMAL value: '<--------30 characters------->' -Error 1366 Incorrect decimal value: '' for column '' at row -1 +Warning 1366 Incorrect decimal value: '' for column '' at row -1 Warning 1292 Truncated incorrect DECIMAL value: ' ---@*$-- ' SHOW CREATE VIEW v1; View Create View character_set_client collation_connection @@ -3511,11 +3511,11 @@ NULL NULL 1 -1.00 -1 5 -3333.33 -3333.3333 26 Warnings: -Error 1366 Incorrect decimal value: '' for column '' at row -1 +Warning 1366 Incorrect decimal value: '' for column '' at row -1 Warning 1292 Truncated incorrect DECIMAL value: ' ' -Error 1366 Incorrect decimal value: '' for column '' at row -1 +Warning 1366 Incorrect decimal value: '' for column '' at row -1 Warning 1292 Truncated incorrect DECIMAL value: '<--------30 characters------->' -Error 1366 Incorrect decimal value: '' for column '' at row -1 +Warning 1366 Incorrect decimal value: '' for column '' at row -1 Warning 1292 Truncated incorrect DECIMAL value: ' ---@*$-- ' DROP VIEW v1; diff --git a/mysql-test/suite/funcs_1/r/myisam_storedproc_02.result b/mysql-test/suite/funcs_1/r/myisam_storedproc_02.result index 6b474621685..16dde71400e 100644 --- a/mysql-test/suite/funcs_1/r/myisam_storedproc_02.result +++ b/mysql-test/suite/funcs_1/r/myisam_storedproc_02.result @@ -551,9 +551,6 @@ exit handler 2 exit handler 2 exit handler 1 exit handler 1 -Warnings: -Note 1051 Unknown table 'tqq' -Note 1051 Unknown table 'tqq' create table res_t1(w char unique, x char); insert into res_t1 values ('a', 'b'); CREATE PROCEDURE h1 () diff --git a/mysql-test/suite/funcs_1/r/ndb_func_view.result b/mysql-test/suite/funcs_1/r/ndb_func_view.result index 4beb0c8aaf2..172f410b949 100644 --- a/mysql-test/suite/funcs_1/r/ndb_func_view.result +++ b/mysql-test/suite/funcs_1/r/ndb_func_view.result @@ -945,8 +945,8 @@ AaBbCcDdEeFfGgHhIiJjÄäÜüÖö 9999999999999999999999999999999999.999999999999 0.000000000000000000000000000000 4 -1.000000000000000000000000000000 5 Warnings: -Error 1292 Truncated incorrect DECIMAL value: '' -Error 1292 Truncated incorrect DECIMAL value: '' +Warning 1292 Truncated incorrect DECIMAL value: '' +Warning 1292 Truncated incorrect DECIMAL value: '' SHOW CREATE VIEW v1; View Create View character_set_client collation_connection v1 CREATE ALGORITHM=UNDEFINED DEFINER=`root`@`localhost` SQL SECURITY DEFINER VIEW `v1` AS select left('AaBbCcDdEeFfGgHhIiJjÄäÜüÖö',`t1_values`.`my_decimal`) AS `LEFT('AaBbCcDdEeFfGgHhIiJjÄäÜüÖö', my_decimal)`,`t1_values`.`my_decimal` AS `my_decimal`,`t1_values`.`id` AS `id` from `t1_values` latin1 latin1_swedish_ci @@ -960,8 +960,8 @@ AaBbCcDdEeFfGgHhIiJjÄäÜüÖö 9999999999999999999999999999999999.999999999999 0.000000000000000000000000000000 4 -1.000000000000000000000000000000 5 Warnings: -Error 1292 Truncated incorrect DECIMAL value: '' -Error 1292 Truncated incorrect DECIMAL value: '' +Warning 1292 Truncated incorrect DECIMAL value: '' +Warning 1292 Truncated incorrect DECIMAL value: '' DROP VIEW v1; @@ -2587,9 +2587,9 @@ NULL NULL 1 0 0.000000000000000000000000000000 4 0 -1.000000000000000000000000000000 5 Warnings: -Error 1292 Truncated incorrect DECIMAL value: '' -Error 1292 Truncated incorrect DECIMAL value: '' -Error 1292 Truncated incorrect DECIMAL value: '' +Warning 1292 Truncated incorrect DECIMAL value: '' +Warning 1292 Truncated incorrect DECIMAL value: '' +Warning 1292 Truncated incorrect DECIMAL value: '' SHOW CREATE VIEW v1; View Create View character_set_client collation_connection v1 CREATE ALGORITHM=UNDEFINED DEFINER=`root`@`localhost` SQL SECURITY DEFINER VIEW `v1` AS select cast(`t1_values`.`my_decimal` as unsigned) AS `CAST(my_decimal AS UNSIGNED INTEGER)`,`t1_values`.`my_decimal` AS `my_decimal`,`t1_values`.`id` AS `id` from `t1_values` latin1 latin1_swedish_ci @@ -2603,9 +2603,9 @@ NULL NULL 1 0 0.000000000000000000000000000000 4 0 -1.000000000000000000000000000000 5 Warnings: -Error 1292 Truncated incorrect DECIMAL value: '' -Error 1292 Truncated incorrect DECIMAL value: '' -Error 1292 Truncated incorrect DECIMAL value: '' +Warning 1292 Truncated incorrect DECIMAL value: '' +Warning 1292 Truncated incorrect DECIMAL value: '' +Warning 1292 Truncated incorrect DECIMAL value: '' DROP VIEW v1; @@ -2955,8 +2955,8 @@ NULL NULL 1 0 0.000000000000000000000000000000 4 -1 -1.000000000000000000000000000000 5 Warnings: -Error 1292 Truncated incorrect DECIMAL value: '' -Error 1292 Truncated incorrect DECIMAL value: '' +Warning 1292 Truncated incorrect DECIMAL value: '' +Warning 1292 Truncated incorrect DECIMAL value: '' SHOW CREATE VIEW v1; View Create View character_set_client collation_connection v1 CREATE ALGORITHM=UNDEFINED DEFINER=`root`@`localhost` SQL SECURITY DEFINER VIEW `v1` AS select cast(`t1_values`.`my_decimal` as signed) AS `CAST(my_decimal AS SIGNED INTEGER)`,`t1_values`.`my_decimal` AS `my_decimal`,`t1_values`.`id` AS `id` from `t1_values` latin1 latin1_swedish_ci @@ -2970,8 +2970,8 @@ NULL NULL 1 0 0.000000000000000000000000000000 4 -1 -1.000000000000000000000000000000 5 Warnings: -Error 1292 Truncated incorrect DECIMAL value: '' -Error 1292 Truncated incorrect DECIMAL value: '' +Warning 1292 Truncated incorrect DECIMAL value: '' +Warning 1292 Truncated incorrect DECIMAL value: '' DROP VIEW v1; @@ -3282,10 +3282,10 @@ NULL NULL 1 -1.00 -1 5 -3333.33 -3333.3333 30 Warnings: -Error 1292 Truncated incorrect DECIMAL value: '' -Error 1264 Out of range value for column 'CAST(my_double AS DECIMAL(37,2))' at row 1 -Error 1292 Truncated incorrect DECIMAL value: '' -Error 1264 Out of range value for column 'CAST(my_double AS DECIMAL(37,2))' at row 1 +Warning 1292 Truncated incorrect DECIMAL value: '' +Warning 1264 Out of range value for column 'CAST(my_double AS DECIMAL(37,2))' at row 1 +Warning 1292 Truncated incorrect DECIMAL value: '' +Warning 1264 Out of range value for column 'CAST(my_double AS DECIMAL(37,2))' at row 1 SHOW CREATE VIEW v1; View Create View character_set_client collation_connection v1 CREATE ALGORITHM=UNDEFINED DEFINER=`root`@`localhost` SQL SECURITY DEFINER VIEW `v1` AS select cast(`t1_values`.`my_double` as decimal(37,2)) AS `CAST(my_double AS DECIMAL(37,2))`,`t1_values`.`my_double` AS `my_double`,`t1_values`.`id` AS `id` from `t1_values` latin1 latin1_swedish_ci @@ -3300,10 +3300,10 @@ NULL NULL 1 -1.00 -1 5 -3333.33 -3333.3333 30 Warnings: -Error 1292 Truncated incorrect DECIMAL value: '' -Error 1264 Out of range value for column 'CAST(my_double AS DECIMAL(37,2))' at row 1 -Error 1292 Truncated incorrect DECIMAL value: '' -Error 1264 Out of range value for column 'CAST(my_double AS DECIMAL(37,2))' at row 1 +Warning 1292 Truncated incorrect DECIMAL value: '' +Warning 1264 Out of range value for column 'CAST(my_double AS DECIMAL(37,2))' at row 1 +Warning 1292 Truncated incorrect DECIMAL value: '' +Warning 1264 Out of range value for column 'CAST(my_double AS DECIMAL(37,2))' at row 1 DROP VIEW v1; @@ -3372,9 +3372,9 @@ NULL NULL 1 -1.00 -1 5 -3333.33 -3333.3333 29 Warnings: -Error 1366 Incorrect decimal value: '' for column '' at row -1 -Error 1366 Incorrect decimal value: '' for column '' at row -1 -Error 1366 Incorrect decimal value: '' for column '' at row -1 +Warning 1366 Incorrect decimal value: '' for column '' at row -1 +Warning 1366 Incorrect decimal value: '' for column '' at row -1 +Warning 1366 Incorrect decimal value: '' for column '' at row -1 SHOW CREATE VIEW v1; View Create View character_set_client collation_connection v1 CREATE ALGORITHM=UNDEFINED DEFINER=`root`@`localhost` SQL SECURITY DEFINER VIEW `v1` AS select cast(`t1_values`.`my_varbinary_1000` as decimal(37,2)) AS `CAST(my_varbinary_1000 AS DECIMAL(37,2))`,`t1_values`.`my_varbinary_1000` AS `my_varbinary_1000`,`t1_values`.`id` AS `id` from `t1_values` latin1 latin1_swedish_ci @@ -3389,9 +3389,9 @@ NULL NULL 1 -1.00 -1 5 -3333.33 -3333.3333 29 Warnings: -Error 1366 Incorrect decimal value: '' for column '' at row -1 -Error 1366 Incorrect decimal value: '' for column '' at row -1 -Error 1366 Incorrect decimal value: '' for column '' at row -1 +Warning 1366 Incorrect decimal value: '' for column '' at row -1 +Warning 1366 Incorrect decimal value: '' for column '' at row -1 +Warning 1366 Incorrect decimal value: '' for column '' at row -1 DROP VIEW v1; @@ -3408,11 +3408,11 @@ NULL NULL 1 -1.00 -1 5 -3333.33 -3333.3333 28 Warnings: -Error 1366 Incorrect decimal value: '' for column '' at row -1 +Warning 1366 Incorrect decimal value: '' for column '' at row -1 Warning 1292 Truncated incorrect DECIMAL value: '' -Error 1366 Incorrect decimal value: '' for column '' at row -1 +Warning 1366 Incorrect decimal value: '' for column '' at row -1 Warning 1292 Truncated incorrect DECIMAL value: '<--------30 characters------->' -Error 1366 Incorrect decimal value: '' for column '' at row -1 +Warning 1366 Incorrect decimal value: '' for column '' at row -1 Warning 1292 Truncated incorrect DECIMAL value: ' ---@*$-- ' Warning 1292 Truncated incorrect DECIMAL value: '-1' Warning 1292 Truncated incorrect DECIMAL value: '-3333.3333' @@ -3430,11 +3430,11 @@ NULL NULL 1 -1.00 -1 -3333.33 -3333.3333 Warnings: -Error 1366 Incorrect decimal value: '' for column '' at row -1 +Warning 1366 Incorrect decimal value: '' for column '' at row -1 Warning 1292 Truncated incorrect DECIMAL value: '' -Error 1366 Incorrect decimal value: '' for column '' at row -1 +Warning 1366 Incorrect decimal value: '' for column '' at row -1 Warning 1292 Truncated incorrect DECIMAL value: '<--------30 characters------->' -Error 1366 Incorrect decimal value: '' for column '' at row -1 +Warning 1366 Incorrect decimal value: '' for column '' at row -1 Warning 1292 Truncated incorrect DECIMAL value: ' ---@*$-- ' Warning 1292 Truncated incorrect DECIMAL value: '-1' Warning 1292 Truncated incorrect DECIMAL value: '-3333.3333' @@ -3454,9 +3454,9 @@ NULL NULL 1 -1.00 -1 5 -3333.33 -3333.3333 27 Warnings: -Error 1366 Incorrect decimal value: '' for column '' at row -1 -Error 1366 Incorrect decimal value: '' for column '' at row -1 -Error 1366 Incorrect decimal value: '' for column '' at row -1 +Warning 1366 Incorrect decimal value: '' for column '' at row -1 +Warning 1366 Incorrect decimal value: '' for column '' at row -1 +Warning 1366 Incorrect decimal value: '' for column '' at row -1 SHOW CREATE VIEW v1; View Create View character_set_client collation_connection v1 CREATE ALGORITHM=UNDEFINED DEFINER=`root`@`localhost` SQL SECURITY DEFINER VIEW `v1` AS select cast(`t1_values`.`my_varchar_1000` as decimal(37,2)) AS `CAST(my_varchar_1000 AS DECIMAL(37,2))`,`t1_values`.`my_varchar_1000` AS `my_varchar_1000`,`t1_values`.`id` AS `id` from `t1_values` latin1 latin1_swedish_ci @@ -3471,9 +3471,9 @@ NULL NULL 1 -1.00 -1 5 -3333.33 -3333.3333 27 Warnings: -Error 1366 Incorrect decimal value: '' for column '' at row -1 -Error 1366 Incorrect decimal value: '' for column '' at row -1 -Error 1366 Incorrect decimal value: '' for column '' at row -1 +Warning 1366 Incorrect decimal value: '' for column '' at row -1 +Warning 1366 Incorrect decimal value: '' for column '' at row -1 +Warning 1366 Incorrect decimal value: '' for column '' at row -1 DROP VIEW v1; @@ -3490,11 +3490,11 @@ NULL NULL 1 -1.00 -1 5 -3333.33 -3333.3333 26 Warnings: -Error 1366 Incorrect decimal value: '' for column '' at row -1 +Warning 1366 Incorrect decimal value: '' for column '' at row -1 Warning 1292 Truncated incorrect DECIMAL value: ' ' -Error 1366 Incorrect decimal value: '' for column '' at row -1 +Warning 1366 Incorrect decimal value: '' for column '' at row -1 Warning 1292 Truncated incorrect DECIMAL value: '<--------30 characters------->' -Error 1366 Incorrect decimal value: '' for column '' at row -1 +Warning 1366 Incorrect decimal value: '' for column '' at row -1 Warning 1292 Truncated incorrect DECIMAL value: ' ---@*$-- ' SHOW CREATE VIEW v1; View Create View character_set_client collation_connection @@ -3510,11 +3510,11 @@ NULL NULL 1 -1.00 -1 5 -3333.33 -3333.3333 26 Warnings: -Error 1366 Incorrect decimal value: '' for column '' at row -1 +Warning 1366 Incorrect decimal value: '' for column '' at row -1 Warning 1292 Truncated incorrect DECIMAL value: ' ' -Error 1366 Incorrect decimal value: '' for column '' at row -1 +Warning 1366 Incorrect decimal value: '' for column '' at row -1 Warning 1292 Truncated incorrect DECIMAL value: '<--------30 characters------->' -Error 1366 Incorrect decimal value: '' for column '' at row -1 +Warning 1366 Incorrect decimal value: '' for column '' at row -1 Warning 1292 Truncated incorrect DECIMAL value: ' ---@*$-- ' DROP VIEW v1; diff --git a/mysql-test/suite/funcs_1/r/ndb_storedproc_02.result b/mysql-test/suite/funcs_1/r/ndb_storedproc_02.result index 65fc5b5afc9..3e2d084aa0c 100644 --- a/mysql-test/suite/funcs_1/r/ndb_storedproc_02.result +++ b/mysql-test/suite/funcs_1/r/ndb_storedproc_02.result @@ -550,9 +550,6 @@ exit handler 2 exit handler 2 exit handler 1 exit handler 1 -Warnings: -Note 1051 Unknown table 'tqq' -Note 1051 Unknown table 'tqq' create table res_t1(w char unique, x char); insert into res_t1 values ('a', 'b'); CREATE PROCEDURE h1 () diff --git a/mysql-test/suite/funcs_1/r/storedproc.result b/mysql-test/suite/funcs_1/r/storedproc.result index 3efb361dc82..ab917fce339 100644 --- a/mysql-test/suite/funcs_1/r/storedproc.result +++ b/mysql-test/suite/funcs_1/r/storedproc.result @@ -7128,8 +7128,6 @@ CALL sp1(); x y z 000 000 000 Warnings: -Warning 1264 Out of range value for column 'x' at row 1 -Warning 1264 Out of range value for column 'y' at row 1 Warning 1264 Out of range value for column 'z' at row 1 DROP PROCEDURE IF EXISTS sp1; CREATE PROCEDURE sp1( ) @@ -7168,8 +7166,6 @@ CALL sp1(); x y z 00000 00000 00000 Warnings: -Warning 1264 Out of range value for column 'x' at row 1 -Warning 1264 Out of range value for column 'y' at row 1 Warning 1264 Out of range value for column 'z' at row 1 DROP PROCEDURE IF EXISTS sp1; CREATE PROCEDURE sp1( ) @@ -7208,8 +7204,6 @@ CALL sp1(); x y z 00000000 00000000 00000000 Warnings: -Warning 1264 Out of range value for column 'x' at row 1 -Warning 1264 Out of range value for column 'y' at row 1 Warning 1264 Out of range value for column 'z' at row 1 DROP PROCEDURE IF EXISTS sp1; CREATE PROCEDURE sp1( ) @@ -7248,8 +7242,6 @@ CALL sp1(); x y z 0000000000 0000000000 0000000000 Warnings: -Warning 1264 Out of range value for column 'x' at row 1 -Warning 1264 Out of range value for column 'y' at row 1 Warning 1264 Out of range value for column 'z' at row 1 DROP PROCEDURE IF EXISTS sp1; CREATE PROCEDURE sp1( ) @@ -7288,8 +7280,6 @@ CALL sp1(); x y z 00000000000000000000 00000000000000000000 00000000000000000000 Warnings: -Warning 1264 Out of range value for column 'x' at row 1 -Warning 1264 Out of range value for column 'y' at row 1 Warning 1264 Out of range value for column 'z' at row 1 DROP PROCEDURE IF EXISTS sp1; CREATE PROCEDURE sp1( ) @@ -7310,8 +7300,6 @@ CALL sp1(); x y z -9999999999 -9999999999 -9999999999 Warnings: -Warning 1264 Out of range value for column 'x' at row 1 -Warning 1264 Out of range value for column 'y' at row 1 Warning 1264 Out of range value for column 'z' at row 1 DROP PROCEDURE IF EXISTS sp1; CREATE PROCEDURE sp1( ) @@ -7323,8 +7311,6 @@ CALL sp1(); x y z 0 0 0 Warnings: -Note 1265 Data truncated for column 'x' at row 1 -Note 1265 Data truncated for column 'y' at row 1 Note 1265 Data truncated for column 'z' at row 1 DROP PROCEDURE IF EXISTS sp1; CREATE PROCEDURE sp1( ) @@ -7336,8 +7322,6 @@ CALL sp1(); x y z 0000000000 0000000000 0000000000 Warnings: -Warning 1264 Out of range value for column 'x' at row 1 -Warning 1264 Out of range value for column 'y' at row 1 Warning 1264 Out of range value for column 'z' at row 1 DROP PROCEDURE IF EXISTS sp1; CREATE PROCEDURE sp1( ) @@ -7349,8 +7333,6 @@ CALL sp1(); x y z 0000000000 0000000000 0000000000 Warnings: -Note 1265 Data truncated for column 'x' at row 1 -Note 1265 Data truncated for column 'y' at row 1 Note 1265 Data truncated for column 'z' at row 1 DROP PROCEDURE IF EXISTS sp1; CREATE PROCEDURE sp1( ) @@ -7362,8 +7344,6 @@ CALL sp1(); x y z 0 0 0 Warnings: -Note 1265 Data truncated for column 'x' at row 1 -Note 1265 Data truncated for column 'y' at row 1 Note 1265 Data truncated for column 'z' at row 1 DROP PROCEDURE IF EXISTS sp1; CREATE PROCEDURE sp1( ) @@ -7375,8 +7355,6 @@ CALL sp1(); x y z 0 0 0 Warnings: -Note 1265 Data truncated for column 'x' at row 1 -Note 1265 Data truncated for column 'y' at row 1 Note 1265 Data truncated for column 'z' at row 1 DROP PROCEDURE IF EXISTS sp1; CREATE PROCEDURE sp1( ) @@ -7388,8 +7366,6 @@ CALL sp1(); x y z 0000000000 0000000000 0000000000 Warnings: -Note 1265 Data truncated for column 'x' at row 1 -Note 1265 Data truncated for column 'y' at row 1 Note 1265 Data truncated for column 'z' at row 1 DROP PROCEDURE IF EXISTS sp1; CREATE PROCEDURE sp1( ) @@ -7401,8 +7377,6 @@ CALL sp1(); x y z 0000000000 0000000000 0000000000 Warnings: -Note 1265 Data truncated for column 'x' at row 1 -Note 1265 Data truncated for column 'y' at row 1 Note 1265 Data truncated for column 'z' at row 1 DROP PROCEDURE IF EXISTS sp1; CREATE PROCEDURE sp1( ) @@ -13782,9 +13756,6 @@ END// CALL sp1(); x y @x NULL a 3 -Warnings: -Warning 1265 Data truncated for column 'y' at row 3 -Warning 1265 Data truncated for column 'y' at row 1 SELECT @v1, @v2; @v1 @v2 4 a @@ -15465,14 +15436,6 @@ count done 10 1 Warnings: Warning 1265 Data truncated for column 'name' at row 1 -Warning 1265 Data truncated for column 'name' at row 2 -Warning 1265 Data truncated for column 'name' at row 3 -Warning 1265 Data truncated for column 'name' at row 4 -Warning 1265 Data truncated for column 'name' at row 5 -Warning 1265 Data truncated for column 'name' at row 6 -Warning 1265 Data truncated for column 'name' at row 7 -Warning 1265 Data truncated for column 'name' at row 8 -Warning 1265 Data truncated for column 'name' at row 9 DROP PROCEDURE sp3; drop table res_t3_itisalongname_1381742_itsaverylongname_1381742; @@ -16387,7 +16350,6 @@ fn7(99999999999) 9999999999 Warnings: Warning 1264 Out of range value for column 'f1' at row 1 -Note 1265 Data truncated for column 'f1' at row 1 Warning 1264 Out of range value for column 'f1' at row 1 DROP FUNCTION IF EXISTS fn8; CREATE FUNCTION fn8( f1 decimal (0) unsigned zerofill) returns decimal (0) unsigned zerofill @@ -16432,7 +16394,6 @@ fn11(99999999999) 9999999999 Warnings: Warning 1264 Out of range value for column 'f1' at row 1 -Note 1265 Data truncated for column 'f1' at row 1 Warning 1264 Out of range value for column 'f1' at row 1 DROP FUNCTION IF EXISTS fn12; CREATE FUNCTION fn12( f1 decimal (0, 0) unsigned zerofill) returns decimal (0, 0) unsigned zerofill @@ -16533,7 +16494,6 @@ SELECT fn21_d_z(1.00e+00); fn21_d_z(1.00e+00) 0000000000000000000000000000000000000000000000000000000000000010 Warnings: -Note 1265 Data truncated for column 'f1' at row 1 Warning 1264 Out of range value for column 'f1' at row 1 DROP FUNCTION IF EXISTS fn22; CREATE FUNCTION fn22( f1 decimal unsigned) returns decimal unsigned @@ -16545,7 +16505,6 @@ SELECT fn22(1.00e+00); fn22(1.00e+00) 10 Warnings: -Note 1265 Data truncated for column 'f1' at row 1 Warning 1264 Out of range value for column 'f1' at row 1 DROP FUNCTION IF EXISTS fn23; CREATE FUNCTION fn23( f1 decimal unsigned zerofill) returns decimal unsigned zerofill @@ -16557,7 +16516,6 @@ SELECT fn23(1.00e+00); fn23(1.00e+00) 0000000010 Warnings: -Note 1265 Data truncated for column 'f1' at row 1 Warning 1264 Out of range value for column 'f1' at row 1 DROP FUNCTION IF EXISTS fn24; CREATE FUNCTION fn24( f1 decimal zerofill) returns decimal zerofill @@ -16903,7 +16861,6 @@ fn56(-8388601) Warnings: Warning 1264 Out of range value for column 'f1' at row 1 Warning 1264 Out of range value for column 'f1' at row 1 -Warning 1264 Out of range value for column 'f1' at row 1 DROP FUNCTION IF EXISTS fn57; CREATE FUNCTION fn57( f1 numeric) returns numeric BEGIN @@ -16936,7 +16893,6 @@ SELECT fn59(9999999999); fn59(9999999999) 9999999999 Warnings: -Note 1265 Data truncated for column 'f1' at row 1 Warning 1264 Out of range value for column 'f1' at row 1 DROP FUNCTION IF EXISTS fn60; CREATE FUNCTION fn60( f1 numeric (0) unsigned zerofill) returns numeric (0) unsigned zerofill @@ -16982,7 +16938,6 @@ SELECT fn63(9999999999); fn63(9999999999) 9999999999 Warnings: -Note 1265 Data truncated for column 'f1' at row 1 Warning 1264 Out of range value for column 'f1' at row 1 DROP FUNCTION IF EXISTS fn64; CREATE FUNCTION fn64( f1 numeric (0, 0) unsigned zerofill) returns numeric (0, 0) unsigned zerofill @@ -17018,8 +16973,6 @@ fn66(-1e+36) -999999999999999999999999999999989.999999999999999999999999999999 Warnings: Warning 1264 Out of range value for column 'f1' at row 1 -Note 1265 Data truncated for column 'f1' at row 1 -Warning 1264 Out of range value for column 'f1' at row 1 Warning 1264 Out of range value for column 'f1' at row 1 DROP FUNCTION IF EXISTS fn67; CREATE FUNCTION fn67( f1 numeric (63, 30) unsigned) returns numeric (63, 30) unsigned @@ -17032,7 +16985,6 @@ fn67(1e+36) 999999999999999999999999999999999.999999999999999999999999999999 Warnings: Warning 1264 Out of range value for column 'f1' at row 1 -Note 1265 Data truncated for column 'f1' at row 1 Warning 1264 Out of range value for column 'f1' at row 1 DROP FUNCTION IF EXISTS fn68; CREATE FUNCTION fn68( f1 numeric (63, 30) unsigned zerofill) returns numeric (63, 30) unsigned zerofill @@ -17045,7 +16997,6 @@ fn68(1e+36) 999999999999999999999999999999999.999999999999999999999999999999 Warnings: Warning 1264 Out of range value for column 'f1' at row 1 -Note 1265 Data truncated for column 'f1' at row 1 Warning 1264 Out of range value for column 'f1' at row 1 DROP FUNCTION IF EXISTS fn69; CREATE FUNCTION fn69( f1 numeric (63, 30) zerofill) returns numeric (63, 30) zerofill @@ -17213,7 +17164,6 @@ fn84(-32601) Warnings: Warning 1264 Out of range value for column 'f1' at row 1 Warning 1264 Out of range value for column 'f1' at row 1 -Warning 1264 Out of range value for column 'f1' at row 1 DROP FUNCTION IF EXISTS fn85; CREATE FUNCTION fn85( f1 tinyint) returns tinyint BEGIN @@ -17253,7 +17203,6 @@ fn88(-101) Warnings: Warning 1264 Out of range value for column 'f1' at row 1 Warning 1264 Out of range value for column 'f1' at row 1 -Warning 1264 Out of range value for column 'f1' at row 1 DROP FUNCTION IF EXISTS fn89; CREATE FUNCTION fn89( f1 enum('1enum', '2enum')) returns enum('1enum', '2enum') BEGIN @@ -17511,7 +17460,6 @@ f1 9999999999 Warnings: Warning 1264 Out of range value for column 'f1' at row 1 -Note 1265 Data truncated for column 'f1' at row 1 Warning 1264 Out of range value for column 'f1' at row 1 DROP PROCEDURE IF EXISTS sp8; CREATE PROCEDURE sp8( f1 decimal (0) unsigned zerofill) @@ -17556,7 +17504,6 @@ f1 9999999999 Warnings: Warning 1264 Out of range value for column 'f1' at row 1 -Note 1265 Data truncated for column 'f1' at row 1 Warning 1264 Out of range value for column 'f1' at row 1 DROP PROCEDURE IF EXISTS sp12; CREATE PROCEDURE sp12( f1 decimal (0, 0) unsigned zerofill) @@ -17678,7 +17625,6 @@ CALL sp21(1.00e+00); f1 0000000000000000000000000000000000000000000000000000000000000010 Warnings: -Note 1265 Data truncated for column 'f1' at row 1 Warning 1264 Out of range value for column 'f1' at row 1 DROP PROCEDURE IF EXISTS sp22; CREATE PROCEDURE sp22( f1 decimal unsigned) @@ -17690,7 +17636,6 @@ CALL sp22(1.00e+00); f1 10 Warnings: -Note 1265 Data truncated for column 'f1' at row 1 Warning 1264 Out of range value for column 'f1' at row 1 DROP PROCEDURE IF EXISTS sp23; CREATE PROCEDURE sp23( f1 decimal unsigned zerofill) @@ -17702,7 +17647,6 @@ CALL sp23(1.00e+00); f1 0000000010 Warnings: -Note 1265 Data truncated for column 'f1' at row 1 Warning 1264 Out of range value for column 'f1' at row 1 DROP PROCEDURE IF EXISTS sp24; CREATE PROCEDURE sp24( f1 decimal zerofill) @@ -18048,7 +17992,6 @@ f1 Warnings: Warning 1264 Out of range value for column 'f1' at row 1 Warning 1264 Out of range value for column 'f1' at row 1 -Warning 1264 Out of range value for column 'f1' at row 1 DROP PROCEDURE IF EXISTS sp57; CREATE PROCEDURE sp57( f1 numeric) BEGIN @@ -18081,7 +18024,6 @@ CALL sp59(9999999999); f1 9999999999 Warnings: -Note 1265 Data truncated for column 'f1' at row 1 Warning 1264 Out of range value for column 'f1' at row 1 DROP PROCEDURE IF EXISTS sp60; CREATE PROCEDURE sp60( f1 numeric (0) unsigned zerofill) @@ -18127,7 +18069,6 @@ CALL sp63(9999999999); f1 9999999999 Warnings: -Note 1265 Data truncated for column 'f1' at row 1 Warning 1264 Out of range value for column 'f1' at row 1 DROP PROCEDURE IF EXISTS sp64; CREATE PROCEDURE sp64( f1 numeric (0, 0) unsigned zerofill) @@ -18163,16 +18104,12 @@ f1 -999999999999999999999999999999989.999999999999999999999999999999 Warnings: Warning 1264 Out of range value for column 'f1' at row 1 -Note 1265 Data truncated for column 'f1' at row 1 -Warning 1264 Out of range value for column 'f1' at row 1 Warning 1264 Out of range value for column 'f1' at row 1 CALL sp66_n( -1000000000000000000000000000000000000 ); f1 -999999999999999999999999999999989.999999999999999999999999999999 Warnings: Warning 1264 Out of range value for column 'f1' at row 1 -Note 1265 Data truncated for column 'f1' at row 1 -Warning 1264 Out of range value for column 'f1' at row 1 Warning 1264 Out of range value for column 'f1' at row 1 DROP PROCEDURE IF EXISTS sp67_nu; CREATE PROCEDURE sp67_nu( f1 numeric (63, 30) unsigned) @@ -18185,14 +18122,12 @@ f1 999999999999999999999999999999999.999999999999999999999999999999 Warnings: Warning 1264 Out of range value for column 'f1' at row 1 -Note 1265 Data truncated for column 'f1' at row 1 Warning 1264 Out of range value for column 'f1' at row 1 CALL sp67_nu( 1000000000000000000000000000000000000 ); f1 999999999999999999999999999999999.999999999999999999999999999999 Warnings: Warning 1264 Out of range value for column 'f1' at row 1 -Note 1265 Data truncated for column 'f1' at row 1 Warning 1264 Out of range value for column 'f1' at row 1 DROP PROCEDURE IF EXISTS sp68_nuz; CREATE PROCEDURE sp68_nuz( f1 numeric (63, 30) unsigned zerofill) @@ -18205,14 +18140,12 @@ f1 999999999999999999999999999999999.999999999999999999999999999999 Warnings: Warning 1264 Out of range value for column 'f1' at row 1 -Note 1265 Data truncated for column 'f1' at row 1 Warning 1264 Out of range value for column 'f1' at row 1 CALL sp68_nuz( 1000000000000000000000000000000000000 ); f1 999999999999999999999999999999999.999999999999999999999999999999 Warnings: Warning 1264 Out of range value for column 'f1' at row 1 -Note 1265 Data truncated for column 'f1' at row 1 Warning 1264 Out of range value for column 'f1' at row 1 DROP PROCEDURE IF EXISTS sp69_n_z; CREATE PROCEDURE sp69_n_z( f1 numeric (63, 30) zerofill) @@ -18395,7 +18328,6 @@ f1 Warnings: Warning 1264 Out of range value for column 'f1' at row 1 Warning 1264 Out of range value for column 'f1' at row 1 -Warning 1264 Out of range value for column 'f1' at row 1 DROP PROCEDURE IF EXISTS sp85; CREATE PROCEDURE sp85( f1 tinyint) BEGIN @@ -18435,7 +18367,6 @@ f1 Warnings: Warning 1264 Out of range value for column 'f1' at row 1 Warning 1264 Out of range value for column 'f1' at row 1 -Warning 1264 Out of range value for column 'f1' at row 1 DROP PROCEDURE IF EXISTS sp89; CREATE PROCEDURE sp89( f1 enum('1enum', '2enum')) BEGIN @@ -22263,9 +22194,9 @@ END latin1 latin1_swedish_ci latin1_swedish_ci set @@sql_mode=''; CALL sp4(); Level Code Message -Error 1365 Division by 0 +Warning 1365 Division by 0 Warnings: -Error 1365 Division by 0 +Warning 1365 Division by 0 DROP PROCEDURE sp4; set @@sql_mode=''; diff --git a/mysql-test/suite/innodb/r/innodb-zip.result b/mysql-test/suite/innodb/r/innodb-zip.result index b26c4112826..a59758c8673 100644 --- a/mysql-test/suite/innodb/r/innodb-zip.result +++ b/mysql-test/suite/innodb/r/innodb-zip.result @@ -198,13 +198,11 @@ create table t1 (id int primary key) engine = innodb key_block_size = 0; ERROR HY000: Can't create table 'test.t1' (errno: 1478) show errors; Level Code Message -Error 1478 InnoDB: invalid KEY_BLOCK_SIZE = 0. Valid values are [1, 2, 4, 8, 16] Error 1005 Can't create table 'test.t1' (errno: 1478) create table t2 (id int primary key) engine = innodb key_block_size = 9; ERROR HY000: Can't create table 'test.t2' (errno: 1478) show errors; Level Code Message -Error 1478 InnoDB: invalid KEY_BLOCK_SIZE = 9. Valid values are [1, 2, 4, 8, 16] Error 1005 Can't create table 'test.t2' (errno: 1478) create table t3 (id int primary key) engine = innodb key_block_size = 1; create table t4 (id int primary key) engine = innodb key_block_size = 2; @@ -235,28 +233,24 @@ key_block_size = 8 row_format = redundant; ERROR HY000: Can't create table 'test.t2' (errno: 1478) show errors; Level Code Message -Error 1478 InnoDB: cannot specify ROW_FORMAT = REDUNDANT with KEY_BLOCK_SIZE. Error 1005 Can't create table 'test.t2' (errno: 1478) create table t3 (id int primary key) engine = innodb key_block_size = 8 row_format = compact; ERROR HY000: Can't create table 'test.t3' (errno: 1478) show errors; Level Code Message -Error 1478 InnoDB: cannot specify ROW_FORMAT = COMPACT with KEY_BLOCK_SIZE. Error 1005 Can't create table 'test.t3' (errno: 1478) create table t4 (id int primary key) engine = innodb key_block_size = 8 row_format = dynamic; ERROR HY000: Can't create table 'test.t4' (errno: 1478) show errors; Level Code Message -Error 1478 InnoDB: cannot specify ROW_FORMAT = DYNAMIC with KEY_BLOCK_SIZE. Error 1005 Can't create table 'test.t4' (errno: 1478) create table t5 (id int primary key) engine = innodb key_block_size = 8 row_format = default; ERROR HY000: Can't create table 'test.t5' (errno: 1478) show errors; Level Code Message -Error 1478 InnoDB: cannot specify ROW_FORMAT = COMPACT with KEY_BLOCK_SIZE. Error 1005 Can't create table 'test.t5' (errno: 1478) SELECT table_schema, table_name, row_format FROM information_schema.tables WHERE engine='innodb'; @@ -268,24 +262,18 @@ key_block_size = 9 row_format = redundant; ERROR HY000: Can't create table 'test.t1' (errno: 1478) show errors; Level Code Message -Error 1478 InnoDB: invalid KEY_BLOCK_SIZE = 9. Valid values are [1, 2, 4, 8, 16] -Error 1478 InnoDB: cannot specify ROW_FORMAT = REDUNDANT with KEY_BLOCK_SIZE. Error 1005 Can't create table 'test.t1' (errno: 1478) create table t2 (id int primary key) engine = innodb key_block_size = 9 row_format = compact; ERROR HY000: Can't create table 'test.t2' (errno: 1478) show errors; Level Code Message -Error 1478 InnoDB: invalid KEY_BLOCK_SIZE = 9. Valid values are [1, 2, 4, 8, 16] -Error 1478 InnoDB: cannot specify ROW_FORMAT = COMPACT with KEY_BLOCK_SIZE. Error 1005 Can't create table 'test.t2' (errno: 1478) create table t2 (id int primary key) engine = innodb key_block_size = 9 row_format = dynamic; ERROR HY000: Can't create table 'test.t2' (errno: 1478) show errors; Level Code Message -Error 1478 InnoDB: invalid KEY_BLOCK_SIZE = 9. Valid values are [1, 2, 4, 8, 16] -Error 1478 InnoDB: cannot specify ROW_FORMAT = DYNAMIC with KEY_BLOCK_SIZE. Error 1005 Can't create table 'test.t2' (errno: 1478) SELECT table_schema, table_name, row_format FROM information_schema.tables WHERE engine='innodb'; @@ -295,43 +283,36 @@ create table t1 (id int primary key) engine = innodb key_block_size = 1; ERROR HY000: Can't create table 'test.t1' (errno: 1478) show errors; Level Code Message -Error 1478 InnoDB: KEY_BLOCK_SIZE requires innodb_file_per_table. Error 1005 Can't create table 'test.t1' (errno: 1478) create table t2 (id int primary key) engine = innodb key_block_size = 2; ERROR HY000: Can't create table 'test.t2' (errno: 1478) show errors; Level Code Message -Error 1478 InnoDB: KEY_BLOCK_SIZE requires innodb_file_per_table. Error 1005 Can't create table 'test.t2' (errno: 1478) create table t3 (id int primary key) engine = innodb key_block_size = 4; ERROR HY000: Can't create table 'test.t3' (errno: 1478) show errors; Level Code Message -Error 1478 InnoDB: KEY_BLOCK_SIZE requires innodb_file_per_table. Error 1005 Can't create table 'test.t3' (errno: 1478) create table t4 (id int primary key) engine = innodb key_block_size = 8; ERROR HY000: Can't create table 'test.t4' (errno: 1478) show errors; Level Code Message -Error 1478 InnoDB: KEY_BLOCK_SIZE requires innodb_file_per_table. Error 1005 Can't create table 'test.t4' (errno: 1478) create table t5 (id int primary key) engine = innodb key_block_size = 16; ERROR HY000: Can't create table 'test.t5' (errno: 1478) show errors; Level Code Message -Error 1478 InnoDB: KEY_BLOCK_SIZE requires innodb_file_per_table. Error 1005 Can't create table 'test.t5' (errno: 1478) create table t6 (id int primary key) engine = innodb row_format = compressed; ERROR HY000: Can't create table 'test.t6' (errno: 1478) show errors; Level Code Message -Error 1478 InnoDB: ROW_FORMAT=COMPRESSED requires innodb_file_per_table. Error 1005 Can't create table 'test.t6' (errno: 1478) create table t7 (id int primary key) engine = innodb row_format = dynamic; ERROR HY000: Can't create table 'test.t7' (errno: 1478) show errors; Level Code Message -Error 1478 InnoDB: ROW_FORMAT=DYNAMIC requires innodb_file_per_table. Error 1005 Can't create table 'test.t7' (errno: 1478) create table t8 (id int primary key) engine = innodb row_format = compact; create table t9 (id int primary key) engine = innodb row_format = redundant; @@ -347,43 +328,36 @@ create table t1 (id int primary key) engine = innodb key_block_size = 1; ERROR HY000: Can't create table 'test.t1' (errno: 1478) show errors; Level Code Message -Error 1478 InnoDB: KEY_BLOCK_SIZE requires innodb_file_format > Antelope. Error 1005 Can't create table 'test.t1' (errno: 1478) create table t2 (id int primary key) engine = innodb key_block_size = 2; ERROR HY000: Can't create table 'test.t2' (errno: 1478) show errors; Level Code Message -Error 1478 InnoDB: KEY_BLOCK_SIZE requires innodb_file_format > Antelope. Error 1005 Can't create table 'test.t2' (errno: 1478) create table t3 (id int primary key) engine = innodb key_block_size = 4; ERROR HY000: Can't create table 'test.t3' (errno: 1478) show errors; Level Code Message -Error 1478 InnoDB: KEY_BLOCK_SIZE requires innodb_file_format > Antelope. Error 1005 Can't create table 'test.t3' (errno: 1478) create table t4 (id int primary key) engine = innodb key_block_size = 8; ERROR HY000: Can't create table 'test.t4' (errno: 1478) show errors; Level Code Message -Error 1478 InnoDB: KEY_BLOCK_SIZE requires innodb_file_format > Antelope. Error 1005 Can't create table 'test.t4' (errno: 1478) create table t5 (id int primary key) engine = innodb key_block_size = 16; ERROR HY000: Can't create table 'test.t5' (errno: 1478) show errors; Level Code Message -Error 1478 InnoDB: KEY_BLOCK_SIZE requires innodb_file_format > Antelope. Error 1005 Can't create table 'test.t5' (errno: 1478) create table t6 (id int primary key) engine = innodb row_format = compressed; ERROR HY000: Can't create table 'test.t6' (errno: 1478) show errors; Level Code Message -Error 1478 InnoDB: ROW_FORMAT=COMPRESSED requires innodb_file_format > Antelope. Error 1005 Can't create table 'test.t6' (errno: 1478) create table t7 (id int primary key) engine = innodb row_format = dynamic; ERROR HY000: Can't create table 'test.t7' (errno: 1478) show errors; Level Code Message -Error 1478 InnoDB: ROW_FORMAT=DYNAMIC requires innodb_file_format > Antelope. Error 1005 Can't create table 'test.t7' (errno: 1478) create table t8 (id int primary key) engine = innodb row_format = compact; create table t9 (id int primary key) engine = innodb row_format = redundant; diff --git a/mysql-test/suite/ndb/r/ndb_bitfield.result b/mysql-test/suite/ndb/r/ndb_bitfield.result index 59c4d420b22..826f3a98348 100644 --- a/mysql-test/suite/ndb/r/ndb_bitfield.result +++ b/mysql-test/suite/ndb/r/ndb_bitfield.result @@ -204,7 +204,7 @@ b int ERROR HY000: Can't create table 'test.t1' (errno: 906) show warnings; Level Code Message -Error 1296 Got error 906 'Unsupported attribute type in index' from NDB +Warning 1296 Got error 906 'Unsupported attribute type in index' from NDB Error 1005 Can't create table 'test.t1' (errno: 906) create table t1 ( pk1 int not null primary key, @@ -214,7 +214,7 @@ key(b) ERROR HY000: Can't create table 'test.t1' (errno: 906) show warnings; Level Code Message -Error 1296 Got error 906 'Unsupported attribute type in index' from NDB +Warning 1296 Got error 906 'Unsupported attribute type in index' from NDB Error 1005 Can't create table 'test.t1' (errno: 906) create table t1 ( pk1 int primary key, diff --git a/mysql-test/suite/ndb/r/ndb_dd_basic.result b/mysql-test/suite/ndb/r/ndb_dd_basic.result index 41e3d10fe5b..b956d3b0047 100644 --- a/mysql-test/suite/ndb/r/ndb_dd_basic.result +++ b/mysql-test/suite/ndb/r/ndb_dd_basic.result @@ -8,20 +8,20 @@ INITIAL_SIZE 16M UNDO_BUFFER_SIZE = 1M ENGINE=MYISAM; Warnings: -Error 1478 Table storage engine 'MyISAM' does not support the create option 'TABLESPACE or LOGFILE GROUP' +Warning 1478 Table storage engine 'MyISAM' does not support the create option 'TABLESPACE or LOGFILE GROUP' ALTER LOGFILE GROUP lg1 ADD UNDOFILE 'undofile02.dat' INITIAL_SIZE = 4M ENGINE=XYZ; Warnings: Warning 1286 Unknown table engine 'XYZ' -Error 1478 Table storage engine 'MyISAM' does not support the create option 'TABLESPACE or LOGFILE GROUP' +Warning 1478 Table storage engine 'MyISAM' does not support the create option 'TABLESPACE or LOGFILE GROUP' CREATE TABLESPACE ts1 ADD DATAFILE 'datafile.dat' USE LOGFILE GROUP lg1 INITIAL_SIZE 12M; Warnings: -Error 1478 Table storage engine 'MyISAM' does not support the create option 'TABLESPACE or LOGFILE GROUP' +Warning 1478 Table storage engine 'MyISAM' does not support the create option 'TABLESPACE or LOGFILE GROUP' set storage_engine=ndb; CREATE LOGFILE GROUP lg1 ADD UNDOFILE 'undofile.dat' diff --git a/mysql-test/suite/ndb/r/ndb_dd_ddl.result b/mysql-test/suite/ndb/r/ndb_dd_ddl.result index d8d9e8631d5..2bf30f5c7fc 100644 --- a/mysql-test/suite/ndb/r/ndb_dd_ddl.result +++ b/mysql-test/suite/ndb/r/ndb_dd_ddl.result @@ -15,7 +15,7 @@ ENGINE NDB; ERROR HY000: Failed to create LOGFILE GROUP SHOW WARNINGS; Level Code Message -Error 1296 Got error 1514 'Currently there is a limit of one logfile group' from NDB +Warning 1296 Got error 1514 'Currently there is a limit of one logfile group' from NDB Error 1528 Failed to create LOGFILE GROUP CREATE LOGFILE GROUP lg1 ADD UNDOFILE 'undofile.dat' diff --git a/mysql-test/suite/ndb/r/ndb_gis.result b/mysql-test/suite/ndb/r/ndb_gis.result index 374d702c408..61d15b7cb98 100644 --- a/mysql-test/suite/ndb/r/ndb_gis.result +++ b/mysql-test/suite/ndb/r/ndb_gis.result @@ -463,7 +463,7 @@ drop table t1; End of 4.1 tests CREATE TABLE t1 (name VARCHAR(100), square GEOMETRY); Warnings: -Error 1478 Table storage engine 'ndbcluster' does not support the create option 'Binlog of table with BLOB attribute and no PK' +Warning 1478 Table storage engine 'ndbcluster' does not support the create option 'Binlog of table with BLOB attribute and no PK' INSERT INTO t1 VALUES("center", GeomFromText('POLYGON (( 0 0, 0 2, 2 2, 2 0, 0 0))')); INSERT INTO t1 VALUES("small", GeomFromText('POLYGON (( 0 0, 0 1, 1 1, 1 0, 0 0))')); INSERT INTO t1 VALUES("big", GeomFromText('POLYGON (( 0 0, 0 3, 3 3, 3 0, 0 0))')); @@ -1013,7 +1013,7 @@ drop table t1; End of 4.1 tests CREATE TABLE t1 (name VARCHAR(100), square GEOMETRY); Warnings: -Error 1478 Table storage engine 'ndbcluster' does not support the create option 'Binlog of table with BLOB attribute and no PK' +Warning 1478 Table storage engine 'ndbcluster' does not support the create option 'Binlog of table with BLOB attribute and no PK' INSERT INTO t1 VALUES("center", GeomFromText('POLYGON (( 0 0, 0 2, 2 2, 2 0, 0 0))')); INSERT INTO t1 VALUES("small", GeomFromText('POLYGON (( 0 0, 0 1, 1 1, 1 0, 0 0))')); INSERT INTO t1 VALUES("big", GeomFromText('POLYGON (( 0 0, 0 3, 3 3, 3 0, 0 0))')); diff --git a/mysql-test/suite/ndb/r/ndb_multi_row.result b/mysql-test/suite/ndb/r/ndb_multi_row.result index 3d34b16a1a8..96986490d23 100644 --- a/mysql-test/suite/ndb/r/ndb_multi_row.result +++ b/mysql-test/suite/ndb/r/ndb_multi_row.result @@ -63,6 +63,6 @@ t4 drop table t1, t2, t3, t4; drop table if exists t1, t3, t4; Warnings: -Error 155 Table 'test.t1' doesn't exist -Error 155 Table 'test.t3' doesn't exist -Error 155 Table 'test.t4' doesn't exist +Warning 155 Table 'test.t1' doesn't exist +Warning 155 Table 'test.t3' doesn't exist +Warning 155 Table 'test.t4' doesn't exist diff --git a/mysql-test/suite/ndb/r/ndb_partition_error.result b/mysql-test/suite/ndb/r/ndb_partition_error.result index d86dc382185..df2db5c5f06 100644 --- a/mysql-test/suite/ndb/r/ndb_partition_error.result +++ b/mysql-test/suite/ndb/r/ndb_partition_error.result @@ -14,7 +14,7 @@ partition x3 values less than (20) nodegroup 14); ERROR HY000: Can't create table 'test.t1' (errno: 140) show warnings; Level Code Message -Error 1296 Got error 771 'Given NODEGROUP doesn't exist in this cluster' from NDB +Warning 1296 Got error 771 'Given NODEGROUP doesn't exist in this cluster' from NDB Error 1005 Can't create table 'test.t1' (errno: 140) CREATE TABLE t1 ( a int not null, diff --git a/mysql-test/suite/ndb/r/ndb_row_format.result b/mysql-test/suite/ndb/r/ndb_row_format.result index eea0692dd92..48a314c2fe9 100644 --- a/mysql-test/suite/ndb/r/ndb_row_format.result +++ b/mysql-test/suite/ndb/r/ndb_row_format.result @@ -8,7 +8,7 @@ ENGINE=NDB; ERROR HY000: Can't create table 'test.t1' (errno: 138) SHOW WARNINGS; Level Code Message -Error 1478 Table storage engine 'ndbcluster' does not support the create option 'Row format FIXED incompatible with variable sized attribute' +Warning 1478 Table storage engine 'ndbcluster' does not support the create option 'Row format FIXED incompatible with variable sized attribute' Error 1005 Can't create table 'test.t1' (errno: 138) CREATE TABLE t1 ( a INT KEY, diff --git a/mysql-test/suite/ndb/r/ndb_single_user.result b/mysql-test/suite/ndb/r/ndb_single_user.result index 8133e540d71..1d5f3041adb 100644 --- a/mysql-test/suite/ndb/r/ndb_single_user.result +++ b/mysql-test/suite/ndb/r/ndb_single_user.result @@ -9,7 +9,7 @@ ENGINE=NDB; ERROR HY000: Failed to create LOGFILE GROUP show warnings; Level Code Message -Error 1296 Got error 299 'Operation not allowed or aborted due to single user mode' from NDB +Warning 1296 Got error 299 'Operation not allowed or aborted due to single user mode' from NDB Error 1528 Failed to create LOGFILE GROUP create table t1 (a int key, b int unique, c int) engine ndb; CREATE LOGFILE GROUP lg1 @@ -25,14 +25,14 @@ ENGINE NDB; ERROR HY000: Failed to create TABLESPACE show warnings; Level Code Message -Error 1296 Got error 299 'Operation not allowed or aborted due to single user mode' from NDB +Warning 1296 Got error 299 'Operation not allowed or aborted due to single user mode' from NDB Error 1528 Failed to create TABLESPACE DROP LOGFILE GROUP lg1 ENGINE =NDB; ERROR HY000: Failed to drop LOGFILE GROUP show warnings; Level Code Message -Error 1296 Got error 299 'Operation not allowed or aborted due to single user mode' from NDB +Warning 1296 Got error 299 'Operation not allowed or aborted due to single user mode' from NDB Error 1529 Failed to drop LOGFILE GROUP CREATE TABLESPACE ts1 ADD DATAFILE 'datafile.dat' @@ -45,7 +45,7 @@ ENGINE NDB; ERROR HY000: Failed to alter: DROP DATAFILE show warnings; Level Code Message -Error 1296 Got error 299 'Operation not allowed or aborted due to single user mode' from NDB +Warning 1296 Got error 299 'Operation not allowed or aborted due to single user mode' from NDB Error 1533 Failed to alter: DROP DATAFILE ALTER TABLESPACE ts1 DROP DATAFILE 'datafile.dat' @@ -55,7 +55,7 @@ ENGINE NDB; ERROR HY000: Failed to drop TABLESPACE show warnings; Level Code Message -Error 1296 Got error 299 'Operation not allowed or aborted due to single user mode' from NDB +Warning 1296 Got error 299 'Operation not allowed or aborted due to single user mode' from NDB Error 1529 Failed to drop TABLESPACE DROP TABLESPACE ts1 ENGINE NDB; diff --git a/mysql-test/suite/rpl/r/rpl_EE_err.result b/mysql-test/suite/rpl/r/rpl_EE_err.result index 16fa931e303..8c1277445b2 100644 --- a/mysql-test/suite/rpl/r/rpl_EE_err.result +++ b/mysql-test/suite/rpl/r/rpl_EE_err.result @@ -8,4 +8,4 @@ create table t1 (a int) engine=myisam; flush tables; drop table if exists t1; Warnings: -Error 2 Can't find file: 't1' (errno: 2) +Warning 2 Can't find file: 't1' (errno: 2) diff --git a/mysql-test/suite/rpl/r/rpl_row_sp007_innodb.result b/mysql-test/suite/rpl/r/rpl_row_sp007_innodb.result index 9a2822835f8..5a6a9ace4c5 100644 --- a/mysql-test/suite/rpl/r/rpl_row_sp007_innodb.result +++ b/mysql-test/suite/rpl/r/rpl_row_sp007_innodb.result @@ -22,8 +22,6 @@ END| < ---- Master selects-- > ------------------------- CALL test.p1(12); -Warnings: -Note 1051 Unknown table 't1' SELECT * FROM test.t1; num 12 diff --git a/mysql-test/t/func_gconcat.test b/mysql-test/t/func_gconcat.test index e92f3e96303..71d3d5a140b 100644 --- a/mysql-test/t/func_gconcat.test +++ b/mysql-test/t/func_gconcat.test @@ -694,3 +694,35 @@ SELECT 1 FROM t1 WHERE t1.a NOT IN DROP TABLE t1, t2; --echo End of 5.0 tests + +# +# Bug#36785: Wrong error message when group_concat() exceeds max length +# + +--disable_warnings +DROP TABLE IF EXISTS t1, t2; +--enable_warnings + +CREATE TABLE t1 (a VARCHAR(6), b INT); +CREATE TABLE t2 (a VARCHAR(6), b INT); + +INSERT INTO t1 VALUES ('111111', 1); +INSERT INTO t1 VALUES ('222222', 2); +INSERT INTO t1 VALUES ('333333', 3); +INSERT INTO t1 VALUES ('444444', 4); +INSERT INTO t1 VALUES ('555555', 5); + +SET group_concat_max_len = 5; +SET @old_sql_mode = @@sql_mode, @@sql_mode = 'traditional'; + +SELECT GROUP_CONCAT(a), b FROM t1 GROUP BY b LIMIT 3; +--error ER_CUT_VALUE_GROUP_CONCAT +INSERT INTO t2 SELECT GROUP_CONCAT(a), b FROM t1 GROUP BY b; +UPDATE t1 SET a = '11111' WHERE b = 1; +UPDATE t1 SET a = '22222' WHERE b = 2; +--error ER_CUT_VALUE_GROUP_CONCAT +INSERT INTO t2 SELECT GROUP_CONCAT(a), b FROM t1 GROUP BY b; + +SET group_concat_max_len = DEFAULT; +SET @@sql_mode = @old_sql_mode; +DROP TABLE t1, t2; diff --git a/mysql-test/t/signal.test b/mysql-test/t/signal.test new file mode 100644 index 00000000000..bdb6625ba32 --- /dev/null +++ b/mysql-test/t/signal.test @@ -0,0 +1,2685 @@ +# Copyright (C) 2008 Sun Microsystems, Inc +# +# This program is free software; you can redistribute it and/or modify +# it under the terms of the GNU General Public License as published by +# the Free Software Foundation; version 2 of the License. +# +# This program is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +# GNU General Public License for more details. +# +# You should have received a copy of the GNU General Public License +# along with this program; if not, write to the Free Software +# Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA + +# Tests for SIGNAL and RESIGNAL + +--echo # +--echo # PART 1: syntax +--echo # + +--echo # +--echo # Test every new reserved and non reserved keywords +--echo # + +--disable_warnings +drop table if exists signal_non_reserved; +--enable_warnings + +create table signal_non_reserved ( + class_origin int, + subclass_origin int, + constraint_catalog int, + constraint_schema int, + constraint_name int, + catalog_name int, + schema_name int, + table_name int, + column_name int, + cursor_name int, + message_text int, + sqlcode int +); + +drop table signal_non_reserved; + +--disable_warnings +drop table if exists diag_non_reserved; +--enable_warnings + +create table diag_non_reserved ( + diagnostics int, + current int, + stacked int, + exception int +); + +drop table diag_non_reserved; + +--disable_warnings +drop table if exists diag_cond_non_reserved; +--enable_warnings + +create table diag_cond_non_reserved ( + condition_identifier int, + condition_number int, + condition_name int, + connection_name int, + message_length int, + message_octet_length int, + parameter_mode int, + parameter_name int, + parameter_ordinal_position int, + returned_sqlstate int, + routine_catalog int, + routine_name int, + routine_schema int, + server_name int, + specific_name int, + trigger_catalog int, + trigger_name int, + trigger_schema int +); + +drop table diag_cond_non_reserved; + +--disable_warnings +drop table if exists diag_stmt_non_reserved; +--enable_warnings + +create table diag_stmt_non_reserved ( + number int, + more int, + command_function int, + command_function_code int, + dynamic_function int, + dynamic_function_code int, + row_count int, + transactions_committed int, + transactions_rolled_back int, + transaction_active int +); + +drop table diag_stmt_non_reserved; + +--disable_warnings +drop table if exists test_reserved; +--enable_warnings + +--error ER_PARSE_ERROR +create table test_reserved (signal int); + +--error ER_PARSE_ERROR +create table test_reserved (resignal int); + +--error ER_PARSE_ERROR +create table test_reserved (condition int); + +--echo # +--echo # Test the SIGNAL syntax +--echo # + +--disable_warnings +drop procedure if exists test_invalid; +drop procedure if exists test_signal_syntax; +drop function if exists test_signal_func; +--enable_warnings + +delimiter $$; + +--error ER_PARSE_ERROR +create procedure test_invalid() +begin + SIGNAL; +end $$ + +--error ER_SP_COND_MISMATCH +create procedure test_invalid() +begin + SIGNAL foo; +end $$ + +--error ER_SIGNAL_BAD_CONDITION_TYPE +create procedure test_invalid() +begin + DECLARE foo CONDITION FOR 1234; + SIGNAL foo; +end $$ + +create procedure test_signal_syntax() +begin + DECLARE foo CONDITION FOR SQLSTATE '12345'; + SIGNAL foo; +end $$ +drop procedure test_signal_syntax $$ + +create procedure test_signal_syntax() +begin + SIGNAL SQLSTATE '23000'; +end $$ +drop procedure test_signal_syntax $$ + +create procedure test_signal_syntax() +begin + SIGNAL SQLSTATE VALUE '23000'; +end $$ +drop procedure test_signal_syntax $$ + +create procedure test_signal_syntax() +begin + DECLARE foo CONDITION FOR SQLSTATE '12345'; + SIGNAL foo SET CLASS_ORIGIN = 'foo'; +end $$ +drop procedure test_signal_syntax $$ + +create procedure test_signal_syntax() +begin + DECLARE foo CONDITION FOR SQLSTATE '12345'; + SIGNAL foo SET SUBCLASS_ORIGIN = 'foo'; +end $$ +drop procedure test_signal_syntax $$ + +create procedure test_signal_syntax() +begin + DECLARE foo CONDITION FOR SQLSTATE '12345'; + SIGNAL foo SET CONSTRAINT_CATALOG = 'foo'; +end $$ +drop procedure test_signal_syntax $$ + +create procedure test_signal_syntax() +begin + DECLARE foo CONDITION FOR SQLSTATE '12345'; + SIGNAL foo SET CONSTRAINT_SCHEMA = 'foo'; +end $$ +drop procedure test_signal_syntax $$ + +create procedure test_signal_syntax() +begin + DECLARE foo CONDITION FOR SQLSTATE '12345'; + SIGNAL foo SET CONSTRAINT_NAME = 'foo'; +end $$ +drop procedure test_signal_syntax $$ + +create procedure test_signal_syntax() +begin + DECLARE foo CONDITION FOR SQLSTATE '12345'; + SIGNAL foo SET CATALOG_NAME = 'foo'; +end $$ +drop procedure test_signal_syntax $$ + +create procedure test_signal_syntax() +begin + DECLARE foo CONDITION FOR SQLSTATE '12345'; + SIGNAL foo SET SCHEMA_NAME = 'foo'; +end $$ +drop procedure test_signal_syntax $$ + +create procedure test_signal_syntax() +begin + DECLARE foo CONDITION FOR SQLSTATE '12345'; + SIGNAL foo SET TABLE_NAME = 'foo'; +end $$ +drop procedure test_signal_syntax $$ + +create procedure test_signal_syntax() +begin + DECLARE foo CONDITION FOR SQLSTATE '12345'; + SIGNAL foo SET COLUMN_NAME = 'foo'; +end $$ +drop procedure test_signal_syntax $$ + +create procedure test_signal_syntax() +begin + DECLARE foo CONDITION FOR SQLSTATE '12345'; + SIGNAL foo SET CURSOR_NAME = 'foo'; +end $$ +drop procedure test_signal_syntax $$ + +create procedure test_signal_syntax() +begin + DECLARE foo CONDITION FOR SQLSTATE '12345'; + SIGNAL foo SET MESSAGE_TEXT = 'foo'; +end $$ +drop procedure test_signal_syntax $$ + +create procedure test_signal_syntax() +begin + DECLARE foo CONDITION FOR SQLSTATE '12345'; + SIGNAL foo SET MYSQL_ERRNO = 'foo'; +end $$ +drop procedure test_signal_syntax $$ + +--error ER_DUP_SIGNAL_SET +create procedure test_invalid() +begin + DECLARE foo CONDITION FOR SQLSTATE '12345'; + SIGNAL foo SET CLASS_ORIGIN = 'foo', CLASS_ORIGIN = 'bar'; +end $$ + +--error ER_DUP_SIGNAL_SET +create procedure test_invalid() +begin + DECLARE foo CONDITION FOR SQLSTATE '12345'; + SIGNAL foo SET MESSAGE_TEXT = 'foo', MESSAGE_TEXT = 'bar'; +end $$ + +--error ER_DUP_SIGNAL_SET +create procedure test_invalid() +begin + DECLARE foo CONDITION FOR SQLSTATE '12345'; + SIGNAL foo SET MYSQL_ERRNO = 'foo', MYSQL_ERRNO = 'bar'; +end $$ + +create procedure test_signal_syntax() +begin + DECLARE foo CONDITION FOR SQLSTATE '12345'; + SIGNAL foo SET + CLASS_ORIGIN = 'foo', + SUBCLASS_ORIGIN = 'foo', + CONSTRAINT_CATALOG = 'foo', + CONSTRAINT_SCHEMA = 'foo', + CONSTRAINT_NAME = 'foo', + CATALOG_NAME = 'foo', + SCHEMA_NAME = 'foo', + TABLE_NAME = 'foo', + COLUMN_NAME = 'foo', + CURSOR_NAME = 'foo', + MESSAGE_TEXT = 'foo', + MYSQL_ERRNO = 'foo'; +end $$ +drop procedure test_signal_syntax $$ + +--error ER_SP_BAD_SQLSTATE +SIGNAL SQLSTATE '00000' $$ + +--error ER_SP_BAD_SQLSTATE +SIGNAL SQLSTATE '00001' $$ + +--error ER_SP_BAD_SQLSTATE +create procedure test_invalid() +begin + SIGNAL SQLSTATE '00000'; +end $$ + +--error ER_SP_BAD_SQLSTATE +create procedure test_invalid() +begin + SIGNAL SQLSTATE '00001'; +end $$ + +--echo # +--echo # Test conditions information that SIGNAL can not set +--echo # + +--error ER_PARSE_ERROR +create procedure test_invalid() +begin + SIGNAL SQLSTATE '12345' SET bla_bla = 'foo'; +end $$ + +--error ER_PARSE_ERROR +create procedure test_invalid() +begin + SIGNAL SQLSTATE '12345' SET CONDITION_IDENTIFIER = 'foo'; +end $$ + +--error ER_PARSE_ERROR +create procedure test_invalid() +begin + SIGNAL SQLSTATE '12345' SET CONDITION_NUMBER = 'foo'; +end $$ + +--error ER_PARSE_ERROR +create procedure test_invalid() +begin + SIGNAL SQLSTATE '12345' SET CONNECTION_NAME = 'foo'; +end $$ + +--error ER_PARSE_ERROR +create procedure test_invalid() +begin + SIGNAL SQLSTATE '12345' SET MESSAGE_LENGTH = 'foo'; +end $$ + +--error ER_PARSE_ERROR +create procedure test_invalid() +begin + SIGNAL SQLSTATE '12345' SET MESSAGE_OCTET_LENGTH = 'foo'; +end $$ + +--error ER_PARSE_ERROR +create procedure test_invalid() +begin + SIGNAL SQLSTATE '12345' SET PARAMETER_MODE = 'foo'; +end $$ + +--error ER_PARSE_ERROR +create procedure test_invalid() +begin + SIGNAL SQLSTATE '12345' SET PARAMETER_NAME = 'foo'; +end $$ + +--error ER_PARSE_ERROR +create procedure test_invalid() +begin + SIGNAL SQLSTATE '12345' SET PARAMETER_ORDINAL_POSITION = 'foo'; +end $$ + +--error ER_PARSE_ERROR +create procedure test_invalid() +begin + SIGNAL SQLSTATE '12345' SET RETURNED_SQLSTATE = 'foo'; +end $$ + +--error ER_PARSE_ERROR +create procedure test_invalid() +begin + SIGNAL SQLSTATE '12345' SET ROUTINE_CATALOG = 'foo'; +end $$ + +--error ER_PARSE_ERROR +create procedure test_invalid() +begin + SIGNAL SQLSTATE '12345' SET ROUTINE_NAME = 'foo'; +end $$ + +--error ER_PARSE_ERROR +create procedure test_invalid() +begin + SIGNAL SQLSTATE '12345' SET ROUTINE_SCHEMA = 'foo'; +end $$ + +--error ER_PARSE_ERROR +create procedure test_invalid() +begin + SIGNAL SQLSTATE '12345' SET SERVER_NAME = 'foo'; +end $$ + +--error ER_PARSE_ERROR +create procedure test_invalid() +begin + SIGNAL SQLSTATE '12345' SET SPECIFIC_NAME = 'foo'; +end $$ + +--error ER_PARSE_ERROR +create procedure test_invalid() +begin + SIGNAL SQLSTATE '12345' SET TRIGGER_CATALOG = 'foo'; +end $$ + +--error ER_PARSE_ERROR +create procedure test_invalid() +begin + SIGNAL SQLSTATE '12345' SET TRIGGER_NAME = 'foo'; +end $$ + +--error ER_PARSE_ERROR +create procedure test_invalid() +begin + SIGNAL SQLSTATE '12345' SET TRIGGER_SCHEMA = 'foo'; +end $$ + +delimiter ;$$ + +--echo # +--echo # Test the RESIGNAL syntax +--echo # + +--disable_warnings +drop procedure if exists test_invalid; +drop procedure if exists test_resignal_syntax; +--enable_warnings + +delimiter $$; + +--error ER_SP_COND_MISMATCH +create procedure test_invalid() +begin + RESIGNAL foo; +end $$ + +create procedure test_resignal_syntax() +begin + RESIGNAL; +end $$ +drop procedure test_resignal_syntax $$ + +--error ER_SIGNAL_BAD_CONDITION_TYPE +create procedure test_invalid() +begin + DECLARE foo CONDITION FOR 1234; + RESIGNAL foo; +end $$ + +create procedure test_resignal_syntax() +begin + DECLARE foo CONDITION FOR SQLSTATE '12345'; + RESIGNAL foo; +end $$ +drop procedure test_resignal_syntax $$ + +create procedure test_resignal_syntax() +begin + RESIGNAL SQLSTATE '23000'; +end $$ +drop procedure test_resignal_syntax $$ + +create procedure test_resignal_syntax() +begin + RESIGNAL SQLSTATE VALUE '23000'; +end $$ +drop procedure test_resignal_syntax $$ + +create procedure test_resignal_syntax() +begin + RESIGNAL SET CLASS_ORIGIN = 'foo'; +end $$ +drop procedure test_resignal_syntax $$ + +create procedure test_resignal_syntax() +begin + DECLARE foo CONDITION FOR SQLSTATE '12345'; + RESIGNAL foo SET CLASS_ORIGIN = 'foo'; +end $$ +drop procedure test_resignal_syntax $$ + +create procedure test_resignal_syntax() +begin + RESIGNAL SET SUBCLASS_ORIGIN = 'foo'; +end $$ +drop procedure test_resignal_syntax $$ + +create procedure test_resignal_syntax() +begin + DECLARE foo CONDITION FOR SQLSTATE '12345'; + RESIGNAL foo SET SUBCLASS_ORIGIN = 'foo'; +end $$ +drop procedure test_resignal_syntax $$ + +create procedure test_resignal_syntax() +begin + RESIGNAL SET CONSTRAINT_CATALOG = 'foo'; +end $$ +drop procedure test_resignal_syntax $$ + +create procedure test_resignal_syntax() +begin + DECLARE foo CONDITION FOR SQLSTATE '12345'; + RESIGNAL foo SET CONSTRAINT_CATALOG = 'foo'; +end $$ +drop procedure test_resignal_syntax $$ + +create procedure test_resignal_syntax() +begin + RESIGNAL SET CONSTRAINT_SCHEMA = 'foo'; +end $$ +drop procedure test_resignal_syntax $$ + +create procedure test_resignal_syntax() +begin + DECLARE foo CONDITION FOR SQLSTATE '12345'; + RESIGNAL foo SET CONSTRAINT_SCHEMA = 'foo'; +end $$ +drop procedure test_resignal_syntax $$ + +create procedure test_resignal_syntax() +begin + RESIGNAL SET CONSTRAINT_NAME = 'foo'; +end $$ +drop procedure test_resignal_syntax $$ + +create procedure test_resignal_syntax() +begin + DECLARE foo CONDITION FOR SQLSTATE '12345'; + RESIGNAL foo SET CONSTRAINT_NAME = 'foo'; +end $$ +drop procedure test_resignal_syntax $$ + +create procedure test_resignal_syntax() +begin + RESIGNAL SET CATALOG_NAME = 'foo'; +end $$ +drop procedure test_resignal_syntax $$ + +create procedure test_resignal_syntax() +begin + DECLARE foo CONDITION FOR SQLSTATE '12345'; + RESIGNAL foo SET CATALOG_NAME = 'foo'; +end $$ +drop procedure test_resignal_syntax $$ + +create procedure test_resignal_syntax() +begin + RESIGNAL SET SCHEMA_NAME = 'foo'; +end $$ +drop procedure test_resignal_syntax $$ + +create procedure test_resignal_syntax() +begin + DECLARE foo CONDITION FOR SQLSTATE '12345'; + RESIGNAL foo SET SCHEMA_NAME = 'foo'; +end $$ +drop procedure test_resignal_syntax $$ + +create procedure test_resignal_syntax() +begin + RESIGNAL SET TABLE_NAME = 'foo'; +end $$ +drop procedure test_resignal_syntax $$ + +create procedure test_resignal_syntax() +begin + DECLARE foo CONDITION FOR SQLSTATE '12345'; + RESIGNAL foo SET TABLE_NAME = 'foo'; +end $$ +drop procedure test_resignal_syntax $$ + +create procedure test_resignal_syntax() +begin + RESIGNAL SET COLUMN_NAME = 'foo'; +end $$ +drop procedure test_resignal_syntax $$ + +create procedure test_resignal_syntax() +begin + DECLARE foo CONDITION FOR SQLSTATE '12345'; + RESIGNAL foo SET COLUMN_NAME = 'foo'; +end $$ +drop procedure test_resignal_syntax $$ + +create procedure test_resignal_syntax() +begin + RESIGNAL SET CURSOR_NAME = 'foo'; +end $$ +drop procedure test_resignal_syntax $$ + +create procedure test_resignal_syntax() +begin + DECLARE foo CONDITION FOR SQLSTATE '12345'; + RESIGNAL foo SET CURSOR_NAME = 'foo'; +end $$ +drop procedure test_resignal_syntax $$ + +create procedure test_resignal_syntax() +begin + RESIGNAL SET MESSAGE_TEXT = 'foo'; +end $$ +drop procedure test_resignal_syntax $$ + +create procedure test_resignal_syntax() +begin + DECLARE foo CONDITION FOR SQLSTATE '12345'; + RESIGNAL foo SET MESSAGE_TEXT = 'foo'; +end $$ +drop procedure test_resignal_syntax $$ + +create procedure test_resignal_syntax() +begin + RESIGNAL SET MYSQL_ERRNO = 'foo'; +end $$ +drop procedure test_resignal_syntax $$ + +create procedure test_resignal_syntax() +begin + DECLARE foo CONDITION FOR SQLSTATE '12345'; + RESIGNAL foo SET MYSQL_ERRNO = 'foo'; +end $$ +drop procedure test_resignal_syntax $$ + +--error ER_DUP_SIGNAL_SET +create procedure test_invalid() +begin + DECLARE foo CONDITION FOR SQLSTATE '12345'; + RESIGNAL foo SET CLASS_ORIGIN = 'foo', CLASS_ORIGIN = 'bar'; +end $$ + +--error ER_DUP_SIGNAL_SET +create procedure test_invalid() +begin + DECLARE foo CONDITION FOR SQLSTATE '12345'; + RESIGNAL foo SET MESSAGE_TEXT = 'foo', MESSAGE_TEXT = 'bar'; +end $$ + +--error ER_DUP_SIGNAL_SET +create procedure test_invalid() +begin + DECLARE foo CONDITION FOR SQLSTATE '12345'; + RESIGNAL foo SET MYSQL_ERRNO = 'foo', MYSQL_ERRNO = 'bar'; +end $$ + +create procedure test_resignal_syntax() +begin + DECLARE foo CONDITION FOR SQLSTATE '12345'; + RESIGNAL foo SET + CLASS_ORIGIN = 'foo', + SUBCLASS_ORIGIN = 'foo', + CONSTRAINT_CATALOG = 'foo', + CONSTRAINT_SCHEMA = 'foo', + CONSTRAINT_NAME = 'foo', + CATALOG_NAME = 'foo', + SCHEMA_NAME = 'foo', + TABLE_NAME = 'foo', + COLUMN_NAME = 'foo', + CURSOR_NAME = 'foo', + MESSAGE_TEXT = 'foo'; +end $$ +drop procedure test_resignal_syntax $$ + +--error ER_SP_BAD_SQLSTATE +create procedure test_invalid() +begin + RESIGNAL SQLSTATE '00000'; +end $$ + +--error ER_SP_BAD_SQLSTATE +create procedure test_invalid() +begin + RESIGNAL SQLSTATE '00001'; +end $$ + +delimiter ;$$ + +--echo # +--echo # PART 2: non preparable statements +--echo # + +--error ER_UNSUPPORTED_PS +prepare stmt from 'SIGNAL SQLSTATE \'23000\''; + +--error ER_UNSUPPORTED_PS +prepare stmt from 'RESIGNAL SQLSTATE \'23000\''; + +--echo # +--echo # PART 3: runtime execution +--echo # + +--disable_warnings +drop procedure if exists test_signal; +drop procedure if exists test_resignal; +drop table if exists t_warn; +drop table if exists t_cursor; +--enable_warnings + +# Helper tables +create table t_warn(a integer(2)); +create table t_cursor(a integer); + +--echo # +--echo # SIGNAL can also appear in a query +--echo # + +--error ER_SP_COND_MISMATCH +SIGNAL foo; + +SIGNAL SQLSTATE '01000'; + +--error ER_SIGNAL_NOT_FOUND +SIGNAL SQLSTATE '02000'; + +--error ER_SIGNAL_EXCEPTION +SIGNAL SQLSTATE '23000'; + +--error ER_SIGNAL_EXCEPTION +SIGNAL SQLSTATE VALUE '23000'; + +--error ER_WRONG_VALUE_FOR_VAR +SIGNAL SQLSTATE 'HY000' SET MYSQL_ERRNO = 65536; + +--error ER_WRONG_VALUE_FOR_VAR +SIGNAL SQLSTATE 'HY000' SET MYSQL_ERRNO = 99999; + +--error ER_WRONG_VALUE_FOR_VAR +SIGNAL SQLSTATE 'HY000' SET MYSQL_ERRNO = 4294967295; + +--error ER_WRONG_VALUE_FOR_VAR +SIGNAL SQLSTATE 'HY000' SET MYSQL_ERRNO = 0; + +--error ER_PARSE_ERROR +SIGNAL SQLSTATE 'HY000' SET MYSQL_ERRNO = -1; + +--error 65535 +SIGNAL SQLSTATE 'HY000' SET MYSQL_ERRNO = 65535; + +--echo # +--echo # RESIGNAL can also appear in a query +--echo # + +--error ER_RESIGNAL_WITHOUT_ACTIVE_HANDLER +RESIGNAL; + +--error ER_SP_COND_MISMATCH +RESIGNAL foo; + +--error ER_RESIGNAL_WITHOUT_ACTIVE_HANDLER +RESIGNAL SQLSTATE '12345'; + +--error ER_RESIGNAL_WITHOUT_ACTIVE_HANDLER +RESIGNAL SQLSTATE VALUE '12345'; + +--echo # +--echo # Different kind of SIGNAL conditions +--echo # + +delimiter $$; + +create procedure test_signal() +begin + # max range + DECLARE foo CONDITION FOR SQLSTATE 'AABBB'; + SIGNAL foo SET MYSQL_ERRNO = 65535; +end $$ + +--error 65535 +call test_signal() $$ +drop procedure test_signal $$ + +create procedure test_signal() +begin + # max range + DECLARE foo CONDITION FOR SQLSTATE 'AABBB'; + SIGNAL foo SET MYSQL_ERRNO = 65536; +end $$ + +--error ER_WRONG_VALUE_FOR_VAR +call test_signal() $$ +drop procedure test_signal $$ + +create procedure test_signal() +begin + # Error + DECLARE foo CONDITION FOR SQLSTATE '99999'; + SIGNAL foo SET MYSQL_ERRNO = 9999; +end $$ + +--error 9999 +call test_signal() $$ +drop procedure test_signal $$ + +create procedure test_signal() +begin + # warning + DECLARE too_few_records CONDITION FOR SQLSTATE '01000'; + SIGNAL too_few_records SET MYSQL_ERRNO = 1261; +end $$ + +call test_signal() $$ +drop procedure test_signal $$ + +create procedure test_signal() +begin + # Not found + DECLARE sp_fetch_no_data CONDITION FOR SQLSTATE '02000'; + SIGNAL sp_fetch_no_data SET MYSQL_ERRNO = 1329; +end $$ + +--error ER_SP_FETCH_NO_DATA +call test_signal() $$ +drop procedure test_signal $$ + +create procedure test_signal() +begin + # Error + DECLARE sp_cursor_already_open CONDITION FOR SQLSTATE '24000'; + SIGNAL sp_cursor_already_open SET MYSQL_ERRNO = 1325; +end $$ + +--error ER_SP_CURSOR_ALREADY_OPEN +call test_signal() $$ +drop procedure test_signal $$ + +create procedure test_signal() +begin + # Severe error + DECLARE lock_deadlock CONDITION FOR SQLSTATE '40001'; + SIGNAL lock_deadlock SET MYSQL_ERRNO = 1213; +end $$ + +--error ER_LOCK_DEADLOCK +call test_signal() $$ +drop procedure test_signal $$ + +create procedure test_signal() +begin + # Unknown -> error + DECLARE foo CONDITION FOR SQLSTATE "99999"; + SIGNAL foo; +end $$ + +--error ER_SIGNAL_EXCEPTION +call test_signal() $$ +drop procedure test_signal $$ + +create procedure test_signal() +begin + # warning, no subclass + DECLARE warn CONDITION FOR SQLSTATE "01000"; + SIGNAL warn; +end $$ + +call test_signal() $$ +drop procedure test_signal $$ + +create procedure test_signal() +begin + # warning, with subclass + DECLARE warn CONDITION FOR SQLSTATE "01123"; + SIGNAL warn; +end $$ + +call test_signal() $$ +drop procedure test_signal $$ + +create procedure test_signal() +begin + # Not found, no subclass + DECLARE not_found CONDITION FOR SQLSTATE "02000"; + SIGNAL not_found; +end $$ + +--error ER_SIGNAL_NOT_FOUND +call test_signal() $$ +drop procedure test_signal $$ + +create procedure test_signal() +begin + # Not found, with subclass + DECLARE not_found CONDITION FOR SQLSTATE "02XXX"; + SIGNAL not_found; +end $$ + +--error ER_SIGNAL_NOT_FOUND +call test_signal() $$ +drop procedure test_signal $$ + +create procedure test_signal() +begin + # Error, no subclass + DECLARE error CONDITION FOR SQLSTATE "12000"; + SIGNAL error; +end $$ + +--error ER_SIGNAL_EXCEPTION +call test_signal() $$ +drop procedure test_signal $$ + +create procedure test_signal() +begin + # Error, with subclass + DECLARE error CONDITION FOR SQLSTATE "12ABC"; + SIGNAL error; +end $$ + +--error ER_SIGNAL_EXCEPTION +call test_signal() $$ +drop procedure test_signal $$ + +create procedure test_signal() +begin + # Severe error, no subclass + DECLARE error CONDITION FOR SQLSTATE "40000"; + SIGNAL error; +end $$ + +--error ER_SIGNAL_EXCEPTION +call test_signal() $$ +drop procedure test_signal $$ + +create procedure test_signal() +begin + # Severe error, with subclass + DECLARE error CONDITION FOR SQLSTATE "40001"; + SIGNAL error; +end $$ + +--error ER_SIGNAL_EXCEPTION +call test_signal() $$ +drop procedure test_signal $$ + +--echo # +--echo # Test the scope of condition +--echo # + +create procedure test_signal() +begin + DECLARE foo CONDITION FOR SQLSTATE '99999'; + begin + DECLARE foo CONDITION FOR 8888; + end; + SIGNAL foo SET MYSQL_ERRNO=9999; /* outer */ +end $$ + +--error 9999 +call test_signal() $$ +drop procedure test_signal $$ + +create procedure test_signal() +begin + DECLARE foo CONDITION FOR 9999; + begin + DECLARE foo CONDITION FOR SQLSTATE '88888'; + SIGNAL foo SET MYSQL_ERRNO=8888; /* inner */ + end; +end $$ + +--error 8888 +call test_signal() $$ +drop procedure test_signal $$ + +--echo # +--echo # Test SET MYSQL_ERRNO +--echo # + +create procedure test_signal() +begin + DECLARE foo CONDITION FOR SQLSTATE '99999'; + SIGNAL foo SET MYSQL_ERRNO = 1111; +end $$ + +--error 1111 +call test_signal() $$ +drop procedure test_signal $$ + +create procedure test_signal() +begin + DECLARE warn CONDITION FOR SQLSTATE "01000"; + SIGNAL warn SET MYSQL_ERRNO = 1111; +end $$ + +call test_signal() $$ +drop procedure test_signal $$ + +create procedure test_signal() +begin + DECLARE not_found CONDITION FOR SQLSTATE "02000"; + SIGNAL not_found SET MYSQL_ERRNO = 1111; +end $$ + +--error 1111 +call test_signal() $$ +drop procedure test_signal $$ + +create procedure test_signal() +begin + DECLARE error CONDITION FOR SQLSTATE "55000"; + SIGNAL error SET MYSQL_ERRNO = 1111; +end $$ + +--error 1111 +call test_signal() $$ +drop procedure test_signal $$ + +--echo # +--echo # Test SET MESSAGE_TEXT +--echo # + +--error ER_SIGNAL_EXCEPTION +SIGNAL SQLSTATE '77777' SET MESSAGE_TEXT='' $$ + +create procedure test_signal() +begin + DECLARE foo CONDITION FOR SQLSTATE '77777'; + SIGNAL foo SET + MESSAGE_TEXT = "", + MYSQL_ERRNO=5678; +end $$ + +--error 5678 +call test_signal() $$ +drop procedure test_signal $$ + +create procedure test_signal() +begin + DECLARE foo CONDITION FOR SQLSTATE '99999'; + SIGNAL foo SET + MESSAGE_TEXT = "Something bad happened", + MYSQL_ERRNO=9999; +end $$ + +--error 9999 +call test_signal() $$ +drop procedure test_signal $$ + +create procedure test_signal() +begin + DECLARE warn CONDITION FOR SQLSTATE "01000"; + SIGNAL warn SET MESSAGE_TEXT = "Something bad happened"; +end $$ + +call test_signal() $$ +drop procedure test_signal $$ + +create procedure test_signal() +begin + DECLARE not_found CONDITION FOR SQLSTATE "02000"; + SIGNAL not_found SET MESSAGE_TEXT = "Something bad happened"; +end $$ + +--error ER_SIGNAL_NOT_FOUND +call test_signal() $$ +drop procedure test_signal $$ + +create procedure test_signal() +begin + DECLARE error CONDITION FOR SQLSTATE "55000"; + SIGNAL error SET MESSAGE_TEXT = "Something bad happened"; +end $$ + +--error ER_SIGNAL_EXCEPTION +call test_signal() $$ +drop procedure test_signal $$ + +create procedure test_signal() +begin + DECLARE something CONDITION FOR SQLSTATE "01000"; + SIGNAL something SET MESSAGE_TEXT = _utf8 "This is a UTF8 text"; +end $$ + +call test_signal() $$ +drop procedure test_signal $$ + +create procedure test_signal() +begin + DECLARE something CONDITION FOR SQLSTATE "01000"; + SIGNAL something SET MESSAGE_TEXT = ""; +end $$ + +call test_signal() $$ +drop procedure test_signal $$ + +create procedure test_signal() +begin + DECLARE warn CONDITION FOR SQLSTATE "01111"; + SIGNAL warn SET MESSAGE_TEXT = "á a"; +end $$ + +call test_signal() $$ +show warnings $$ +drop procedure test_signal $$ + +--echo # +--echo # Test SET complex expressions +--echo # + +create procedure test_signal() +begin + DECLARE error CONDITION FOR SQLSTATE '99999'; + SIGNAL error SET + MYSQL_ERRNO = NULL; +end $$ + +--error ER_WRONG_VALUE_FOR_VAR +call test_signal() $$ +drop procedure test_signal $$ + +create procedure test_signal() +begin + DECLARE error CONDITION FOR SQLSTATE '99999'; + SIGNAL error SET + CLASS_ORIGIN = NULL; +end $$ + +--error ER_WRONG_VALUE_FOR_VAR +call test_signal() $$ +drop procedure test_signal $$ + +create procedure test_signal() +begin + DECLARE error CONDITION FOR SQLSTATE '99999'; + SIGNAL error SET + SUBCLASS_ORIGIN = NULL; +end $$ + +--error ER_WRONG_VALUE_FOR_VAR +call test_signal() $$ +drop procedure test_signal $$ + +create procedure test_signal() +begin + DECLARE error CONDITION FOR SQLSTATE '99999'; + SIGNAL error SET + CONSTRAINT_CATALOG = NULL; +end $$ + +--error ER_WRONG_VALUE_FOR_VAR +call test_signal() $$ +drop procedure test_signal $$ + +create procedure test_signal() +begin + DECLARE error CONDITION FOR SQLSTATE '99999'; + SIGNAL error SET + CONSTRAINT_SCHEMA = NULL; +end $$ + +--error ER_WRONG_VALUE_FOR_VAR +call test_signal() $$ +drop procedure test_signal $$ + +create procedure test_signal() +begin + DECLARE error CONDITION FOR SQLSTATE '99999'; + SIGNAL error SET + CONSTRAINT_NAME = NULL; +end $$ + +--error ER_WRONG_VALUE_FOR_VAR +call test_signal() $$ +drop procedure test_signal $$ + +create procedure test_signal() +begin + DECLARE error CONDITION FOR SQLSTATE '99999'; + SIGNAL error SET + CATALOG_NAME = NULL; +end $$ + +--error ER_WRONG_VALUE_FOR_VAR +call test_signal() $$ +drop procedure test_signal $$ + +create procedure test_signal() +begin + DECLARE error CONDITION FOR SQLSTATE '99999'; + SIGNAL error SET + SCHEMA_NAME = NULL; +end $$ + +--error ER_WRONG_VALUE_FOR_VAR +call test_signal() $$ +drop procedure test_signal $$ + +create procedure test_signal() +begin + DECLARE error CONDITION FOR SQLSTATE '99999'; + SIGNAL error SET + TABLE_NAME = NULL; +end $$ + +--error ER_WRONG_VALUE_FOR_VAR +call test_signal() $$ +drop procedure test_signal $$ + +create procedure test_signal() +begin + DECLARE error CONDITION FOR SQLSTATE '99999'; + SIGNAL error SET + COLUMN_NAME = NULL; +end $$ + +--error ER_WRONG_VALUE_FOR_VAR +call test_signal() $$ +drop procedure test_signal $$ + +create procedure test_signal() +begin + DECLARE error CONDITION FOR SQLSTATE '99999'; + SIGNAL error SET + CURSOR_NAME = NULL; +end $$ + +--error ER_WRONG_VALUE_FOR_VAR +call test_signal() $$ +drop procedure test_signal $$ + +create procedure test_signal() +begin + DECLARE error CONDITION FOR SQLSTATE '99999'; + SIGNAL error SET + MESSAGE_TEXT = NULL; +end $$ + +--error ER_WRONG_VALUE_FOR_VAR +call test_signal() $$ +drop procedure test_signal $$ + +create procedure test_signal() +begin + DECLARE something CONDITION FOR SQLSTATE '99999'; + DECLARE message_text VARCHAR(64) DEFAULT "Local string variable"; + DECLARE sqlcode INTEGER DEFAULT 1234; + + SIGNAL something SET + MESSAGE_TEXT = message_text, + MYSQL_ERRNO = sqlcode; +end $$ + +--error 1234 +call test_signal() $$ +drop procedure test_signal $$ + +create procedure test_signal(message_text VARCHAR(64), sqlcode INTEGER) +begin + DECLARE something CONDITION FOR SQLSTATE "12345"; + + SIGNAL something SET + MESSAGE_TEXT = message_text, + MYSQL_ERRNO = sqlcode; +end $$ + +--error ER_WRONG_VALUE_FOR_VAR +call test_signal("Parameter string", NULL) $$ + +--error ER_WRONG_VALUE_FOR_VAR +call test_signal(NULL, 1234) $$ + +--error 5678 +call test_signal("Parameter string", 5678) $$ +drop procedure test_signal $$ + +create procedure test_signal() +begin + DECLARE something CONDITION FOR SQLSTATE "AABBB"; + + SIGNAL something SET + MESSAGE_TEXT = @message_text, + MYSQL_ERRNO = @sqlcode; +end $$ + +--error ER_WRONG_VALUE_FOR_VAR +call test_signal() $$ + +set @sqlcode= 12 $$ + +--error ER_WRONG_VALUE_FOR_VAR +call test_signal() $$ + +set @message_text= "User variable" $$ + +--error 12 +call test_signal() $$ +drop procedure test_signal $$ + +--error ER_PARSE_ERROR +create procedure test_invalid() +begin + DECLARE something CONDITION FOR SQLSTATE "AABBB"; + + SIGNAL something SET + MESSAGE_TEXT = @message_text := 'illegal', + MYSQL_ERRNO = @sqlcode := 1234; +end $$ + +create procedure test_signal() +begin + DECLARE aaa VARCHAR(64); + DECLARE bbb VARCHAR(64); + DECLARE ccc VARCHAR(64); + DECLARE ddd VARCHAR(64); + DECLARE eee VARCHAR(64); + DECLARE fff VARCHAR(64); + DECLARE ggg VARCHAR(64); + DECLARE hhh VARCHAR(64); + DECLARE iii VARCHAR(64); + DECLARE jjj VARCHAR(64); + DECLARE kkk VARCHAR(64); + + DECLARE warn CONDITION FOR SQLSTATE "01234"; + + set aaa= repeat("A", 64); + set bbb= repeat("B", 64); + set ccc= repeat("C", 64); + set ddd= repeat("D", 64); + set eee= repeat("E", 64); + set fff= repeat("F", 64); + set ggg= repeat("G", 64); + set hhh= repeat("H", 64); + set iii= repeat("I", 64); + set jjj= repeat("J", 64); + set kkk= repeat("K", 64); + + SIGNAL warn SET + CLASS_ORIGIN = aaa, + SUBCLASS_ORIGIN = bbb, + CONSTRAINT_CATALOG = ccc, + CONSTRAINT_SCHEMA = ddd, + CONSTRAINT_NAME = eee, + CATALOG_NAME = fff, + SCHEMA_NAME = ggg, + TABLE_NAME = hhh, + COLUMN_NAME = iii, + CURSOR_NAME = jjj, + MESSAGE_TEXT = kkk, + MYSQL_ERRNO = 65535; +end $$ + +call test_signal() $$ +drop procedure test_signal $$ + +create procedure test_signal() +begin + DECLARE warn CONDITION FOR SQLSTATE "01234"; + + SIGNAL warn SET + MYSQL_ERRNO = 999999999999999999999999999999999999999999999999999; +end $$ + +--error ER_WRONG_VALUE_FOR_VAR +call test_signal() $$ +drop procedure test_signal $$ + +create procedure test_signal() +begin + DECLARE aaax VARCHAR(65); + DECLARE bbbx VARCHAR(65); + DECLARE cccx VARCHAR(65); + DECLARE dddx VARCHAR(65); + DECLARE eeex VARCHAR(65); + DECLARE fffx VARCHAR(65); + DECLARE gggx VARCHAR(65); + DECLARE hhhx VARCHAR(65); + DECLARE iiix VARCHAR(65); + DECLARE jjjx VARCHAR(65); + DECLARE kkkx VARCHAR(65); + DECLARE lllx VARCHAR(129); + + DECLARE warn CONDITION FOR SQLSTATE "01234"; + + set aaax= concat(repeat("A", 64), "X"); + set bbbx= concat(repeat("B", 64), "X"); + set cccx= concat(repeat("C", 64), "X"); + set dddx= concat(repeat("D", 64), "X"); + set eeex= concat(repeat("E", 64), "X"); + set fffx= concat(repeat("F", 64), "X"); + set gggx= concat(repeat("G", 64), "X"); + set hhhx= concat(repeat("H", 64), "X"); + set iiix= concat(repeat("I", 64), "X"); + set jjjx= concat(repeat("J", 64), "X"); + set kkkx= concat(repeat("K", 64), "X"); + set lllx= concat(repeat("1", 100), + repeat("2", 20), + repeat("8", 8), + "X"); + + SIGNAL warn SET + CLASS_ORIGIN = aaax, + SUBCLASS_ORIGIN = bbbx, + CONSTRAINT_CATALOG = cccx, + CONSTRAINT_SCHEMA = dddx, + CONSTRAINT_NAME = eeex, + CATALOG_NAME = fffx, + SCHEMA_NAME = gggx, + TABLE_NAME = hhhx, + COLUMN_NAME = iiix, + CURSOR_NAME = jjjx, + MESSAGE_TEXT = lllx, + MYSQL_ERRNO = 10000; +end $$ + +#NOTE: the warning text for ER_TRUNCATED_WRONG_VALUE contains +# value: '%-.128s', so the warning printed truncates the value too, +# which affects MESSAGE_TEXT (the X is missing) + +call test_signal() $$ +drop procedure test_signal $$ + +# Test that HANDLER can catch conditions raised by SIGNAL + +create procedure test_signal() +begin + DECLARE warn CONDITION FOR SQLSTATE "01234"; + DECLARE CONTINUE HANDLER for SQLSTATE "01234" + begin + select "Caught by SQLSTATE"; + end; + + SIGNAL warn SET + MESSAGE_TEXT = "Raising a warning", + MYSQL_ERRNO = 1012; +end $$ + +call test_signal() $$ +drop procedure test_signal $$ + +create procedure test_signal() +begin + DECLARE warn CONDITION FOR SQLSTATE "01234"; + DECLARE CONTINUE HANDLER for 1012 + begin + select "Caught by number"; + end; + + SIGNAL warn SET + MESSAGE_TEXT = "Raising a warning", + MYSQL_ERRNO = 1012; +end $$ + +call test_signal() $$ +drop procedure test_signal $$ + +create procedure test_signal() +begin + DECLARE warn CONDITION FOR SQLSTATE "01234"; + DECLARE CONTINUE HANDLER for SQLWARNING + begin + select "Caught by SQLWARNING"; + end; + + SIGNAL warn SET + MESSAGE_TEXT = "Raising a warning", + MYSQL_ERRNO = 1012; +end $$ + +call test_signal() $$ +drop procedure test_signal $$ + +create procedure test_signal() +begin + DECLARE not_found CONDITION FOR SQLSTATE "02ABC"; + DECLARE CONTINUE HANDLER for SQLSTATE "02ABC" + begin + select "Caught by SQLSTATE"; + end; + + SIGNAL not_found SET + MESSAGE_TEXT = "Raising a not found", + MYSQL_ERRNO = 1012; +end $$ + +call test_signal() $$ +drop procedure test_signal $$ + +create procedure test_signal() +begin + DECLARE not_found CONDITION FOR SQLSTATE "02ABC"; + DECLARE CONTINUE HANDLER for 1012 + begin + select "Caught by number"; + end; + + SIGNAL not_found SET + MESSAGE_TEXT = "Raising a not found", + MYSQL_ERRNO = 1012; +end $$ + +call test_signal() $$ +drop procedure test_signal $$ + +create procedure test_signal() +begin + DECLARE not_found CONDITION FOR SQLSTATE "02ABC"; + DECLARE CONTINUE HANDLER for NOT FOUND + begin + select "Caught by NOT FOUND"; + end; + + SIGNAL not_found SET + MESSAGE_TEXT = "Raising a not found", + MYSQL_ERRNO = 1012; +end $$ + +call test_signal() $$ +drop procedure test_signal $$ + +create procedure test_signal() +begin + DECLARE error CONDITION FOR SQLSTATE "55555"; + DECLARE CONTINUE HANDLER for SQLSTATE "55555" + begin + select "Caught by SQLSTATE"; + end; + + SIGNAL error SET + MESSAGE_TEXT = "Raising an error", + MYSQL_ERRNO = 1012; +end $$ + +call test_signal() $$ +drop procedure test_signal $$ + +create procedure test_signal() +begin + DECLARE error CONDITION FOR SQLSTATE "55555"; + DECLARE CONTINUE HANDLER for 1012 + begin + select "Caught by number"; + end; + + SIGNAL error SET + MESSAGE_TEXT = "Raising an error", + MYSQL_ERRNO = 1012; +end $$ + +call test_signal() $$ +drop procedure test_signal $$ + +create procedure test_signal() +begin + DECLARE error CONDITION FOR SQLSTATE "55555"; + DECLARE CONTINUE HANDLER for SQLEXCEPTION + begin + select "Caught by SQLEXCEPTION"; + end; + + SIGNAL error SET + MESSAGE_TEXT = "Raising an error", + MYSQL_ERRNO = 1012; +end $$ + +call test_signal() $$ +drop procedure test_signal $$ + +--echo # +--echo # Test where SIGNAL can be used +--echo # + +create function test_signal_func() returns integer +begin + DECLARE warn CONDITION FOR SQLSTATE "01XXX"; + + SIGNAL warn SET + MESSAGE_TEXT = "This function SIGNAL a warning", + MYSQL_ERRNO = 1012; + + return 5; +end $$ + +select test_signal_func() $$ +drop function test_signal_func $$ + +create function test_signal_func() returns integer +begin + DECLARE not_found CONDITION FOR SQLSTATE "02XXX"; + + SIGNAL not_found SET + MESSAGE_TEXT = "This function SIGNAL not found", + MYSQL_ERRNO = 1012; + + return 5; +end $$ + +--error 1012 +select test_signal_func() $$ +drop function test_signal_func $$ + +create function test_signal_func() returns integer +begin + DECLARE error CONDITION FOR SQLSTATE "50000"; + + SIGNAL error SET + MESSAGE_TEXT = "This function SIGNAL an error", + MYSQL_ERRNO = 1012; + + return 5; +end $$ + +--error 1012 +select test_signal_func() $$ +drop function test_signal_func $$ + +--disable_warnings +drop table if exists t1 $$ +--enable_warnings + +create table t1 (a integer) $$ + +create trigger t1_ai after insert on t1 for each row +begin + DECLARE msg VARCHAR(128); + DECLARE warn CONDITION FOR SQLSTATE "01XXX"; + + set msg= concat("This trigger SIGNAL a warning, a=", NEW.a); + SIGNAL warn SET + MESSAGE_TEXT = msg, + MYSQL_ERRNO = 1012; +end $$ + +insert into t1 values (1), (2) $$ + +drop trigger t1_ai $$ + +create trigger t1_ai after insert on t1 for each row +begin + DECLARE msg VARCHAR(128); + DECLARE not_found CONDITION FOR SQLSTATE "02XXX"; + + set msg= concat("This trigger SIGNAL a not found, a=", NEW.a); + SIGNAL not_found SET + MESSAGE_TEXT = msg, + MYSQL_ERRNO = 1012; +end $$ + +--error 1012 +insert into t1 values (3), (4) $$ + +drop trigger t1_ai $$ + +create trigger t1_ai after insert on t1 for each row +begin + DECLARE msg VARCHAR(128); + DECLARE error CONDITION FOR SQLSTATE "03XXX"; + + set msg= concat("This trigger SIGNAL an error, a=", NEW.a); + SIGNAL error SET + MESSAGE_TEXT = msg, + MYSQL_ERRNO = 1012; +end $$ + +--error 1012 +insert into t1 values (5), (6) $$ + +drop table t1 $$ + +create table t1 (errno integer, msg varchar(128)) $$ + +create trigger t1_ai after insert on t1 for each row +begin + DECLARE warn CONDITION FOR SQLSTATE "01XXX"; + + SIGNAL warn SET + MESSAGE_TEXT = NEW.msg, + MYSQL_ERRNO = NEW.errno; +end $$ + +insert into t1 set errno=1012, msg='Warning message 1 in trigger' $$ +insert into t1 set errno=1013, msg='Warning message 2 in trigger' $$ + +drop table t1 $$ + +--disable_warnings +drop table if exists t1 $$ +drop procedure if exists p1 $$ +drop function if exists f1 $$ +--enable_warnings + +create table t1 (s1 int) $$ +insert into t1 values (1) $$ + +create procedure p1() +begin + declare a int; + declare c cursor for select f1() from t1; + declare continue handler for sqlstate '03000' + select "caught 03000"; + declare continue handler for 1326 + select "caught cursor is not open"; + + select "Before open"; + open c; + select "Before fetch"; + fetch c into a; + select "Before close"; + close c; +end $$ + +create function f1() returns int +begin + signal sqlstate '03000'; + return 5; +end $$ + +## FIXME : MEMORY plugin warning, valgrind leak, bug#36518 +## call p1() $$ + +drop table t1 $$ +drop procedure p1 $$ +drop function f1 $$ + +--echo # +--echo # Test the RESIGNAL runtime +--echo # + +# 6 tests: +# {Signaled warning, Signaled Not Found, Signaled Error, +# warning, not found, error} --> RESIGNAL + +create procedure test_resignal() +begin + DECLARE warn CONDITION FOR SQLSTATE "01234"; + DECLARE CONTINUE HANDLER for 1012 + begin + select "before RESIGNAL"; + RESIGNAL; + select "after RESIGNAL"; + end; + + SIGNAL warn SET + MESSAGE_TEXT = "Raising a warning", + MYSQL_ERRNO = 1012; +end $$ + +call test_resignal() $$ +drop procedure test_resignal $$ + +create procedure test_resignal() +begin + DECLARE not_found CONDITION FOR SQLSTATE "02222"; + DECLARE CONTINUE HANDLER for 1012 + begin + select "before RESIGNAL"; + RESIGNAL; + select "after RESIGNAL"; + end; + + SIGNAL not_found SET + MESSAGE_TEXT = "Raising a not found", + MYSQL_ERRNO = 1012; +end $$ + +--error 1012 +call test_resignal() $$ +drop procedure test_resignal $$ + +create procedure test_resignal() +begin + DECLARE error CONDITION FOR SQLSTATE "55555"; + DECLARE CONTINUE HANDLER for 1012 + begin + select "before RESIGNAL"; + RESIGNAL; + select "after RESIGNAL"; + end; + + SIGNAL error SET + MESSAGE_TEXT = "Raising an error", + MYSQL_ERRNO = 1012; +end $$ + +--error 1012 +call test_resignal() $$ +drop procedure test_resignal $$ + +create procedure test_resignal() +begin + DECLARE CONTINUE HANDLER for sqlwarning + begin + select "before RESIGNAL"; + RESIGNAL; + select "after RESIGNAL"; + end; + + insert into t_warn set a= 9999999999999999; +end $$ + +call test_resignal() $$ +drop procedure test_resignal $$ + +create procedure test_resignal() +begin + DECLARE x integer; + DECLARE c cursor for select * from t_cursor; + DECLARE CONTINUE HANDLER for not found + begin + select "before RESIGNAL"; + RESIGNAL; + select "after RESIGNAL"; + end; + + open c; + fetch c into x; + close c; +end $$ + +--error ER_SP_FETCH_NO_DATA +call test_resignal() $$ +drop procedure test_resignal $$ + +create procedure test_resignal() +begin + DECLARE CONTINUE HANDLER for sqlexception + begin + select "before RESIGNAL"; + RESIGNAL; + select "after RESIGNAL"; + end; + + drop table no_such_table; +end $$ + +--error ER_BAD_TABLE_ERROR +call test_resignal() $$ +drop procedure test_resignal $$ + +# 6 tests: +# {Signaled warning, Signaled Not Found, Signaled Error, +# warning, not found, error} --> RESIGNAL SET ... + +create procedure test_resignal() +begin + DECLARE warn CONDITION FOR SQLSTATE "01234"; + DECLARE CONTINUE HANDLER for 1012 + begin + select "before RESIGNAL"; + RESIGNAL SET + MESSAGE_TEXT = "RESIGNAL of a warning", + MYSQL_ERRNO = 5555 ; + select "after RESIGNAL"; + end; + + SIGNAL warn SET + MESSAGE_TEXT = "Raising a warning", + MYSQL_ERRNO = 1012; +end $$ + +call test_resignal() $$ +drop procedure test_resignal $$ + +create procedure test_resignal() +begin + DECLARE not_found CONDITION FOR SQLSTATE "02111"; + DECLARE CONTINUE HANDLER for 1012 + begin + select "before RESIGNAL"; + RESIGNAL SET + MESSAGE_TEXT = "RESIGNAL of a not found", + MYSQL_ERRNO = 5555 ; + select "after RESIGNAL"; + end; + + SIGNAL not_found SET + MESSAGE_TEXT = "Raising a not found", + MYSQL_ERRNO = 1012; +end $$ + +--error 5555 +call test_resignal() $$ +drop procedure test_resignal $$ + +create procedure test_resignal() +begin + DECLARE error CONDITION FOR SQLSTATE "33333"; + DECLARE CONTINUE HANDLER for 1012 + begin + select "before RESIGNAL"; + RESIGNAL SET + MESSAGE_TEXT = "RESIGNAL of an error", + MYSQL_ERRNO = 5555 ; + select "after RESIGNAL"; + end; + + SIGNAL error SET + MESSAGE_TEXT = "Raising an error", + MYSQL_ERRNO = 1012; +end $$ + +--error 5555 +call test_resignal() $$ +drop procedure test_resignal $$ + +create procedure test_resignal() +begin + DECLARE CONTINUE HANDLER for sqlwarning + begin + select "before RESIGNAL"; + RESIGNAL SET + MESSAGE_TEXT = "RESIGNAL of a warning", + MYSQL_ERRNO = 5555 ; + select "after RESIGNAL"; + end; + + insert into t_warn set a= 9999999999999999; +end $$ + +call test_resignal() $$ +drop procedure test_resignal $$ + +create procedure test_resignal() +begin + DECLARE x integer; + DECLARE c cursor for select * from t_cursor; + DECLARE CONTINUE HANDLER for not found + begin + select "before RESIGNAL"; + RESIGNAL SET + MESSAGE_TEXT = "RESIGNAL of not found", + MYSQL_ERRNO = 5555 ; + select "after RESIGNAL"; + end; + + open c; + fetch c into x; + close c; +end $$ + +--error 5555 +call test_resignal() $$ +drop procedure test_resignal $$ + +create procedure test_resignal() +begin + DECLARE CONTINUE HANDLER for sqlexception + begin + select "before RESIGNAL"; + RESIGNAL SET + MESSAGE_TEXT = "RESIGNAL of an error", + MYSQL_ERRNO = 5555 ; + select "after RESIGNAL"; + end; + + drop table no_such_table; +end $$ + +--error 5555 +call test_resignal() $$ +drop procedure test_resignal $$ + +######################################################### + +# 3 tests: +# {Signaled warning} +# --> RESIGNAL SQLSTATE {warning, not found, error} SET ... + +create procedure test_resignal() +begin + DECLARE warn CONDITION FOR SQLSTATE "01111"; + DECLARE CONTINUE HANDLER for 1012 + begin + select "before RESIGNAL"; + RESIGNAL SQLSTATE "01222" SET + MESSAGE_TEXT = "RESIGNAL to warning", + MYSQL_ERRNO = 5555 ; + select "after RESIGNAL"; + end; + + SIGNAL warn SET + MESSAGE_TEXT = "Raising a warning", + MYSQL_ERRNO = 1012; +end $$ + +call test_resignal() $$ +drop procedure test_resignal $$ + +create procedure test_resignal() +begin + DECLARE warn CONDITION FOR SQLSTATE "01111"; + DECLARE CONTINUE HANDLER for 1012 + begin + select "before RESIGNAL"; + RESIGNAL SQLSTATE "02222" SET + MESSAGE_TEXT = "RESIGNAL to not found", + MYSQL_ERRNO = 5555 ; + select "after RESIGNAL"; + end; + + SIGNAL warn SET + MESSAGE_TEXT = "Raising a warning", + MYSQL_ERRNO = 1012; +end $$ + +--error 5555 +call test_resignal() $$ +show warnings $$ +drop procedure test_resignal $$ + +create procedure test_resignal() +begin + DECLARE warn CONDITION FOR SQLSTATE "01111"; + DECLARE CONTINUE HANDLER for 1012 + begin + select "before RESIGNAL"; + RESIGNAL SQLSTATE "33333" SET + MESSAGE_TEXT = "RESIGNAL to error", + MYSQL_ERRNO = 5555 ; + select "after RESIGNAL"; + end; + + SIGNAL warn SET + MESSAGE_TEXT = "Raising a warning", + MYSQL_ERRNO = 1012; +end $$ + +--error 5555 +call test_resignal() $$ +show warnings $$ +drop procedure test_resignal $$ + +# 3 tests: +# {Signaled not found} +# --> RESIGNAL SQLSTATE {warning, not found, error} SET ... + +create procedure test_resignal() +begin + DECLARE not_found CONDITION FOR SQLSTATE "02ABC"; + DECLARE CONTINUE HANDLER for 1012 + begin + select "before RESIGNAL"; + RESIGNAL SQLSTATE "01222" SET + MESSAGE_TEXT = "RESIGNAL to warning", + MYSQL_ERRNO = 5555 ; + select "after RESIGNAL"; + end; + + SIGNAL not_found SET + MESSAGE_TEXT = "Raising a not found", + MYSQL_ERRNO = 1012; +end $$ + +call test_resignal() $$ +drop procedure test_resignal $$ + +create procedure test_resignal() +begin + DECLARE not_found CONDITION FOR SQLSTATE "02ABC"; + DECLARE CONTINUE HANDLER for 1012 + begin + select "before RESIGNAL"; + RESIGNAL SQLSTATE "02222" SET + MESSAGE_TEXT = "RESIGNAL to not found", + MYSQL_ERRNO = 5555 ; + select "after RESIGNAL"; + end; + + SIGNAL not_found SET + MESSAGE_TEXT = "Raising a not found", + MYSQL_ERRNO = 1012; +end $$ + +--error 5555 +call test_resignal() $$ +show warnings $$ +drop procedure test_resignal $$ + +create procedure test_resignal() +begin + DECLARE not_found CONDITION FOR SQLSTATE "02ABC"; + DECLARE CONTINUE HANDLER for 1012 + begin + select "before RESIGNAL"; + RESIGNAL SQLSTATE "33333" SET + MESSAGE_TEXT = "RESIGNAL to error", + MYSQL_ERRNO = 5555 ; + select "after RESIGNAL"; + end; + + SIGNAL not_found SET + MESSAGE_TEXT = "Raising a not found", + MYSQL_ERRNO = 1012; +end $$ + +--error 5555 +call test_resignal() $$ +show warnings $$ +drop procedure test_resignal $$ + +# 3 tests: +# {Signaled error} +# --> RESIGNAL SQLSTATE {warning, not found, error} SET ... + +create procedure test_resignal() +begin + DECLARE error CONDITION FOR SQLSTATE "AAAAA"; + DECLARE CONTINUE HANDLER for 1012 + begin + select "before RESIGNAL"; + RESIGNAL SQLSTATE "01222" SET + MESSAGE_TEXT = "RESIGNAL to warning", + MYSQL_ERRNO = 5555 ; + select "after RESIGNAL"; + end; + + SIGNAL error SET + MESSAGE_TEXT = "Raising an error", + MYSQL_ERRNO = 1012; +end $$ + +call test_resignal() $$ +drop procedure test_resignal $$ + +create procedure test_resignal() +begin + DECLARE error CONDITION FOR SQLSTATE "AAAAA"; + DECLARE CONTINUE HANDLER for 1012 + begin + select "before RESIGNAL"; + RESIGNAL SQLSTATE "02222" SET + MESSAGE_TEXT = "RESIGNAL to not found", + MYSQL_ERRNO = 5555 ; + select "after RESIGNAL"; + end; + + SIGNAL error SET + MESSAGE_TEXT = "Raising an error", + MYSQL_ERRNO = 1012; +end $$ + +--error 5555 +call test_resignal() $$ +show warnings $$ +drop procedure test_resignal $$ + +create procedure test_resignal() +begin + DECLARE error CONDITION FOR SQLSTATE "AAAAA"; + DECLARE CONTINUE HANDLER for 1012 + begin + select "before RESIGNAL"; + RESIGNAL SQLSTATE "33333" SET + MESSAGE_TEXT = "RESIGNAL to error", + MYSQL_ERRNO = 5555 ; + select "after RESIGNAL"; + end; + + SIGNAL error SET + MESSAGE_TEXT = "Raising an error", + MYSQL_ERRNO = 1012; +end $$ + +--error 5555 +call test_resignal() $$ +show warnings $$ +drop procedure test_resignal $$ + +# 3 tests: +# {warning} +# --> RESIGNAL SQLSTATE {warning, not found, error} SET ... + +create procedure test_resignal() +begin + DECLARE CONTINUE HANDLER for sqlwarning + begin + select "before RESIGNAL"; + RESIGNAL SQLSTATE "01111" SET + MESSAGE_TEXT = "RESIGNAL to a warning", + MYSQL_ERRNO = 5555 ; + select "after RESIGNAL"; + end; + + insert into t_warn set a= 9999999999999999; +end $$ + +call test_resignal() $$ +drop procedure test_resignal $$ + +create procedure test_resignal() +begin + DECLARE CONTINUE HANDLER for sqlwarning + begin + select "before RESIGNAL"; + RESIGNAL SQLSTATE "02444" SET + MESSAGE_TEXT = "RESIGNAL to a not found", + MYSQL_ERRNO = 5555 ; + select "after RESIGNAL"; + end; + + insert into t_warn set a= 9999999999999999; +end $$ + +--error 5555 +call test_resignal() $$ +show warnings $$ +drop procedure test_resignal $$ + +create procedure test_resignal() +begin + DECLARE CONTINUE HANDLER for sqlwarning + begin + select "before RESIGNAL"; + RESIGNAL SQLSTATE "44444" SET + MESSAGE_TEXT = "RESIGNAL to an error", + MYSQL_ERRNO = 5555 ; + select "after RESIGNAL"; + end; + + insert into t_warn set a= 9999999999999999; +end $$ + +--error 5555 +call test_resignal() $$ +show warnings $$ +drop procedure test_resignal $$ + +# 3 tests: +# {not found} +# --> RESIGNAL SQLSTATE {warning, not found, error} SET ... + +create procedure test_resignal() +begin + DECLARE x integer; + DECLARE c cursor for select * from t_cursor; + DECLARE CONTINUE HANDLER for not found + begin + select "before RESIGNAL"; + RESIGNAL SQLSTATE "01111" SET + MESSAGE_TEXT = "RESIGNAL to a warning", + MYSQL_ERRNO = 5555 ; + select "after RESIGNAL"; + end; + + open c; + fetch c into x; + close c; +end $$ + +call test_resignal() $$ +drop procedure test_resignal $$ + +create procedure test_resignal() +begin + DECLARE x integer; + DECLARE c cursor for select * from t_cursor; + DECLARE CONTINUE HANDLER for not found + begin + select "before RESIGNAL"; + RESIGNAL SQLSTATE "02444" SET + MESSAGE_TEXT = "RESIGNAL to a not found", + MYSQL_ERRNO = 5555 ; + select "after RESIGNAL"; + end; + + open c; + fetch c into x; + close c; +end $$ + +--error 5555 +call test_resignal() $$ +show warnings $$ +drop procedure test_resignal $$ + +create procedure test_resignal() +begin + DECLARE x integer; + DECLARE c cursor for select * from t_cursor; + DECLARE CONTINUE HANDLER for not found + begin + select "before RESIGNAL"; + RESIGNAL SQLSTATE "44444" SET + MESSAGE_TEXT = "RESIGNAL to an error", + MYSQL_ERRNO = 5555 ; + select "after RESIGNAL"; + end; + + open c; + fetch c into x; + close c; +end $$ + +--error 5555 +call test_resignal() $$ +show warnings $$ +drop procedure test_resignal $$ + +# 3 tests: +# {error} +# --> RESIGNAL SQLSTATE {warning, not found, error} SET ... + +create procedure test_resignal() +begin + DECLARE CONTINUE HANDLER for sqlexception + begin + select "before RESIGNAL"; + RESIGNAL SQLSTATE "01111" SET + MESSAGE_TEXT = "RESIGNAL to a warning", + MYSQL_ERRNO = 5555 ; + select "after RESIGNAL"; + end; + + drop table no_such_table; +end $$ + +call test_resignal() $$ +drop procedure test_resignal $$ + +create procedure test_resignal() +begin + DECLARE CONTINUE HANDLER for sqlexception + begin + select "before RESIGNAL"; + RESIGNAL SQLSTATE "02444" SET + MESSAGE_TEXT = "RESIGNAL to a not found", + MYSQL_ERRNO = 5555 ; + select "after RESIGNAL"; + end; + + drop table no_such_table; +end $$ + +--error 5555 +call test_resignal() $$ +show warnings $$ +drop procedure test_resignal $$ + +create procedure test_resignal() +begin + DECLARE CONTINUE HANDLER for sqlexception + begin + select "before RESIGNAL"; + RESIGNAL SQLSTATE "44444" SET + MESSAGE_TEXT = "RESIGNAL to an error", + MYSQL_ERRNO = 5555 ; + select "after RESIGNAL"; + end; + + drop table no_such_table; +end $$ + +--error 5555 +call test_resignal() $$ +show warnings $$ +drop procedure test_resignal $$ + +--echo # +--echo # More complex cases +--echo # + +--disable_warnings +drop procedure if exists peter_p1 $$ +drop procedure if exists peter_p2 $$ +--enable_warnings + +CREATE PROCEDURE peter_p1 () +BEGIN + DECLARE x CONDITION FOR 1231; + DECLARE EXIT HANDLER FOR x + BEGIN + SELECT '2'; + RESIGNAL SET MYSQL_ERRNO = 9999; + END; + + BEGIN + DECLARE EXIT HANDLER FOR x + BEGIN + SELECT '1'; + RESIGNAL SET SCHEMA_NAME = 'test'; + END; + SET @@sql_mode=NULL; + END; +END +$$ + +CREATE PROCEDURE peter_p2 () +BEGIN + DECLARE x CONDITION for 9999; + DECLARE EXIT HANDLER FOR x + BEGIN + SELECT '3'; + RESIGNAL SET MESSAGE_TEXT = 'Hi, I am a useless error message'; + END; + CALL peter_p1(); +END +$$ + +# +# Here, RESIGNAL only modifies the condition caught, +# so there is only 1 condition at the end +# The final SQLSTATE is 42000 (it comes from the error 1231), +# since the condition attributes are preserved. +# +--error 9999 +CALL peter_p2() $$ +show warnings $$ + +drop procedure peter_p1 $$ +drop procedure peter_p2 $$ + +CREATE PROCEDURE peter_p1 () +BEGIN + DECLARE x CONDITION FOR SQLSTATE '42000'; + DECLARE EXIT HANDLER FOR x + BEGIN + SELECT '2'; + RESIGNAL x SET MYSQL_ERRNO = 9999; + END; + + BEGIN + DECLARE EXIT HANDLER FOR x + BEGIN + SELECT '1'; + RESIGNAL x SET + SCHEMA_NAME = 'test', + MYSQL_ERRNO= 1231; + END; + /* Raises ER_WRONG_VALUE_FOR_VAR : 1231, SQLSTATE 42000 */ + SET @@sql_mode=NULL; + END; +END +$$ + +CREATE PROCEDURE peter_p2 () +BEGIN + DECLARE x CONDITION for SQLSTATE '42000'; + DECLARE EXIT HANDLER FOR x + BEGIN + SELECT '3'; + RESIGNAL x SET + MESSAGE_TEXT = 'Hi, I am a useless error message', + MYSQL_ERRNO = 9999; + END; + CALL peter_p1(); +END +$$ + +# +# Here, "RESIGNAL <condition>" create a new condition in the diagnostics +# area, so that there are 4 conditions at the end. +# +--error 9999 +CALL peter_p2() $$ +show warnings $$ + +drop procedure peter_p1 $$ +drop procedure peter_p2 $$ + +# +# Test the value of MESSAGE_TEXT in RESIGNAL when no SET MESSAGE_TEXT clause +# is provided (the expected result is the text from the SIGNALed condition) +# + +drop procedure if exists peter_p3 $$ + +create procedure peter_p3() +begin + declare continue handler for sqlexception + resignal sqlstate '99002' set mysql_errno = 2; + + signal sqlstate '99001' set mysql_errno = 1, message_text = "Original"; +end $$ + +--error 2 +call peter_p3() $$ + +# Expecting 2 conditions, both with the text "Original" +show warnings $$ + +drop procedure peter_p3 $$ + +delimiter ;$$ + +drop table t_warn; +drop table t_cursor; + +--echo # +--echo # Miscelaneous test cases +--echo # + +delimiter $$; + +create procedure test_signal() +begin + DECLARE foo CONDITION FOR SQLSTATE '12345'; + SIGNAL foo SET MYSQL_ERRNO = 0x12; /* 18 */ +end $$ + +-- error 18 +call test_signal $$ +drop procedure test_signal $$ + +create procedure test_signal() +begin + DECLARE foo CONDITION FOR SQLSTATE '12345'; + SIGNAL foo SET MYSQL_ERRNO = 0b00010010; /* 18 */ +end $$ + +-- error 18 +call test_signal $$ +drop procedure test_signal $$ + +create procedure test_signal() +begin + DECLARE foo CONDITION FOR SQLSTATE '12345'; + SIGNAL foo SET MYSQL_ERRNO = '65'; /* 65 */ +end $$ + +-- error 65 +call test_signal $$ +drop procedure test_signal $$ + +create procedure test_signal() +begin + DECLARE foo CONDITION FOR SQLSTATE '12345'; + SIGNAL foo SET MYSQL_ERRNO = 'A'; /* illegal */ +end $$ + +-- error ER_WRONG_VALUE_FOR_VAR +call test_signal $$ +drop procedure test_signal $$ + +create procedure test_signal() +begin + DECLARE foo CONDITION FOR SQLSTATE '12345'; + SIGNAL foo SET MYSQL_ERRNO = "65"; /* 65 */ +end $$ + +-- error 65 +call test_signal $$ +drop procedure test_signal $$ + +create procedure test_signal() +begin + DECLARE foo CONDITION FOR SQLSTATE '12345'; + SIGNAL foo SET MYSQL_ERRNO = "A"; /* illegal */ +end $$ + +-- error ER_WRONG_VALUE_FOR_VAR +call test_signal $$ +drop procedure test_signal $$ + +create procedure test_signal() +begin + DECLARE foo CONDITION FOR SQLSTATE '12345'; + SIGNAL foo SET MYSQL_ERRNO = `65`; /* illegal */ +end $$ + +-- error ER_BAD_FIELD_ERROR +call test_signal $$ +drop procedure test_signal $$ + +create procedure test_signal() +begin + DECLARE foo CONDITION FOR SQLSTATE '12345'; + SIGNAL foo SET MYSQL_ERRNO = `A`; /* illegal */ +end $$ + +-- error ER_BAD_FIELD_ERROR +call test_signal $$ +drop procedure test_signal $$ + +create procedure test_signal() +begin + DECLARE foo CONDITION FOR SQLSTATE '12345'; + SIGNAL foo SET MYSQL_ERRNO = 3.141592; /* 3 */ +end $$ + +-- error 3 +call test_signal $$ +drop procedure test_signal $$ + +create procedure test_signal() +begin + DECLARE foo CONDITION FOR SQLSTATE '12345'; + SIGNAL foo SET MYSQL_ERRNO = 1000, + MESSAGE_TEXT= 0x41; /* A */ +end $$ + +-- error 1000 +call test_signal $$ +drop procedure test_signal $$ + +create procedure test_signal() +begin + DECLARE foo CONDITION FOR SQLSTATE '12345'; + SIGNAL foo SET MYSQL_ERRNO = 1000, + MESSAGE_TEXT= 0b01000001; /* A */ +end $$ + +-- error 1000 +call test_signal $$ +drop procedure test_signal $$ + +create procedure test_signal() +begin + DECLARE foo CONDITION FOR SQLSTATE '12345'; + SIGNAL foo SET MYSQL_ERRNO = 1000, + MESSAGE_TEXT = "Hello"; +end $$ + +-- error 1000 +call test_signal $$ +drop procedure test_signal $$ + +create procedure test_signal() +begin + DECLARE foo CONDITION FOR SQLSTATE '12345'; + SIGNAL foo SET MYSQL_ERRNO = 1000, + MESSAGE_TEXT = 'Hello'; +end $$ + +-- error 1000 +call test_signal $$ +drop procedure test_signal $$ + +create procedure test_signal() +begin + DECLARE foo CONDITION FOR SQLSTATE '12345'; + SIGNAL foo SET MYSQL_ERRNO = 1000, + MESSAGE_TEXT = `Hello`; +end $$ + +-- error ER_BAD_FIELD_ERROR +call test_signal $$ +drop procedure test_signal $$ + +create procedure test_signal() +begin + DECLARE foo CONDITION FOR SQLSTATE '12345'; + SIGNAL foo SET MYSQL_ERRNO = 1000, + MESSAGE_TEXT = 65.4321; +end $$ + +-- error 1000 +call test_signal $$ +drop procedure test_signal $$ + +-- error ER_PARSE_ERROR +create procedure test_signal() +begin + DECLARE céèçà foo CONDITION FOR SQLSTATE '12345'; + SIGNAL céèçà SET MYSQL_ERRNO = 1000; +end $$ + +-- error ER_PARSE_ERROR +create procedure test_signal() +begin + DECLARE "céèçà" CONDITION FOR SQLSTATE '12345'; + SIGNAL "céèçà" SET MYSQL_ERRNO = 1000; +end $$ + +-- error ER_PARSE_ERROR +create procedure test_signal() +begin + DECLARE 'céèçà' CONDITION FOR SQLSTATE '12345'; + SIGNAL 'céèçà' SET MYSQL_ERRNO = 1000; +end $$ + +create procedure test_signal() +begin + DECLARE `céèçà` CONDITION FOR SQLSTATE '12345'; + SIGNAL `céèçà` SET MYSQL_ERRNO = 1000; +end $$ + +-- error 1000 +call test_signal $$ +drop procedure test_signal $$ + +create procedure test_signal() +begin + SIGNAL SQLSTATE '77777' SET MYSQL_ERRNO = 1000, MESSAGE_TEXT='ÁÂÃÅÄ'; +end $$ + +# Commented until WL#751 is implemented in this version +# -- error 1000 +# call test_signal $$ +drop procedure test_signal $$ + +delimiter ; $$ + diff --git a/mysql-test/t/signal_code.test b/mysql-test/t/signal_code.test new file mode 100644 index 00000000000..d2f65647c81 --- /dev/null +++ b/mysql-test/t/signal_code.test @@ -0,0 +1,57 @@ +# Copyright (C) 2008 Sun Microsystems, Inc +# +# This program is free software; you can redistribute it and/or modify +# it under the terms of the GNU General Public License as published by +# the Free Software Foundation; version 2 of the License. +# +# This program is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +# GNU General Public License for more details. +# +# You should have received a copy of the GNU General Public License +# along with this program; if not, write to the Free Software +# Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA + +# Tests for SIGNAL and RESIGNAL + +-- source include/have_debug.inc + +use test; + +--disable_warnings +drop procedure if exists signal_proc; +drop function if exists signal_func; +--enable_warnings + +delimiter $$; + +create procedure signal_proc() +begin + DECLARE foo CONDITION FOR SQLSTATE '12345'; + + SIGNAL foo; + SIGNAL foo SET MESSAGE_TEXT = "This is an error message"; + RESIGNAL foo; + RESIGNAL foo SET MESSAGE_TEXT = "This is an error message"; +end $$ + +create function signal_func() returns int +begin + DECLARE foo CONDITION FOR SQLSTATE '12345'; + + SIGNAL foo; + SIGNAL foo SET MESSAGE_TEXT = "This is an error message"; + RESIGNAL foo; + RESIGNAL foo SET MESSAGE_TEXT = "This is an error message"; + return 0; +end $$ + +delimiter ;$$ + +show procedure code signal_proc; +drop procedure signal_proc; + +show function code signal_func; +drop function signal_func; + diff --git a/mysql-test/t/signal_demo1.test b/mysql-test/t/signal_demo1.test new file mode 100644 index 00000000000..5de847ba0ba --- /dev/null +++ b/mysql-test/t/signal_demo1.test @@ -0,0 +1,345 @@ +# Copyright (C) 2008 Sun Microsystems, Inc +# +# This program is free software; you can redistribute it and/or modify +# it under the terms of the GNU General Public License as published by +# the Free Software Foundation; version 2 of the License. +# +# This program is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +# GNU General Public License for more details. +# +# You should have received a copy of the GNU General Public License +# along with this program; if not, write to the Free Software +# Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA + +# +# Demonstrate how SIGNAL can be used to enforce integrity constraints. +# + +# Naming: +# - PO: Purchase Order +# - AB: Address Book +# - IN: Inventory + +# Simplified schema: +# +# Relation 1: +# PO_ORDER (PK: po_id) 1:1 <---> 0:N (FK: po_id) PO_ORDER_LINE +# +# Relation 2: +# IN_INVENTORY (PK: item_id) 1:1 <---> 0:N (FK: item_id) PO_ORDER_LINE +# +# Relation 3: +# +--> 0:1 (PK: person_id) AB_PHYSICAL_PERSON +# PO_ORDER (FK: cust_id) 1:1 <--| +# +--> 0:1 (PK: company_id) AB_MORAL_PERSON +# This is an 'arc' relationship :) +# + + +--disable_warnings +drop database if exists demo; +--enable_warnings + +create database demo; + +use demo; + +create table ab_physical_person ( + person_id integer, + first_name VARCHAR(50), + middle_initial CHAR, + last_name VARCHAR(50), + primary key (person_id)); + +create table ab_moral_person ( + company_id integer, + name VARCHAR(100), + primary key (company_id)); + +create table in_inventory ( + item_id integer, + descr VARCHAR(50), + stock integer, + primary key (item_id)); + +create table po_order ( + po_id integer auto_increment, + cust_type char, /* arc relationship, see cust_id */ + cust_id integer, /* FK to ab_physical_person *OR* ab_moral_person */ + primary key (po_id)); + +create table po_order_line ( + po_id integer, /* FK to po_order.po_id */ + line_no integer, + item_id integer, /* FK to in_inventory.item_id */ + qty integer); + +delimiter $$; + +--echo # +--echo # Schema integrity enforcement +--echo # + +create procedure check_pk_person(in person_type char, in id integer) +begin + declare x integer; + declare msg varchar(128); + + /* + Test integrity constraints for an 'arc' relationship. + Based on 'person_type', 'id' points to either a + physical person, or a moral person. + */ + case person_type + when 'P' then + begin + select count(person_id) from ab_physical_person + where ab_physical_person.person_id = id + into x; + + if (x != 1) + then + set msg= concat('No such physical person, PK:', id); + SIGNAL SQLSTATE '45000' SET + MESSAGE_TEXT = msg, + MYSQL_ERRNO = 10000; + end if; + end; + + when 'M' then + begin + select count(company_id) from ab_moral_person + where ab_moral_person.company_id = id + into x; + + if (x != 1) + then + set msg= concat('No such moral person, PK:', id); + SIGNAL SQLSTATE '45000' SET + MESSAGE_TEXT = msg, + MYSQL_ERRNO = 10000; + end if; + end; + + else + begin + set msg= concat('No such person type:', person_type); + SIGNAL SQLSTATE '45000' SET + MESSAGE_TEXT = msg, + MYSQL_ERRNO = 20000; + end; + end case; +end +$$ + +create procedure check_pk_inventory(in id integer) +begin + declare x integer; + declare msg varchar(128); + + select count(item_id) from in_inventory + where in_inventory.item_id = id + into x; + + if (x != 1) + then + set msg= concat('Failed integrity constraint, table in_inventory, PK:', + id); + SIGNAL SQLSTATE '45000' SET + MESSAGE_TEXT = msg, + MYSQL_ERRNO = 10000; + end if; +end +$$ + +create procedure check_pk_order(in id integer) +begin + declare x integer; + declare msg varchar(128); + + select count(po_id) from po_order + where po_order.po_id = id + into x; + + if (x != 1) + then + set msg= concat('Failed integrity constraint, table po_order, PK:', id); + SIGNAL SQLSTATE '45000' SET + MESSAGE_TEXT = msg, + MYSQL_ERRNO = 10000; + end if; +end +$$ + +create trigger po_order_bi before insert on po_order +for each row +begin + call check_pk_person(NEW.cust_type, NEW.cust_id); +end +$$ + +create trigger po_order_bu before update on po_order +for each row +begin + call check_pk_person(NEW.cust_type, NEW.cust_id); +end +$$ + +create trigger po_order_line_bi before insert on po_order_line +for each row +begin + call check_pk_order(NEW.po_id); + call check_pk_inventory(NEW.item_id); +end +$$ + +create trigger po_order_line_bu before update on po_order_line +for each row +begin + call check_pk_order(NEW.po_id); + call check_pk_inventory(NEW.item_id); +end +$$ + +--echo # +--echo # Application helpers +--echo # + +create procedure po_create_order( + in p_cust_type char, + in p_cust_id integer, + out id integer) +begin + insert into po_order set cust_type = p_cust_type, cust_id = p_cust_id; + set id = last_insert_id(); +end +$$ + +create procedure po_add_order_line( + in po integer, + in line integer, + in item integer, + in q integer) +begin + insert into po_order_line set + po_id = po, line_no = line, item_id = item, qty = q; +end +$$ + +delimiter ;$$ + +--echo # +--echo # Create sample data +--echo # + +insert into ab_physical_person values + ( 1, "John", "A", "Doe"), + ( 2, "Marry", "B", "Smith") +; + +insert into ab_moral_person values + ( 3, "ACME real estate, INC"), + ( 4, "Local school") +; + +insert into in_inventory values + ( 100, "Table, dinner", 5), + ( 101, "Chair", 20), + ( 200, "Table, coffee", 3), + ( 300, "School table", 25), + ( 301, "School chairs", 50) +; + +select * from ab_physical_person order by person_id; +select * from ab_moral_person order by company_id; +select * from in_inventory order by item_id; + +--echo # +--echo # Entering an order +--echo # + +set @my_po = 0; + +/* John Doe wants 1 table and 4 chairs */ +call po_create_order("P", 1, @my_po); + +call po_add_order_line (@my_po, 1, 100, 1); +call po_add_order_line (@my_po, 2, 101, 4); + +/* Marry Smith wants a coffee table */ +call po_create_order("P", 2, @my_po); + +call po_add_order_line (@my_po, 1, 200, 1); + +--echo # +--echo # Entering bad data in an order +--echo # + +# There is no item 999 in in_inventory +--error 10000 +call po_add_order_line (@my_po, 1, 999, 1); + +--echo # +--echo # Entering bad data in an unknown order +--echo # + +# There is no order 99 in po_order +--error 10000 +call po_add_order_line (99, 1, 100, 1); + +--echo # +--echo # Entering an order for an unknown company +--echo # + +# There is no moral person of id 7 +--error 10000 +call po_create_order("M", 7, @my_po); + +--echo # +--echo # Entering an order for an unknown person type +--echo # + +# There is no person of type X +--error 20000 +call po_create_order("X", 1, @my_po); + +/* The local school wants 10 class tables and 20 chairs */ +call po_create_order("M", 4, @my_po); + +call po_add_order_line (@my_po, 1, 300, 10); +call po_add_order_line (@my_po, 2, 301, 20); + +# Raw data +select * from po_order; +select * from po_order_line; + +# Creative reporting ... + +select po_id as "PO#", + ( case cust_type + when "P" then concat (pp.first_name, + " ", + pp.middle_initial, + " ", + pp.last_name) + when "M" then mp.name + end ) as "Sold to" + from po_order po + left join ab_physical_person pp on po.cust_id = pp.person_id + left join ab_moral_person mp on po.cust_id = company_id +; + +select po_id as "PO#", + ol.line_no as "Line", + ol.item_id as "Item", + inv.descr as "Description", + ol.qty as "Quantity" + from po_order_line ol, in_inventory inv + where inv.item_id = ol.item_id + order by ol.item_id, ol.line_no; + +drop database demo; + + diff --git a/mysql-test/t/signal_demo2.test b/mysql-test/t/signal_demo2.test new file mode 100644 index 00000000000..fc909cb926c --- /dev/null +++ b/mysql-test/t/signal_demo2.test @@ -0,0 +1,207 @@ +# Copyright (C) 2008 Sun Microsystems, Inc +# +# This program is free software; you can redistribute it and/or modify +# it under the terms of the GNU General Public License as published by +# the Free Software Foundation; version 2 of the License. +# +# This program is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +# GNU General Public License for more details. +# +# You should have received a copy of the GNU General Public License +# along with this program; if not, write to the Free Software +# Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA + +# +# Demonstrate how RESIGNAL can be used to 'catch' and 're-throw' an error +# + +--disable_warnings +drop database if exists demo; +--enable_warnings + +create database demo; + +use demo; + +delimiter $$; + +create procedure proc_top_a(p1 integer) +begin + ## DECLARE CONTINUE HANDLER for SQLEXCEPTION, NOT FOUND + begin + end; + + select "Starting ..."; + call proc_middle_a(p1); + select "The end"; +end +$$ + +create procedure proc_middle_a(p1 integer) +begin + DECLARE l integer; + # without RESIGNAL: + # Should be: DECLARE EXIT HANDLER for SQLEXCEPTION, NOT FOUND + DECLARE EXIT HANDLER for 1 /* not sure how to handle exceptions */ + begin + select "Oops ... now what ?"; + end; + + select "In prod_middle()"; + + create temporary table t1(a integer, b integer); + select GET_LOCK("user_mutex", 10) into l; + + insert into t1 set a = p1, b = p1; + + call proc_bottom_a(p1); + + select RELEASE_LOCK("user_mutex") into l; + drop temporary table t1; +end +$$ + +create procedure proc_bottom_a(p1 integer) +begin + select "In proc_bottom()"; + + if (p1 = 1) then + begin + select "Doing something that works ..."; + select * from t1; + end; + end if; + + if (p1 = 2) then + begin + select "Doing something that fail (simulate an error) ..."; + drop table no_such_table; + end; + end if; + + if (p1 = 3) then + begin + select "Doing something that *SHOULD* works ..."; + select * from t1; + end; + end if; + +end +$$ + +delimiter ;$$ + +# +# Code without RESIGNAL: +# errors are apparent to the caller, +# but there is no cleanup code, +# so that the environment (get_lock(), temporary table) is polluted ... +# +call proc_top_a(1); + +# Expected +--error ER_BAD_TABLE_ERROR +call proc_top_a(2); + +# Dirty state +--error ER_TABLE_EXISTS_ERROR +call proc_top_a(3); + +# Dirty state +--error ER_TABLE_EXISTS_ERROR +call proc_top_a(1); + +drop temporary table if exists t1; + +delimiter $$; + +create procedure proc_top_b(p1 integer) +begin + select "Starting ..."; + call proc_middle_b(p1); + select "The end"; +end +$$ + +create procedure proc_middle_b(p1 integer) +begin + DECLARE l integer; + DECLARE EXIT HANDLER for SQLEXCEPTION, NOT FOUND + begin + begin + DECLARE CONTINUE HANDLER for SQLEXCEPTION, NOT FOUND + begin + /* Ignore errors from the cleanup code */ + end; + + select "Doing cleanup !"; + select RELEASE_LOCK("user_mutex") into l; + drop temporary table t1; + end; + + RESIGNAL; + end; + + select "In prod_middle()"; + + create temporary table t1(a integer, b integer); + select GET_LOCK("user_mutex", 10) into l; + + insert into t1 set a = p1, b = p1; + + call proc_bottom_b(p1); + + select RELEASE_LOCK("user_mutex") into l; + drop temporary table t1; +end +$$ + +create procedure proc_bottom_b(p1 integer) +begin + select "In proc_bottom()"; + + if (p1 = 1) then + begin + select "Doing something that works ..."; + select * from t1; + end; + end if; + + if (p1 = 2) then + begin + select "Doing something that fail (simulate an error) ..."; + drop table no_such_table; + end; + end if; + + if (p1 = 3) then + begin + select "Doing something that *SHOULD* works ..."; + select * from t1; + end; + end if; + +end +$$ + +delimiter ;$$ + +# +# Code with RESIGNAL: +# errors are apparent to the caller, +# the but cleanup code did get a chance to act ... +# + +call proc_top_b(1); + +--error ER_BAD_TABLE_ERROR +call proc_top_b(2); + +call proc_top_b(3); + +call proc_top_b(1); + +drop database demo; + diff --git a/mysql-test/t/signal_demo3.test b/mysql-test/t/signal_demo3.test new file mode 100644 index 00000000000..347f1b75a79 --- /dev/null +++ b/mysql-test/t/signal_demo3.test @@ -0,0 +1,159 @@ +# Copyright (C) 2008 Sun Microsystems, Inc +# +# This program is free software; you can redistribute it and/or modify +# it under the terms of the GNU General Public License as published by +# the Free Software Foundation; version 2 of the License. +# +# This program is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +# GNU General Public License for more details. +# +# You should have received a copy of the GNU General Public License +# along with this program; if not, write to the Free Software +# Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA + +# +# Demonstrate how RESIGNAL can be used to print a stack trace +# + +# Save defaults + +SET @start_global_value = @@global.max_error_count; +SELECT @start_global_value; +SET @start_session_value = @@session.max_error_count; +SELECT @start_session_value; + +--disable_warnings +drop database if exists demo; +--enable_warnings + +create database demo; + +use demo; + +delimiter $$; + +create procedure proc_1() +begin + declare exit handler for sqlexception + resignal sqlstate '45000' set message_text='Oops in proc_1'; + + call proc_2(); +end +$$ + +create procedure proc_2() +begin + declare exit handler for sqlexception + resignal sqlstate '45000' set message_text='Oops in proc_2'; + + call proc_3(); +end +$$ + +create procedure proc_3() +begin + declare exit handler for sqlexception + resignal sqlstate '45000' set message_text='Oops in proc_3'; + + call proc_4(); +end +$$ + +create procedure proc_4() +begin + declare exit handler for sqlexception + resignal sqlstate '45000' set message_text='Oops in proc_4'; + + call proc_5(); +end +$$ + +create procedure proc_5() +begin + declare exit handler for sqlexception + resignal sqlstate '45000' set message_text='Oops in proc_5'; + + call proc_6(); +end +$$ + +create procedure proc_6() +begin + declare exit handler for sqlexception + resignal sqlstate '45000' set message_text='Oops in proc_6'; + + call proc_7(); +end +$$ + +create procedure proc_7() +begin + declare exit handler for sqlexception + resignal sqlstate '45000' set message_text='Oops in proc_7'; + + call proc_8(); +end +$$ + +create procedure proc_8() +begin + declare exit handler for sqlexception + resignal sqlstate '45000' set message_text='Oops in proc_8'; + + call proc_9(); +end +$$ + +create procedure proc_9() +begin + declare exit handler for sqlexception + resignal sqlstate '45000' set message_text='Oops in proc_9'; + + ## Do something that fails, to see how errors are reported + drop table oops_it_is_not_here; +end +$$ + +delimiter ;$$ + +-- error ER_SIGNAL_EXCEPTION +call proc_1(); + +# This is the interesting part: +# the complete call stack from the origin of failure (proc_9) +# to the top level caller (proc_1) is available ... + +show warnings; + +SET @@session.max_error_count = 5; +SELECT @@session.max_error_count; + +-- error ER_SIGNAL_EXCEPTION +call proc_1(); +show warnings; + +SET @@session.max_error_count = 7; +SELECT @@session.max_error_count; + +-- error ER_SIGNAL_EXCEPTION +call proc_1(); +show warnings; + +SET @@session.max_error_count = 9; +SELECT @@session.max_error_count; + +-- error ER_SIGNAL_EXCEPTION +call proc_1(); +show warnings; + +drop database demo; + +# Restore defaults + +SET @@global.max_error_count = @start_global_value; +SELECT @@global.max_error_count; +SET @@session.max_error_count = @start_session_value; +SELECT @@session.max_error_count; + diff --git a/mysql-test/t/signal_sqlmode.test b/mysql-test/t/signal_sqlmode.test new file mode 100644 index 00000000000..860c145a361 --- /dev/null +++ b/mysql-test/t/signal_sqlmode.test @@ -0,0 +1,123 @@ +# Copyright (C) 2008 Sun Microsystems, Inc +# +# This program is free software; you can redistribute it and/or modify +# it under the terms of the GNU General Public License as published by +# the Free Software Foundation; version 2 of the License. +# +# This program is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +# GNU General Public License for more details. +# +# You should have received a copy of the GNU General Public License +# along with this program; if not, write to the Free Software +# Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA + +# Tests for SIGNAL, RESIGNAL and GET DIAGNOSTICS + +SET @save_sql_mode=@@sql_mode; + +SET sql_mode=''; + +--disable_warnings +drop procedure if exists p; +drop procedure if exists p2; +drop procedure if exists p3; +--enable_warnings + +delimiter $$; + +create procedure p() +begin + declare utf8_var VARCHAR(128) CHARACTER SET UTF8; + set utf8_var = concat(repeat('A', 128), 'X'); + select length(utf8_var), utf8_var; +end +$$ + +create procedure p2() +begin + declare msg VARCHAR(129) CHARACTER SET UTF8; + set msg = concat(repeat('A', 128), 'X'); + select length(msg), msg; + + signal sqlstate '55555' set message_text = msg; +end +$$ + +create procedure p3() +begin + declare name VARCHAR(65) CHARACTER SET UTF8; + set name = concat(repeat('A', 64), 'X'); + select length(name), name; + + signal sqlstate '55555' set + message_text = 'Message', + table_name = name; +end +$$ +delimiter ;$$ + +call p; + +--error ER_SIGNAL_EXCEPTION +call p2; + +--error ER_SIGNAL_EXCEPTION +call p3; + +drop procedure p; +drop procedure p2; +drop procedure p3; + +SET sql_mode='STRICT_ALL_TABLES'; + +delimiter $$; + +create procedure p() +begin + declare utf8_var VARCHAR(128) CHARACTER SET UTF8; + set utf8_var = concat(repeat('A', 128), 'X'); + select length(utf8_var), utf8_var; +end +$$ + +create procedure p2() +begin + declare msg VARCHAR(129) CHARACTER SET UTF8; + set msg = concat(repeat('A', 128), 'X'); + select length(msg), msg; + + signal sqlstate '55555' set message_text = msg; +end +$$ + +create procedure p3() +begin + declare name VARCHAR(65) CHARACTER SET UTF8; + set name = concat(repeat('A', 64), 'X'); + select length(name), name; + + signal sqlstate '55555' set + message_text = 'Message', + table_name = name; +end +$$ + +delimiter ;$$ + +--error ER_DATA_TOO_LONG +call p; + +--error ER_COND_ITEM_TOO_LONG +call p2; + +--error ER_COND_ITEM_TOO_LONG +call p3; + +drop procedure p; +drop procedure p2; +drop procedure p3; + +SET @@sql_mode=@save_sql_mode; + |