1call mtr.add_suppression(".*test_sql_errors.*");
2call mtr.add_suppression(".*Killing thread.*");
3# Creating tables
4CREATE TABLE t_int (c1  TINYINT,
5c2  SMALLINT,
6c3  MEDIUMINT,
7c4  INT,
8c5  INTEGER,
9c6  SMALLINT UNSIGNED,
10c7  MEDIUMINT UNSIGNED,
11c8  INT UNSIGNED,
12c9  INTEGER);
13CREATE TABLE t_bigint (c1  BIGINT,
14c2  BIGINT UNSIGNED);
15CREATE TABLE t_real (c1 REAL UNSIGNED,
16c2 DOUBLE UNSIGNED,
17c3 FLOAT UNSIGNED,
18c4 DECIMAL UNSIGNED,
19c5 NUMERIC UNSIGNED,
20c6 DOUBLE,
21c7 FLOAT,
22c8 DECIMAL,
23c9 NUMERIC);
24CREATE TABLE t_date (c1 DATE,
25c2 TIME,
26c3 TIMESTAMP,
27c4 DATETIME,
28c5 YEAR);
29CREATE TABLE t_char (c1 CHAR(32),
30c2 VARCHAR(128) BINARY,
31c3 VARCHAR(128),
32c4 BINARY(128),
33c5 VARBINARY(2048));
34CREATE TABLE t_lob (c1  TINYBLOB,
35c2  BLOB,
36c3  MEDIUMBLOB,
37c4  LONGBLOB,
38c5  TINYTEXT,
39c6  TEXT,
40c7  MEDIUMTEXT,
41c8  LONGTEXT,
42c9  TINYTEXT BINARY,
43c10 TEXT BINARY,
44c11 MEDIUMTEXT BINARY,
45c12 LONGTEXT BINARY);
46CREATE TABLE t_spec (c1 BIT(16),
47c2 ENUM('v1','v2','v3'),
48c3 SET('v1','v2','v3'));
49# Inserting values into the tables
50INSERT INTO t_int VALUES (91,92,93,94,95,96,97,98,99),(81,82,83,84,85,86,87,88,89);
51INSERT INTO t_bigint VALUES (91,92),(81,82);
52INSERT INTO t_real VALUES (8.51,8.52,8.53,8.54,8.55,8.56,8.57,8.58,8.59);
53Warnings:
54Note	1265	Data truncated for column 'c4' at row 1
55Note	1265	Data truncated for column 'c5' at row 1
56Note	1265	Data truncated for column 'c8' at row 1
57Note	1265	Data truncated for column 'c9' at row 1
58INSERT INTO t_real VALUES (9.51,9.52,9.53,9.54,9.55,9.56,9.57,9.58,9.59);
59Warnings:
60Note	1265	Data truncated for column 'c4' at row 1
61Note	1265	Data truncated for column 'c5' at row 1
62Note	1265	Data truncated for column 'c8' at row 1
63Note	1265	Data truncated for column 'c9' at row 1
64INSERT INTO t_date VALUES ('2015-07-06','20:15','2015-12-31 14:59:48','2014-11-30 13:58:47','2015');
65INSERT INTO t_date VALUES ('2015-07-07','20:17','2013-12-31 17:59:47','2012-10-31 15:57:47','2010');
66INSERT INTO t_char VALUES ('char-text','varchar-binary-text\nnext line','varchar-text','binary-text\nnext line','varbinary-text\nline 1\nline 2');
67INSERT INTO t_char VALUES ('2char-text','2varchar-binary-text\nnext line','2varchar-text','2binary-text\nnext line','2varbinary-text\nline 1\nline 2');
68INSERT INTO t_lob  VALUES ('tinyblob-text readable','blob-text readable','mediumblob-text readable',
69'longblob-text readable','tinytext','text','mediumtext','longtext',
70'tinytext-binary\nnext line','text-binary\nnext line',
71'mediumtext-binary\nnext line','longtext-binary \nnext line');
72INSERT INTO t_lob  VALUES ('2tinyblob-text readable','2blob-text readable','2mediumblob-text readable',
73'2longblob-text readable','2tinytext','2text','2mediumtext','2longtext',
74'2tinytext-binary\nnext line','2text-binary\nnext line',
75'2mediumtext-binary\nnext line','2longtext-binary \nnext line');
76INSERT INTO t_spec VALUES ( b'111', 'v1', 'v1');
77##########################################
78# Run plugin
79##########################################
80INSTALL PLUGIN test_sql_errors SONAME 'TEST_SQL_ERRORS';
81/*first*/SELECT * FROM information_schema.processlist ORDER BY id;
82ID	USER	HOST	DB	COMMAND	TIME	STATE	INFO
83<ID>	root	<HOST_NAME>	test	Query	<TIME>	executing	/*first*/SELECT * FROM information_schema.processlist ORDER BY id
84<ID>	unauthenticated user	<HOST_NAME>	NULL	Sleep	<TIME>	login	PLUGIN
85<ID>	unauthenticated user	<HOST_NAME>	NULL	Sleep	<TIME>	login	PLUGIN
86<ID>	unauthenticated user	<HOST_NAME>	NULL	Sleep	<TIME>	login	PLUGIN
87<ID>	unauthenticated user	<HOST_NAME>	NULL	Sleep	<TIME>	login	PLUGIN
88<ID>	unauthenticated user	<HOST_NAME>	NULL	Sleep	<TIME>	login	PLUGIN
89##########################################
90# Stop plugin
91##########################################
92UNINSTALL PLUGIN test_sql_errors;
93/*first*/SELECT * FROM information_schema.processlist ORDER BY id;
94ID	USER	HOST	DB	COMMAND	TIME	STATE	INFO
95<ID>	root	<HOST_NAME>	test	Query	<TIME>	executing	/*first*/SELECT * FROM information_schema.processlist ORDER BY id
96<ID>	unauthenticated user	<HOST_NAME>	NULL	Sleep	<TIME>	login	PLUGIN
97<ID>	unauthenticated user	<HOST_NAME>	NULL	Sleep	<TIME>	login	PLUGIN
98<ID>	unauthenticated user	<HOST_NAME>	NULL	Sleep	<TIME>	login	PLUGIN
99<ID>	unauthenticated user	<HOST_NAME>	NULL	Sleep	<TIME>	login	PLUGIN
100<ID>	unauthenticated user	<HOST_NAME>	NULL	Sleep	<TIME>	login	PLUGIN
101##########################################
102# Cleanup
103##########################################
104# Dropping the created tables
105DROP TABLE IF EXISTS t_int;
106DROP TABLE IF EXISTS t_bigint;
107DROP TABLE IF EXISTS t_real;
108DROP TABLE IF EXISTS t_date;
109DROP TABLE IF EXISTS t_char;
110DROP TABLE IF EXISTS t_lob;
111DROP TABLE IF EXISTS t_spec;
112##########################################
113# Plugin log
114##########################################
115========================================================================
116Test in a server thread
117Opening Session 1
118========================================================================
119Session 1 :
120========================================================================
121SELECT * FROM test.t_int
122num_cols: 9
123nb rows: 2
124c1  c2  c3  c4  c5  c6  c7  c8  c9
125TINY(1) SHORT(2) INT24(9) LONG(3) LONG(3) SHORT(2) INT24(9) LONG(3) LONG(3)
126() () () () () (UNSIGNED ) (UNSIGNED ) (UNSIGNED ) ()
127Write a string
12891  92  93  94  95  96  97  98  99
12981  82  83  84  85  86  87  88  89
130
131affected rows : 0
132server status : 34
133warn count    : 0
134
135Opening Session 2
136========================================================================
137Session 1 :
138========================================================================
139SELECT * FROM test.t_bigint
140num_cols: 2
141nb rows: 2
142c1  c2
143LONGLONG(8) LONGLONG(8)
144() (UNSIGNED )
145Write a string
14691  92
14781  82
148
149affected rows : 0
150server status : 34
151warn count    : 0
152========================================================================
153Session 2 :
154========================================================================
155SELECT * FROM test.t_real
156num_cols: 9
157nb rows: 2
158c1  c2  c3  c4  c5  c6  c7  c8  c9
159DOUBLE(5) DOUBLE(5) FLOAT(4) NEWDECIMAL(246) NEWDECIMAL(246) DOUBLE(5) FLOAT(4) NEWDECIMAL(246) NEWDECIMAL(246)
160(UNSIGNED ) (UNSIGNED ) (UNSIGNED ) (UNSIGNED ) (UNSIGNED ) () () () ()
161Write a string
1628.51  8.52  8.53  9  9  8.56  8.57  9  9
1639.51  9.52  9.53  10  10  9.56  9.57  10  10
164
165affected rows : 0
166server status : 34
167warn count    : 0
168
169Close Session 1
170========================================================================
171Session 2 :
172========================================================================
173SELECT * FROM test.t_date
174num_cols: 5
175nb rows: 2
176c1  c2  c3  c4  c5
177DATE(10) TIME(11) TIMESTAMP(7) DATETIME(12) YEAR(13)
178(BINARY ) (BINARY ) (NOT_NULL BINARY TIMESTAMP ON_UPDATE_NOW ) (BINARY ) (UNSIGNED ZEROFILL )
179Write a string
1802015-07-06  20:15:00  2015-12-31 14:59:48  2014-11-30 13:58:47  2015
1812015-07-07  20:17:00  2013-12-31 17:59:47  2012-10-31 15:57:47  2010
182
183affected rows : 0
184server status : 34
185warn count    : 0
186========================================================================
187Session 1 (already closed):
188========================================================================
189SELECT * FROM test.t_date
190
191Close Session 2
192
193Close Session 2 again
194Follows threaded run
195========================================================================
196init thread
197Opening Session 1
198========================================================================
199Session 1 :
200========================================================================
201SELECT * FROM test.t_int
202num_cols: 9
203nb rows: 2
204c1  c2  c3  c4  c5  c6  c7  c8  c9
205TINY(1) SHORT(2) INT24(9) LONG(3) LONG(3) SHORT(2) INT24(9) LONG(3) LONG(3)
206() () () () () (UNSIGNED ) (UNSIGNED ) (UNSIGNED ) ()
207Write a string
20891  92  93  94  95  96  97  98  99
20981  82  83  84  85  86  87  88  89
210
211affected rows : 0
212server status : 34
213warn count    : 0
214
215Opening Session 2
216========================================================================
217Session 1 :
218========================================================================
219SELECT * FROM test.t_bigint
220num_cols: 2
221nb rows: 2
222c1  c2
223LONGLONG(8) LONGLONG(8)
224() (UNSIGNED )
225Write a string
22691  92
22781  82
228
229affected rows : 0
230server status : 34
231warn count    : 0
232========================================================================
233Session 2 :
234========================================================================
235SELECT * FROM test.t_real
236num_cols: 9
237nb rows: 2
238c1  c2  c3  c4  c5  c6  c7  c8  c9
239DOUBLE(5) DOUBLE(5) FLOAT(4) NEWDECIMAL(246) NEWDECIMAL(246) DOUBLE(5) FLOAT(4) NEWDECIMAL(246) NEWDECIMAL(246)
240(UNSIGNED ) (UNSIGNED ) (UNSIGNED ) (UNSIGNED ) (UNSIGNED ) () () () ()
241Write a string
2428.51  8.52  8.53  9  9  8.56  8.57  9  9
2439.51  9.52  9.53  10  10  9.56  9.57  10  10
244
245affected rows : 0
246server status : 34
247warn count    : 0
248
249Close Session 1
250========================================================================
251Session 2 :
252========================================================================
253SELECT * FROM test.t_date
254num_cols: 5
255nb rows: 2
256c1  c2  c3  c4  c5
257DATE(10) TIME(11) TIMESTAMP(7) DATETIME(12) YEAR(13)
258(BINARY ) (BINARY ) (NOT_NULL BINARY TIMESTAMP ON_UPDATE_NOW ) (BINARY ) (UNSIGNED ZEROFILL )
259Write a string
2602015-07-06  20:15:00  2015-12-31 14:59:48  2014-11-30 13:58:47  2015
2612015-07-07  20:17:00  2013-12-31 17:59:47  2012-10-31 15:57:47  2010
262
263affected rows : 0
264server status : 34
265warn count    : 0
266========================================================================
267Session 1 (already closed):
268========================================================================
269SELECT * FROM test.t_date
270
271Close Session 2
272
273Close Session 2 again
274deinit thread missing
275Test in a server thread without closing sessions
276srv_session_open 0
277srv_session_open 1
278srv_session_open 2
279srv_session_open 3
280srv_session_open 4
281##########################################
282# Server log
283##########################################
284test passed.
285