1drop table if exists t1;
2insert into t1 values(1);
3ERROR 42S02: Table 'test.t1' doesn't exist
4delete from t1;
5ERROR 42S02: Table 'test.t1' doesn't exist
6update t1 set a=1;
7ERROR 42S02: Table 'test.t1' doesn't exist
8create table t1 (a int);
9select count(test.t1.b) from t1;
10ERROR 42S22: Unknown column 'test.t1.b' in 'field list'
11select count(not_existing_database.t1) from t1;
12ERROR 42S22: Unknown column 'not_existing_database.t1' in 'field list'
13select count(not_existing_database.t1.a) from t1;
14ERROR 42S22: Unknown column 'not_existing_database.t1.a' in 'field list'
15select count(not_existing_database.t1.a) from not_existing_database.t1;
16Got one of the listed errors
17select 1 from t1 order by 2;
18ERROR 42S22: Unknown column '2' in 'order clause'
19select 1 from t1 group by 2;
20ERROR 42S22: Unknown column '2' in 'group statement'
21select 1 from t1 order by t1.b;
22ERROR 42S22: Unknown column 't1.b' in 'order clause'
23select count(*),b from t1;
24ERROR 42S22: Unknown column 'b' in 'field list'
25drop table t1;
26create table t1 (a int(256));
27ERROR 42000: Display width out of range for 'a' (max = 255)
28set sql_mode='traditional';
29create table t1 (a varchar(66000));
30ERROR 42000: Column length too big for column 'a' (max = 65532); use BLOB or TEXT instead
31set sql_mode=default;
32CREATE TABLE t1 (a INT);
33SELECT a FROM t1 WHERE a IN(1, (SELECT IF(1=0,1,2/0)));
34a
35INSERT INTO t1 VALUES(1);
36SELECT a FROM t1 WHERE a IN(1, (SELECT IF(1=0,1,2/0)));
37a
381
39INSERT INTO t1 VALUES(2),(3);
40SELECT a FROM t1 WHERE a IN(1, (SELECT IF(1=0,1,2/0)));
41a
421
43Warnings:
44Warning	1365	Division by 0
45DROP TABLE t1;
46CREATE TABLE t1( a INT );
47SELECT b FROM t1;
48ERROR 42S22: Unknown column 'b' in 'field list'
49SHOW ERRORS;
50Level	Code	Message
51Error	1054	Unknown column 'b' in 'field list'
52CREATE TABLE t2 SELECT b FROM t1;
53ERROR 42S22: Unknown column 'b' in 'field list'
54SHOW ERRORS;
55Level	Code	Message
56Error	1054	Unknown column 'b' in 'field list'
57INSERT INTO t1 SELECT b FROM t1;
58ERROR 42S22: Unknown column 'b' in 'field list'
59DROP TABLE t1;
60flush status;
61drop table if exists t1, t2;
62create table t1 (a int unique);
63create table t2 (a int);
64drop function if exists f1;
65Warnings:
66Note	1305	FUNCTION test.f1 does not exist
67drop function if exists f2;
68Warnings:
69Note	1305	FUNCTION test.f2 does not exist
70create function f1() returns int
71begin
72insert into t1 (a) values (1);
73insert into t1 (a) values (1);
74return 1;
75end|
76create function f2() returns int
77begin
78insert into t2 (a) values (1);
79return 2;
80end|
81flush status;
82select f1(), f2();
83ERROR 23000: Duplicate entry '1' for key 'a'
84show status like 'Com_insert';
85Variable_name	Value
86Com_insert	2
87select * from t1;
88a
891
90select * from t2;
91a
92drop table t1;
93drop table t2;
94drop function f1;
95drop function f2;
96SET NAMES utf8;
97SET sql_quote_show_create= _binary x'5452C39C45';
98ERROR 42000: Variable 'sql_quote_show_create' can't be set to the value of 'TR\xC3\x9CE'
99SET sql_quote_show_create= _utf8 x'5452C39C45';
100ERROR 42000: Variable 'sql_quote_show_create' can't be set to the value of 'TRÜE'
101SET sql_quote_show_create=_latin1 x'5452DC45';
102ERROR 42000: Variable 'sql_quote_show_create' can't be set to the value of 'TRÜE'
103SET sql_quote_show_create='TRÜE';
104ERROR 42000: Variable 'sql_quote_show_create' can't be set to the value of 'TRÜE'
105SET sql_quote_show_create=TRÜE;
106ERROR 42000: Variable 'sql_quote_show_create' can't be set to the value of 'TRÜE'
107SET NAMES latin1;
108SET sql_quote_show_create= _binary x'5452C39C45';
109ERROR 42000: Variable 'sql_quote_show_create' can't be set to the value of 'TR\xC3\x9CE'
110SET sql_quote_show_create= _utf8 x'5452C39C45';
111ERROR 42000: Variable 'sql_quote_show_create' can't be set to the value of 'TR�E'
112SET sql_quote_show_create=_latin1 x'5452DC45';
113ERROR 42000: Variable 'sql_quote_show_create' can't be set to the value of 'TR�E'
114SET sql_quote_show_create='TR�E';
115ERROR 42000: Variable 'sql_quote_show_create' can't be set to the value of 'TR�E'
116SET sql_quote_show_create=TR�E;
117ERROR 42000: Variable 'sql_quote_show_create' can't be set to the value of 'TR�E'
118SET NAMES binary;
119SET sql_quote_show_create= _binary x'5452C39C45';
120ERROR 42000: Variable 'sql_quote_show_create' can't be set to the value of 'TR\xC3\x9CE'
121SET sql_quote_show_create= _utf8 x'5452C39C45';
122ERROR 42000: Variable 'sql_quote_show_create' can't be set to the value of 'TRÜE'
123SET sql_quote_show_create=_latin1 x'5452DC45';
124ERROR 42000: Variable 'sql_quote_show_create' can't be set to the value of 'TRÜE'
125#
126# Bug#52430 Incorrect key in the error message for duplicate key error involving BINARY type
127#
128CREATE TABLE t1(c1 BINARY(10), c2 BINARY(10), c3 BINARY(10),
129PRIMARY KEY(c1,c2,c3));
130INSERT INTO t1 (c1,c2,c3) VALUES('abc','abc','abc');
131INSERT INTO t1 (c1,c2,c3) VALUES('abc','abc','abc');
132ERROR 23000: Duplicate entry 'abc-abc-abc' for key 'PRIMARY'
133DROP TABLE t1;
134CREATE TABLE t1 (f1 VARBINARY(19) PRIMARY KEY);
135INSERT INTO t1 VALUES ('abc\0\0');
136INSERT INTO t1 VALUES ('abc\0\0');
137ERROR 23000: Duplicate entry 'abc\x00\x00' for key 'PRIMARY'
138DROP TABLE t1;
139#
140# Bug#57882: Item_func_conv_charset::val_str(String*):
141#            Assertion `fixed == 1' failed
142#
143SELECT (CONVERT('0' USING latin1) IN (CHAR(COT('v') USING utf8),''));
144ERROR 22003: DOUBLE value is out of range in 'cot('v')'
145SET NAMES utf8 COLLATE utf8_latvian_ci ;
146SELECT UPDATEXML(-73 * -2465717823867977728,@@global.auto_increment_increment,null);
147ERROR 22003: BIGINT value is out of range in '-73 * -2465717823867977728'
148#
149# End Bug#57882
150#
151CREATE TABLE t1 (a INT);
152CREATE TABLE t2(a INT PRIMARY KEY, b INT);
153SELECT '' AS b FROM t1 GROUP BY VALUE(b);
154ERROR 42S22: Unknown column '' in 'VALUES() function'
155REPLACE t2(b) SELECT '' AS b FROM t1 GROUP BY VALUE(b);
156ERROR 42S22: Unknown column '' in 'VALUES() function'
157UPDATE t2 SET a=(SELECT '' AS b FROM t1 GROUP BY VALUE(b));
158ERROR 42S22: Unknown column '' in 'VALUES() function'
159INSERT INTO t2 VALUES (1,0) ON DUPLICATE KEY UPDATE
160b=(SELECT '' AS b FROM t1 GROUP BY VALUE(b));
161ERROR 42S22: Unknown column '' in 'VALUES() function'
162INSERT INTO t2(a,b) VALUES (1,0) ON DUPLICATE KEY UPDATE
163b=(SELECT VALUE(a)+2 FROM t1);
164DROP TABLE t1, t2;
165#
166# MDEV-492: incorrect error check before sending OK in mysql_update
167#
168CREATE TABLE t1 (a CHAR(3), b BLOB);
169UPDATE t1 SET a = 'new'
170WHERE COLUMN_CREATE( 1, 'v', 1, 'w' ) IS NULL;
171ERROR 22007: Illegal value used as argument of dynamic column function
172drop table t1;
173set @max_session_mem_used_save= @@max_session_mem_used;
174set max_session_mem_used = 50000;
175select * from seq_1_to_1000;
176set max_session_mem_used = 8192;
177select * from seq_1_to_1000;
178set max_session_mem_used = @max_session_mem_used_save;
179#
180# MDEV-20604: Duplicate key value is silently truncated to 64
181# characters in print_keydup_error
182#
183create table t1 (a varchar(100), UNIQUE KEY akey (a));
184insert into t1 values ("1234567890123456789012345678901234567890123456789012345678901234567890_end");
185# The value in the error message should show truncation with "..."
186insert into t1 values ("1234567890123456789012345678901234567890123456789012345678901234567890_end");
187ERROR 23000: Duplicate entry '1234567890123456789012345678901234567890123456789012345678901...' for key 'akey'
188drop table t1;
189# End of 10.2 tests
190#
191# MDEV-14269 errors.test fails with valgrind (Conditional jump or move depends on uninitialised value)
192#
193SET NAMES utf8;
194SELECT UPDATEXML(-73 * -2465717823867977728,@@global.auto_increment_increment,null);
195ERROR 22003: BIGINT value is out of range in '-73 * -2465717823867977728'
196SELECT UPDATEXML(-73 * -2465717823867977728,@@global.long_query_time,null);
197ERROR 22003: BIGINT value is out of range in '-73 * -2465717823867977728'
198# End of 10.3 tests
199#
200# MDEV-23518: Syntax error in ond SP results in misleading
201# message on SHOW CREATE PROCEDURE
202#
203CREATE PROCEDURE P1 ()
204BEGIN NOT ATOMIC
205IF (SELECT 2) THEN
206SELECT 4;
207END IF ;
208END;
209$$
210select name,db,body from mysql.proc where name = "P1";
211name	db	body
212P1	test	BEGIN NOT ATOMIC
213IF (SELECT 2) THEN
214SELECT 4;
215END IF ;
216END
217update mysql.proc set body_utf8="BEGIN NOT ATOMIC
218IF (SELECT 2) OR foo = 3 THEN
219SELECT 4;
220END IF ;
221END", body="BEGIN NOT ATOMIC
222IF (SELECT 2) OR foo = 3 THEN
223SELECT 4;
224END IF ;
225END"where name = "P1";
226show create procedure P1;
227ERROR 42000: Undeclared variable: foo
228show warnings;
229Level	Code	Message
230Error	1327	Undeclared variable: foo
231Error	1305	PROCEDURE P1 does not exist
232drop procedure P1;
233# End of 10.4 tests
234