mariadb/mysql-test/t/errors.test
Konstantin Osipov 9a1043417d Backport the test case for Bug#31881 "A statement is not aborted immediately if an error
inside a stored routine" from 6.0-codebase.
2009-11-21 02:06:30 +03:00

138 lines
3.2 KiB
Text

#
# Test some error conditions
#
--disable_warnings
drop table if exists t1;
--enable_warnings
--error 1146
insert into t1 values(1);
--error 1146
delete from t1;
--error 1146
update t1 set a=1;
create table t1 (a int);
--error 1054
select count(test.t1.b) from t1;
--error 1054
select count(not_existing_database.t1) from t1;
--error 1054
select count(not_existing_database.t1.a) from t1;
--error 1044,1146
select count(not_existing_database.t1.a) from not_existing_database.t1;
--error 1054
select 1 from t1 order by 2;
--error 1054
select 1 from t1 group by 2;
--error 1054
select 1 from t1 order by t1.b;
--error 1054
select count(*),b from t1;
drop table t1;
# End of 4.1 tests
#
# Bug #6080: Error message for a field with a display width that is too long
#
--error 1439
create table t1 (a int(256));
set sql_mode='traditional';
--error 1074
create table t1 (a varchar(66000));
set sql_mode=default;
#
# Bug #27513: mysql 5.0.x + NULL pointer DoS
#
CREATE TABLE t1 (a INT);
SELECT a FROM t1 WHERE a IN(1, (SELECT IF(1=0,1,2/0)));
INSERT INTO t1 VALUES(1);
SELECT a FROM t1 WHERE a IN(1, (SELECT IF(1=0,1,2/0)));
INSERT INTO t1 VALUES(2),(3);
SELECT a FROM t1 WHERE a IN(1, (SELECT IF(1=0,1,2/0)));
DROP TABLE t1;
#
# Bug #28677: SELECT on missing column gives extra error
#
CREATE TABLE t1( a INT );
--error ER_BAD_FIELD_ERROR
SELECT b FROM t1;
SHOW ERRORS;
--error ER_BAD_FIELD_ERROR
CREATE TABLE t2 SELECT b FROM t1;
SHOW ERRORS;
--error ER_BAD_FIELD_ERROR
INSERT INTO t1 SELECT b FROM t1;
DROP TABLE t1;
# End of 5.0 tests
flush status;
--disable_warnings
drop table if exists t1, t2;
--enable_warnings
create table t1 (a int unique);
create table t2 (a int);
drop function if exists f1;
drop function if exists f2;
delimiter |;
create function f1() returns int
begin
insert into t1 (a) values (1);
insert into t1 (a) values (1);
return 1;
end|
create function f2() returns int
begin
insert into t2 (a) values (1);
return 2;
end|
delimiter ;|
flush status;
--error 1062
select f1(), f2();
show status like 'Com_insert';
select * from t1;
select * from t2;
drop table t1;
drop table t2;
drop function f1;
drop function f2;
#
# testing the value encoding in the error messages of set_var
#
SET NAMES utf8;
--error ER_WRONG_VALUE_FOR_VAR
SET sql_quote_show_create= _binary x'5452C39C45';
--error ER_WRONG_VALUE_FOR_VAR
SET sql_quote_show_create= _utf8 x'5452C39C45';
--error ER_WRONG_VALUE_FOR_VAR
SET sql_quote_show_create=_latin1 x'5452DC45';
--error ER_WRONG_VALUE_FOR_VAR
SET sql_quote_show_create='TRÜE';
--error ER_WRONG_VALUE_FOR_VAR
SET sql_quote_show_create=TRÜE;
SET NAMES latin1;
--error ER_WRONG_VALUE_FOR_VAR
SET sql_quote_show_create= _binary x'5452C39C45';
--error ER_WRONG_VALUE_FOR_VAR
SET sql_quote_show_create= _utf8 x'5452C39C45';
--error ER_WRONG_VALUE_FOR_VAR
SET sql_quote_show_create=_latin1 x'5452DC45';
--error ER_WRONG_VALUE_FOR_VAR
SET sql_quote_show_create='TR.E';
--error ER_WRONG_VALUE_FOR_VAR
SET sql_quote_show_create=TR.E;
SET NAMES binary;
--error ER_WRONG_VALUE_FOR_VAR
SET sql_quote_show_create= _binary x'5452C39C45';
--error ER_WRONG_VALUE_FOR_VAR
SET sql_quote_show_create= _utf8 x'5452C39C45';
--error ER_WRONG_VALUE_FOR_VAR
SET sql_quote_show_create=_latin1 x'5452DC45';