~drizzle-trunk/drizzle/development

1 by brian
clean slate
1
#
2
# Testing the MySQL command line client(mysql)
3
#
4
5
--disable_warnings
6
drop table if exists t1;
7
--enable_warnings
8
9
#
10
# Test the "delimiter" functionality
11
# Bug#9879
12
#
13
create table t1(a int);
14
insert into t1 values(1);
15
16
# Test delimiters
17
--exec $MYSQL test 2>&1 < "./t/mysql_delimiter.sql"
18
19
--disable_query_log
20
# Test delimiter : supplied on the command line
21
select "Test delimiter : from command line" as "_";
22
--exec $MYSQL test --delimiter=":" -e "select * from t1:"
23
# Test delimiter :; supplied on the command line
24
select "Test delimiter :; from command line" as "_";
25
--exec $MYSQL test --delimiter=":;" -e "select * from t1:;"
26
# Test 'go' command (vertical output) \G
27
select "Test 'go' command(vertical output) \G" as "_";
28
--exec $MYSQL test -e "select * from t1\G"
29
# Test 'go' command \g
30
select "Test  'go' command \g" as "_";
31
--exec $MYSQL test -e "select * from t1\g"
32
--enable_query_log
33
drop table t1;
34
35
#
36
# BUG9998 - MySQL client hangs on USE "database"
37
#
38
create table t1(a int);
39
lock tables t1 write;
40
--exec $MYSQL -e "use test; select database();"
41
unlock tables;
42
drop table t1;
43
44
#
45
# Bug#16859 -- NULLs in columns must not truncate data as if a C-language "string".
46
#
47
--exec $MYSQL -t test -e "create table t1 (col1 binary(4), col2 varchar(10), col3 int); insert into t1 values ('a', 'b', 123421),('a ', '0123456789', 4), ('abcd', '', 4); select concat('>',col1,'<'), col2, col3 from t1; drop table t1;" 2>&1
48
49
#
50
# Bug#17939 Wrong table format when using UTF8 strings
51
#
52
--exec $MYSQL --default-character-set=utf8 --table -e "SELECT 'John Doe' as '__tañgè Ñãmé'" 2>&1
53
--exec $MYSQL --default-character-set=utf8 --table -e "SELECT '__tañgè Ñãmé' as 'John Doe'" 2>&1
54
55
#
56
# Bug#18265 -- mysql client: No longer right-justifies numeric columns
57
#
58
--exec $MYSQL -t --default-character-set utf8 test -e "create table t1 (i int, j int, k char(25) charset utf8); insert into t1 (i) values (1); insert into t1 (k) values ('<----------------------->'); insert into t1 (k) values ('<-----'); insert into t1 (k) values ('Τη γλώσσα'); insert into t1 (k) values ('ᛖᚴ ᚷᛖᛏ'); select * from t1; DROP TABLE t1;"
59
60
#
61
# "DESCRIBE" commands may return strange NULLness flags.
62
#
63
--exec $MYSQL --default-character-set utf8 test -e "create table t1 (i int, j int not null, k int); insert into t1 values (null, 1, null); select * from t1; describe t1; drop table t1;"
64
--exec $MYSQL -t --default-character-set utf8 test -e "create table t1 (i int, j int not null, k int); insert into t1 values (null, 1, null); select * from t1; describe t1; drop table t1;"
65
66
#
67
# Bug#19564: mysql displays NULL instead of space
68
#
69
--exec $MYSQL test -e "create table b19564 (i int, s1 char(1)); insert into b19564 values (1, 'x'); insert into b19564 values (2, NULL); insert into b19564 values (3, ' '); select * from b19564 order by i; drop table b19564;" 
70
--exec $MYSQL -t test -e "create table b19564 (i int, s1 char(1)); insert into b19564 values (1, 'x'); insert into b19564 values (2, NULL); insert into b19564 values (3, ' '); select * from b19564 order by i; drop table b19564;" 
71
72
#
73
# Bug#21618: NULL shown as empty string in client
74
#
75
--exec $MYSQL test -e "select unhex('zz');" 
76
--exec $MYSQL -t test -e "select unhex('zz');" 
77
78
# Bug#19265 describe command does not work from mysql prompt
79
#
80
81
create table t1(a int, b varchar(255), c int);
82
--exec $MYSQL test -e "desc t1"
83
--exec $MYSQL test -e "desc t1\g"
84
drop table t1;
85
86
--disable_parsing
87
#
88
# Bug#21042  	mysql client segfaults on importing a mysqldump export
89
#
90
--error 1
91
--exec $MYSQL test -e "connect verylongdatabasenamethatshouldblowthe256byteslongbufferincom_connectfunctionxkxkxkxkxkxkxkxkxkxkxkxkxkxkxkxkxkxkxkxkxkxkxkxkxkxkxkxkxkxkxkxkxkxkxkxkxkxkxkxkxkxkxkxkxkxkxkxkxkxkxkxkxendcccccccdxxxxxxxxxxxxxxxxxkskskskskkskskskskskskskskskskkskskskskkskskskskskskskskskend" 2>&1
92
--enable_parsing
93
94
95
#
96
# Bug #20432: mysql client interprets commands in comments
97
#
98
99
# if the client sees the 'use' within the comment, we haven't fixed
100
--exec echo "/*"          >  $MYSQLTEST_VARDIR/tmp/bug20432.sql
101
--exec echo "use"         >> $MYSQLTEST_VARDIR/tmp/bug20432.sql
102
--exec echo "*/"          >> $MYSQLTEST_VARDIR/tmp/bug20432.sql
103
--exec $MYSQL              < $MYSQLTEST_VARDIR/tmp/bug20432.sql 2>&1
104
105
# SQL can have embedded comments => workie
106
--exec echo "select /*"   >  $MYSQLTEST_VARDIR/tmp/bug20432.sql
107
--exec echo "use"         >> $MYSQLTEST_VARDIR/tmp/bug20432.sql
108
--exec echo "*/ 1"        >> $MYSQLTEST_VARDIR/tmp/bug20432.sql
109
--exec $MYSQL              < $MYSQLTEST_VARDIR/tmp/bug20432.sql 2>&1
110
111
# client commands on the other hand must be at BOL => error
112
--exec echo "/*"          >  $MYSQLTEST_VARDIR/tmp/bug20432.sql
113
--exec echo "xxx"         >> $MYSQLTEST_VARDIR/tmp/bug20432.sql
114
--exec echo "*/ use"      >> $MYSQLTEST_VARDIR/tmp/bug20432.sql
115
--error 1
116
--exec $MYSQL              < $MYSQLTEST_VARDIR/tmp/bug20432.sql 2>&1
117
118
# client comment recognized, but parameter missing => error
119
--exec echo "use"         >  $MYSQLTEST_VARDIR/tmp/bug20432.sql
120
--exec $MYSQL              < $MYSQLTEST_VARDIR/tmp/bug20432.sql 2>&1
121
122
#
123
# Bug #20328: mysql client interprets commands in comments
124
#
125
--exec $MYSQL -e "help" > $MYSQLTEST_VARDIR/tmp/bug20328_1.result
126
--exec $MYSQL -e "help " > $MYSQLTEST_VARDIR/tmp/bug20328_2.result
127
--diff_files $MYSQLTEST_VARDIR/tmp/bug20328_1.result $MYSQLTEST_VARDIR/tmp/bug20328_2.result
128
129
#
130
# Bug #19216: Client crashes on long SELECT
131
#
132
# Create large SELECT
133
# - 3400 * 20 makes 68000 columns that is more than the
134
#   max number that can fit in a 16 bit number.
135
136
--perl
137
open(FILE,">","$ENV{'MYSQLTEST_VARDIR'}/tmp/b19216.tmp") or die;
138
print FILE "select\n";
139
print FILE "'a','a','a','a','a','a','a','a','a','a','a','a','a','a','a','a','a','a','a','a',\n" x 3400;
140
print FILE "'b';\n";
141
close FILE;
142
EOF
143
144
--disable_query_log
145
--exec $MYSQL < $MYSQLTEST_VARDIR/tmp/b19216.tmp >/dev/null
146
--enable_query_log
147
148
--remove_file $MYSQLTEST_VARDIR/tmp/b19216.tmp
149
150
#
151
# Bug #20103: Escaping with backslash does not work
152
#
153
--exec echo "SET SQL_MODE = 'NO_BACKSLASH_ESCAPES';"  > $MYSQLTEST_VARDIR/tmp/bug20103.sql
154
--exec echo "SELECT '\';" >> $MYSQLTEST_VARDIR/tmp/bug20103.sql
155
--exec $MYSQL < $MYSQLTEST_VARDIR/tmp/bug20103.sql 2>&1
156
157
--exec echo "SET SQL_MODE = '';"  > $MYSQLTEST_VARDIR/tmp/bug20103.sql
158
--exec echo "SELECT '\';';" >> $MYSQLTEST_VARDIR/tmp/bug20103.sql
159
--exec $MYSQL              < $MYSQLTEST_VARDIR/tmp/bug20103.sql 2>&1
160
161
#
162
# Bug#17583: mysql drops connection when stdout is not writable
163
#
164
create table t17583 (a int);
165
insert into t17583 (a) values (0),(1),(2),(3),(4),(5),(6),(7),(8),(9);
166
insert into t17583 select a from t17583;
167
insert into t17583 select a from t17583;
168
insert into t17583 select a from t17583;
169
insert into t17583 select a from t17583;
170
insert into t17583 select a from t17583;
171
insert into t17583 select a from t17583;
172
insert into t17583 select a from t17583;
173
# Close to the minimal data needed to exercise bug.
174
select count(*) from t17583;
175
--exec echo "select count(*) from t17583; select count(*) from t17583; select count(*) from t17583; select count(*) from t17583; select count(*) from t17583; select count(*) from t17583; select count(*) from t17583; select count(*) from t17583; select count(*) from t17583; select count(*) from t17583; select count(*) from t17583; select count(*) from t17583; select count(*) from t17583; select count(*) from t17583; select count(*) from t17583; select count(*) from t17583; select count(*) from t17583; select count(*) from t17583; select count(*) from t17583; select count(*) from t17583; select count(*) from t17583; select count(*) from t17583; select count(*) from t17583; select count(*) from t17583; select count(*) from t17583; select count(*) from t17583; select count(*) from t17583; select count(*) from t17583; select count(*) from t17583; select count(*) from t17583; select count(*) from t17583; select count(*) from t17583; select count(*) from t17583; select count(*) from t17583; select count(*) from t17583; select count(*) from t17583; select count(*) from t17583; select count(*) from t17583; select count(*) from t17583; select count(*) from t17583; select count(*) from t17583; select count(*) from t17583; select count(*) from t17583; select count(*) from t17583; select count(*) from t17583; select count(*) from t17583; select count(*) from t17583; select count(*) from t17583; select count(*) from t17583; select count(*) from t17583; select count(*) from t17583; select count(*) from t17583; select count(*) from t17583; select count(*) from t17583; select count(*) from t17583; select count(*) from t17583; select count(*) from t17583; select count(*) from t17583; select count(*) from t17583; select count(*) from t17583; select count(*) from t17583; select count(*) from t17583; select count(*) from t17583; select count(*) from t17583; select count(*) from t17583; select count(*) from t17583; select count(*) from t17583; select count(*) from t17583; select count(*) from t17583; select count(*) from t17583; select count(*) from t17583; select count(*) from t17583; select count(*) from t17583; select count(*) from t17583; select count(*) from t17583; " |$MYSQL test >&-
176
drop table t17583;
177
178
#
179
# Bug#20984: Reproducible MySQL client segmentation fault
180
#  + additional tests for the "com_connect" function in mysql
181
#
182
#
183
--echo Test connect without db- or host-name => reconnect
184
--exec $MYSQL test -e "\r" 2>&1
185
--exec $MYSQL test -e "connect" 2>&1
186
187
--echo Test connect with dbname only => new dbname, old hostname
188
--exec $MYSQL test -e "\r test" 2>&1
189
--exec $MYSQL test -e "connect test" 2>&1
190
--exec $MYSQL test -e "\rtest" 2>&1
191
--error 1
192
--exec $MYSQL test -e "connecttest" 2>&1
193
194
--echo Test connect with _invalid_ dbname only => new invalid dbname, old hostname
195
--error 1
196
--exec $MYSQL test -e "\r invalid" 2>&1
197
--error 1
198
--exec $MYSQL test -e "connect invalid" 2>&1
199
200
--echo Test connect with dbname + hostname
201
--exec $MYSQL test -e "\r test localhost" 2>&1
202
--exec $MYSQL test -e "connect test localhost" 2>&1
203
204
--echo Test connect with dbname + _invalid_ hostname
205
# Mask the errno of the error message
206
--replace_regex /\([0-9]*\)/(errno)/
207
--error 1
208
--exec $MYSQL test -e "\r test invalid_hostname" 2>&1
209
--replace_regex /\([0-9]*\)/(errno)/
210
--error 1
211
--exec $MYSQL test -e "connect test invalid_hostname" 2>&1
212
213
--echo The commands reported in the bug report
214
--replace_regex /\([0-9]*\)/(errno)/
215
--error 1
216
--exec $MYSQL test -e "\r\r\n\r\n cyril\ has\ found\ a\ bug\ :)XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX" 2>&1
217
218
#--replace_regex /\([0-9]*\)/(errno)/
219
#--error 1
220
#--exec echo '\r\r\n\r\n cyril\ has\ found\ a\ bug\ :)XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX' | $MYSQL 2>&1
221
222
--echo Too long dbname
223
--error 1
224
--exec $MYSQL test -e "\r test_really_long_dbnamexxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx localhost" 2>&1
225
226
--echo Too long hostname
227
--replace_regex /\([0-9]*\)/(errno)/
228
--error 1
229
--exec $MYSQL test -e "\r  test cyrils_superlonghostnameXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX" 2>&1
230
231
232
#
233
# Bug #21412: mysql cmdline client allows backslash(es) 
234
# as delimiter but can't recognize them
235
#
236
237
# This should work just fine...
238
--write_file $MYSQLTEST_VARDIR/tmp/bug21412.sql
239
DELIMITER /
240
SELECT 1/
241
EOF
242
--exec $MYSQL             < $MYSQLTEST_VARDIR/tmp/bug21412.sql 2>&1
243
remove_file $MYSQLTEST_VARDIR/tmp/bug21412.sql;
244
245
# This should give an error...
246
--write_file $MYSQLTEST_VARDIR/tmp/bug21412.sql
247
DELIMITER \
248
EOF
249
--exec $MYSQL             < $MYSQLTEST_VARDIR/tmp/bug21412.sql 2>&1
250
remove_file $MYSQLTEST_VARDIR/tmp/bug21412.sql;
251
252
# As should this...
253
--write_file $MYSQLTEST_VARDIR/tmp/bug21412.sql
254
DELIMITER \\
255
EOF
256
--exec $MYSQL             < $MYSQLTEST_VARDIR/tmp/bug21412.sql 2>&1
257
remove_file $MYSQLTEST_VARDIR/tmp/bug21412.sql;
258
259
#
260
# Some coverage of not normally used parts
261
#
262
263
--disable_query_log
264
--exec $MYSQL test -e "show status" 2>&1 > /dev/null
265
--exec $MYSQL --help 2>&1 > /dev/null
266
--exec $MYSQL --version 2>&1 > /dev/null
267
--enable_query_log
268
269
#
270
# bug #26851: Mysql Client --pager Buffer Overflow
271
#
272
273
# allow error 7(invalid argument) since --pager does not always exist in mysql
274
--error 0,7
275
--exec $MYSQL --pager="540bytelengthstringxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx" -e "select 1" > /dev/null 2>&1
276
--exec $MYSQL --character-sets-dir="540bytelengthstringxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx" -e "select 1" 2>&1
277
278
#
279
# bug #30164: Using client side macro inside server side comments generates broken queries
280
#
281
--exec $MYSQL test -e "/*! \C latin1 */ select 1;"
282
283
#
284
# Bug#29323 mysql client only accetps ANSI encoded files
285
#
286
--write_file $MYSQLTEST_VARDIR/tmp/bug29323.sql
287
select "This is a file starting with UTF8 BOM 0xEFBBBF";
288
EOF
289
--exec $MYSQL < $MYSQLTEST_VARDIR/tmp/bug29323.sql 2>&1
290
remove_file $MYSQLTEST_VARDIR/tmp/bug29323.sql;
291
292
--echo End of 5.0 tests
293
294
#
295
# Bug #29903: The CMake build method does not produce the embedded library.
296
#
297
--disable_query_log
298
--exec $MYSQL --server-arg=no-defaults test -e "quit"
299
--enable_query_log
300
301
#
302
# Bug#26780: patch to add auto vertical output option to the cli.
303
#
304
# Make this wide enough that it will wrap almost everywhere.
305
--exec $MYSQL test --auto-vertical-output --table -e "SELECT 1,2,3,4,5,6,7,8,9,0,1,2,3,4,5,6,7,8,9,0,1,2,3,4,5,6,7,8,9,0,1,2,3,4,5,6,7,8,9,0,1,2,3,4,5,6,7,8,9,0,1,2,3,4,5,6,7,8,9,0,1,2,3,4,5,6,7,8,9,0,1,2,3,4,5,6,7,8,9,0,1,2,3,4,5,6,7,8,9,0,1,2,3,4,5,6,7,8,9,0,1,2,3,4,5,6,7,8,9,0,1,2,3,4,5,6,7,8,9,0,1,2,3,4,5,6,7,8,9,0,1,2,3,4,5,6,7,8,9,0,1,2,3,4,5,6,7,8,9,0,1,2,3,4,5,6,7,8,9,0,1,2,3,4,5,6,7,8,9,0,1,2,3,4,5,6,7,8,9,0,1,2,3,4,5,6,7,8,9,0;"
306
# Too short to wrap.
307
--exec $MYSQL test --auto-vertical-output --table -e "SELECT 1;"
308
309
#
310
# Bug #25146: Some warnings/errors not shown when using --show-warnings
311
#
312
313
# This one should succeed with no warnings
314
--exec $MYSQL --show-warnings test -e "create table t1 (id int)"
315
316
# This should succeed, with warnings about conversion from nonexistent engine
317
--exec $MYSQL --show-warnings test -e "create table t2 (id int) engine=nonexistent"
318
319
# This should fail, with warnings as well
320
--error 1
321
--exec $MYSQL --show-warnings test -e "create table t2 (id int) engine=nonexistent2"
322
323
drop tables t1, t2;
324
325
--echo End of tests