mirror of
https://github.com/MariaDB/server.git
synced 2026-10-23 18:49:29 +03:00
they're very fragile by nature, but let's at least move them into one file with msan/embedded/ps/32-bit all disabled to have the memory usage more predictable. And remove these restrictions from other test files.
266 lines
6.7 KiB
Plaintext
266 lines
6.7 KiB
Plaintext
#
|
|
# Test some error conditions
|
|
#
|
|
--source include/have_sequence.inc
|
|
|
|
--error ER_NO_SUCH_TABLE
|
|
insert into t1 values(1);
|
|
--error ER_NO_SUCH_TABLE
|
|
delete from t1;
|
|
--error ER_NO_SUCH_TABLE
|
|
update t1 set a=1;
|
|
create table t1 (a int);
|
|
--error ER_BAD_FIELD_ERROR
|
|
select count(test.t1.b) from t1;
|
|
--error ER_BAD_FIELD_ERROR
|
|
select count(not_existing_database.t1) from t1;
|
|
--error ER_BAD_FIELD_ERROR
|
|
select count(not_existing_database.t1.a) from t1;
|
|
--error ER_DBACCESS_DENIED_ERROR,ER_NO_SUCH_TABLE
|
|
select count(not_existing_database.t1.a) from not_existing_database.t1;
|
|
--error ER_BAD_FIELD_ERROR
|
|
select 1 from t1 order by 2;
|
|
--error ER_BAD_FIELD_ERROR
|
|
select 1 from t1 group by 2;
|
|
--error ER_BAD_FIELD_ERROR
|
|
select 1 from t1 order by t1.b;
|
|
--error ER_BAD_FIELD_ERROR
|
|
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 ER_TOO_BIG_DISPLAYWIDTH
|
|
create table t1 (a int(256));
|
|
set sql_mode='traditional';
|
|
--error ER_TOO_BIG_FIELDLENGTH
|
|
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;
|
|
--disable_ps2_protocol
|
|
--error ER_DUP_ENTRY
|
|
select f1(), f2();
|
|
--enable_ps2_protocol
|
|
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
|
|
#
|
|
# should be TR\xC3\x9CE, TRÜE, TRÜE
|
|
#
|
|
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';
|
|
|
|
--echo #
|
|
--echo # Bug#52430 Incorrect key in the error message for duplicate key error involving BINARY type
|
|
--echo #
|
|
CREATE TABLE t1(c1 BINARY(10), c2 BINARY(10), c3 BINARY(10),
|
|
PRIMARY KEY(c1,c2,c3));
|
|
INSERT INTO t1 (c1,c2,c3) VALUES('abc','abc','abc');
|
|
--error ER_DUP_ENTRY
|
|
INSERT INTO t1 (c1,c2,c3) VALUES('abc','abc','abc');
|
|
DROP TABLE t1;
|
|
|
|
CREATE TABLE t1 (f1 VARBINARY(19) PRIMARY KEY);
|
|
INSERT INTO t1 VALUES ('abc\0\0');
|
|
--error ER_DUP_ENTRY
|
|
INSERT INTO t1 VALUES ('abc\0\0');
|
|
DROP TABLE t1;
|
|
|
|
--echo #
|
|
--echo # Bug#57882: Item_func_conv_charset::val_str(String*):
|
|
--echo # Assertion `fixed == 1' failed
|
|
--echo #
|
|
|
|
--error ER_DATA_OUT_OF_RANGE
|
|
SELECT (CONVERT('0' USING latin1) IN (CHAR(COT('v') USING utf8),''));
|
|
|
|
SET NAMES utf8 COLLATE utf8_latvian_ci ;
|
|
--error ER_DATA_OUT_OF_RANGE
|
|
SELECT UPDATEXML(-73 * -2465717823867977728,@@global.auto_increment_increment,null);
|
|
|
|
--echo #
|
|
--echo # End Bug#57882
|
|
--echo #
|
|
|
|
#
|
|
# Bug #13031606 VALUES() IN A SELECT STATEMENT CRASHES SERVER
|
|
#
|
|
CREATE TABLE t1 (a INT);
|
|
CREATE TABLE t2(a INT PRIMARY KEY, b INT);
|
|
--error ER_BAD_FIELD_ERROR
|
|
SELECT '' AS b FROM t1 GROUP BY VALUE(b);
|
|
--error ER_BAD_FIELD_ERROR
|
|
REPLACE t2(b) SELECT '' AS b FROM t1 GROUP BY VALUE(b);
|
|
--error ER_BAD_FIELD_ERROR
|
|
UPDATE t2 SET a=(SELECT '' AS b FROM t1 GROUP BY VALUE(b));
|
|
--error ER_BAD_FIELD_ERROR
|
|
INSERT INTO t2 VALUES (1,0) ON DUPLICATE KEY UPDATE
|
|
b=(SELECT '' AS b FROM t1 GROUP BY VALUE(b));
|
|
INSERT INTO t2(a,b) VALUES (1,0) ON DUPLICATE KEY UPDATE
|
|
b=(SELECT VALUE(a)+2 FROM t1);
|
|
DROP TABLE t1, t2;
|
|
|
|
--echo #
|
|
--echo # MDEV-492: incorrect error check before sending OK in mysql_update
|
|
--echo #
|
|
CREATE TABLE t1 (a CHAR(3), b BLOB);
|
|
--error ER_DYN_COL_DATA
|
|
UPDATE t1 SET a = 'new'
|
|
WHERE COLUMN_CREATE( 1, 'v', 1, 'w' ) IS NULL;
|
|
drop table t1;
|
|
|
|
--echo #
|
|
--echo # MDEV-20604: Duplicate key value is silently truncated to 64
|
|
--echo # characters in print_keydup_error
|
|
--echo #
|
|
|
|
create table t1 (a varchar(100), UNIQUE KEY akey (a));
|
|
|
|
insert into t1 values ("1234567890123456789012345678901234567890123456789012345678901234567890_end");
|
|
--echo # The value in the error message should show truncation with "..."
|
|
--error ER_DUP_ENTRY
|
|
insert into t1 values ("1234567890123456789012345678901234567890123456789012345678901234567890_end");
|
|
|
|
drop table t1;
|
|
|
|
|
|
--echo # End of 10.2 tests
|
|
|
|
--echo #
|
|
--echo # MDEV-14269 errors.test fails with valgrind (Conditional jump or move depends on uninitialised value)
|
|
--echo #
|
|
|
|
SET NAMES utf8;
|
|
--error ER_DATA_OUT_OF_RANGE
|
|
SELECT UPDATEXML(-73 * -2465717823867977728,@@global.auto_increment_increment,null);
|
|
--error ER_DATA_OUT_OF_RANGE
|
|
SELECT UPDATEXML(-73 * -2465717823867977728,@@global.long_query_time,null);
|
|
|
|
-- echo # End of 10.3 tests
|
|
|
|
--echo #
|
|
--echo # MDEV-23518: Syntax error in ond SP results in misleading
|
|
--echo # message on SHOW CREATE PROCEDURE
|
|
--echo #
|
|
|
|
DELIMITER $$;
|
|
|
|
CREATE PROCEDURE P1 ()
|
|
BEGIN NOT ATOMIC
|
|
IF (SELECT 2) THEN
|
|
SELECT 4;
|
|
END IF ;
|
|
END;
|
|
$$
|
|
|
|
DELIMITER ;$$
|
|
|
|
select name,db,body from mysql.proc where name = "P1";
|
|
update mysql.proc set body_utf8="BEGIN NOT ATOMIC
|
|
IF (SELECT 2) OR foo = 3 THEN
|
|
SELECT 4;
|
|
END IF ;
|
|
END", body="BEGIN NOT ATOMIC
|
|
IF (SELECT 2) OR foo = 3 THEN
|
|
SELECT 4;
|
|
END IF ;
|
|
END"where name = "P1";
|
|
|
|
--error ER_SP_UNDECLARED_VAR
|
|
show create procedure P1;
|
|
show warnings;
|
|
|
|
drop procedure P1;
|
|
|
|
--echo # End of 10.4 tests
|