2
# Testing the MySQL command line client(mysql)
6
drop table if exists t1;
10
# Test the "delimiter" functionality
13
create table t1(a int);
14
insert into t1 values(1);
17
--exec $MYSQL test 2>&1 < "./t/mysql_delimiter.sql"
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"
36
# BUG9998 - MySQL client hangs on USE "database"
38
create table t1(a int);
40
--exec $MYSQL -e "use test; select database();"
45
# Bug#16859 -- NULLs in columns must not truncate data as if a C-language "string".
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
50
# Bug#17939 Wrong table format when using UTF8 strings
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
56
# Bug#18265 -- mysql client: No longer right-justifies numeric columns
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;"
61
# "DESCRIBE" commands may return strange NULLness flags.
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;"
67
# Bug#19564: mysql displays NULL instead of space
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;"
73
# Bug#21618: NULL shown as empty string in client
75
--exec $MYSQL test -e "select unhex('zz');"
76
--exec $MYSQL -t test -e "select unhex('zz');"
78
# Bug#19265 describe command does not work from mysql prompt
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"
88
# Bug#21042 mysql client segfaults on importing a mysqldump export
91
#--exec $MYSQL test -e "connect verylongdatabasenamethatshouldblowthe256byteslongbufferincom_connectfunctionxkxkxkxkxkxkxkxkxkxkxkxkxkxkxkxkxkxkxkxkxkxkxkxkxkxkxkxkxkxkxkxkxkxkxkxkxkxkxkxkxkxkxkxkxkxkxkxkxkxkxkxkxendcccccccdxxxxxxxxxxxxxxxxxkskskskskkskskskskskskskskskskkskskskskkskskskskskskskskskend" 2>&1
96
# Bug #20432: mysql client interprets commands in comments
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
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
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
116
--exec $MYSQL < $MYSQLTEST_VARDIR/tmp/bug20432.sql 2>&1
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
123
# Bug #20328: mysql client interprets commands in comments
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
130
# Bug #19216: Client crashes on long SELECT
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.
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";
145
#--exec $MYSQL < $MYSQLTEST_VARDIR/tmp/b19216.tmp >/dev/null
148
#--remove_file $MYSQLTEST_VARDIR/tmp/b19216.tmp
151
# Bug#17583: mysql drops connection when stdout is not writable
153
create table t17583 (a int);
154
insert into t17583 (a) values (0),(1),(2),(3),(4),(5),(6),(7),(8),(9);
155
insert into t17583 select a from t17583;
156
insert into t17583 select a from t17583;
157
insert into t17583 select a from t17583;
158
insert into t17583 select a from t17583;
159
insert into t17583 select a from t17583;
160
insert into t17583 select a from t17583;
161
insert into t17583 select a from t17583;
162
# Close to the minimal data needed to exercise bug.
163
select count(*) from t17583;
164
--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 >&-
168
# Bug#20984: Reproducible MySQL client segmentation fault
169
# + additional tests for the "com_connect" function in mysql
172
--echo Test connect without db- or host-name => reconnect
173
--exec $MYSQL test -e "\r" 2>&1
174
--exec $MYSQL test -e "connect" 2>&1
176
--echo Test connect with dbname only => new dbname, old hostname
177
--exec $MYSQL test -e "\r test" 2>&1
178
--exec $MYSQL test -e "connect test" 2>&1
179
--exec $MYSQL test -e "\rtest" 2>&1
181
--exec $MYSQL test -e "connecttest" 2>&1
183
--echo Test connect with _invalid_ dbname only => new invalid dbname, old hostname
185
--exec $MYSQL test -e "\r invalid" 2>&1
187
--exec $MYSQL test -e "connect invalid" 2>&1
189
--echo Test connect with dbname + hostname
190
--exec $MYSQL test -e "\r test localhost" 2>&1
191
--exec $MYSQL test -e "connect test localhost" 2>&1
193
--echo Test connect with dbname + _invalid_ hostname
194
# Mask the errno of the error message
195
#--replace_regex /\([0-9]*\)/(errno)/
197
#--exec $MYSQL test -e "\r test invalid_hostname" 2>&1
198
#--replace_regex /\([0-9]*\)/(errno)/
200
#--exec $MYSQL test -e "connect test invalid_hostname" 2>&1
202
#--echo The commands reported in the bug report
203
#--replace_regex /\([0-9]*\)/(errno)/
205
#--exec $MYSQL test -e "\r\r\n\r\n cyril\ has\ found\ a\ bug\ :)XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX" 2>&1
207
##--replace_regex /\([0-9]*\)/(errno)/
209
##--exec echo '\r\r\n\r\n cyril\ has\ found\ a\ bug\ :)XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX' | $MYSQL 2>&1
211
#--echo Too long dbname
213
#--exec $MYSQL test -e "\r test_really_long_dbnamexxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx localhost" 2>&1
215
#--echo Too long hostname
216
#--replace_regex /\([0-9]*\)/(errno)/
218
#--exec $MYSQL test -e "\r test cyrils_superlonghostnameXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX" 2>&1
222
# Bug #21412: mysql cmdline client allows backslash(es)
223
# as delimiter but can't recognize them
226
# This should work just fine...
227
#--write_file $MYSQLTEST_VARDIR/tmp/bug21412.sql
231
#--exec $MYSQL < $MYSQLTEST_VARDIR/tmp/bug21412.sql 2>&1
232
#remove_file $MYSQLTEST_VARDIR/tmp/bug21412.sql;
234
## This should give an error...
235
#--write_file $MYSQLTEST_VARDIR/tmp/bug21412.sql
238
#--exec $MYSQL < $MYSQLTEST_VARDIR/tmp/bug21412.sql 2>&1
239
#remove_file $MYSQLTEST_VARDIR/tmp/bug21412.sql;
242
#--write_file $MYSQLTEST_VARDIR/tmp/bug21412.sql
245
#--exec $MYSQL < $MYSQLTEST_VARDIR/tmp/bug21412.sql 2>&1
246
#remove_file $MYSQLTEST_VARDIR/tmp/bug21412.sql;
249
# Some coverage of not normally used parts
253
--exec $MYSQL test -e "show status" 2>&1 > /dev/null
254
--exec $MYSQL --help 2>&1 > /dev/null
255
--exec $MYSQL --version 2>&1 > /dev/null
259
# bug #26851: Mysql Client --pager Buffer Overflow
262
# allow error 7(invalid argument) since --pager does not always exist in mysql
264
--exec $MYSQL --pager="540bytelengthstringxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx" -e "select 1" > /dev/null 2>&1
265
--exec $MYSQL --character-sets-dir="540bytelengthstringxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx" -e "select 1" 2>&1
268
# bug #30164: Using client side macro inside server side comments generates broken queries
270
--exec $MYSQL test -e "/*! \C latin1 */ select 1;"
273
# Bug#29323 mysql client only accetps ANSI encoded files
275
#--write_file $MYSQLTEST_VARDIR/tmp/bug29323.sql
276
#select "This is a file starting with UTF8 BOM 0xEFBBBF";
278
#--exec $MYSQL < $MYSQLTEST_VARDIR/tmp/bug29323.sql 2>&1
279
#remove_file $MYSQLTEST_VARDIR/tmp/bug29323.sql;
281
--echo End of 5.0 tests
284
# Bug#26780: patch to add auto vertical output option to the cli.
286
# Make this wide enough that it will wrap almost everywhere.
287
--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;"
289
--exec $MYSQL test --auto-vertical-output --table -e "SELECT 1;"