~drizzle-trunk/drizzle/development

« back to all changes in this revision

Viewing changes to tests/t/mysql.test

  • Committer: Monty Taylor
  • Date: 2008-07-09 16:42:25 UTC
  • mto: (77.6.1 glibclient-merge)
  • mto: This revision was merged to the branch mainline in revision 112.
  • Revision ID: monty@inaugust.com-20080709164225-2r6n4j98nhxh031l
Moved test to tests... 

Show diffs side-by-side

added added

removed removed

Lines of Context:
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#17583: mysql drops connection when stdout is not writable
152
 
#
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 >&-
165
 
drop table t17583;
166
 
 
167
 
#
168
 
# Bug#20984: Reproducible MySQL client segmentation fault
169
 
#  + additional tests for the "com_connect" function in mysql
170
 
#
171
 
#
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
175
 
 
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
180
 
--error 1
181
 
--exec $MYSQL test -e "connecttest" 2>&1
182
 
 
183
 
--echo Test connect with _invalid_ dbname only => new invalid dbname, old hostname
184
 
--error 1
185
 
--exec $MYSQL test -e "\r invalid" 2>&1
186
 
--error 1
187
 
--exec $MYSQL test -e "connect invalid" 2>&1
188
 
 
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
192
 
 
193
 
--echo Test connect with dbname + _invalid_ hostname
194
 
# Mask the errno of the error message
195
 
#--replace_regex /\([0-9]*\)/(errno)/
196
 
#--error 1
197
 
#--exec $MYSQL test -e "\r test invalid_hostname" 2>&1
198
 
#--replace_regex /\([0-9]*\)/(errno)/
199
 
#--error 1
200
 
#--exec $MYSQL test -e "connect test invalid_hostname" 2>&1
201
 
 
202
 
#--echo The commands reported in the bug report
203
 
#--replace_regex /\([0-9]*\)/(errno)/
204
 
#--error 1
205
 
#--exec $MYSQL test -e "\r\r\n\r\n cyril\ has\ found\ a\ bug\ :)XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX" 2>&1
206
 
#
207
 
##--replace_regex /\([0-9]*\)/(errno)/
208
 
##--error 1
209
 
##--exec echo '\r\r\n\r\n cyril\ has\ found\ a\ bug\ :)XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX' | $MYSQL 2>&1
210
 
#
211
 
#--echo Too long dbname
212
 
#--error 1
213
 
#--exec $MYSQL test -e "\r test_really_long_dbnamexxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx localhost" 2>&1
214
 
#
215
 
#--echo Too long hostname
216
 
#--replace_regex /\([0-9]*\)/(errno)/
217
 
#--error 1
218
 
#--exec $MYSQL test -e "\r  test cyrils_superlonghostnameXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX" 2>&1
219
 
 
220
 
 
221
 
#
222
 
# Bug #21412: mysql cmdline client allows backslash(es) 
223
 
# as delimiter but can't recognize them
224
 
#
225
 
 
226
 
# This should work just fine...
227
 
#--write_file $MYSQLTEST_VARDIR/tmp/bug21412.sql
228
 
#DELIMITER /
229
 
#SELECT 1/
230
 
#EOF
231
 
#--exec $MYSQL             < $MYSQLTEST_VARDIR/tmp/bug21412.sql 2>&1
232
 
#remove_file $MYSQLTEST_VARDIR/tmp/bug21412.sql;
233
 
#
234
 
## This should give an error...
235
 
#--write_file $MYSQLTEST_VARDIR/tmp/bug21412.sql
236
 
#DELIMITER \
237
 
#EOF
238
 
#--exec $MYSQL             < $MYSQLTEST_VARDIR/tmp/bug21412.sql 2>&1
239
 
#remove_file $MYSQLTEST_VARDIR/tmp/bug21412.sql;
240
 
#
241
 
## As should this...
242
 
#--write_file $MYSQLTEST_VARDIR/tmp/bug21412.sql
243
 
#DELIMITER \\
244
 
#EOF
245
 
#--exec $MYSQL             < $MYSQLTEST_VARDIR/tmp/bug21412.sql 2>&1
246
 
#remove_file $MYSQLTEST_VARDIR/tmp/bug21412.sql;
247
 
#
248
 
#
249
 
# Some coverage of not normally used parts
250
 
#
251
 
 
252
 
--disable_query_log
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
256
 
--enable_query_log
257
 
 
258
 
#
259
 
# bug #26851: Mysql Client --pager Buffer Overflow
260
 
#
261
 
 
262
 
# allow error 7(invalid argument) since --pager does not always exist in mysql
263
 
--error 0,7
264
 
--exec $MYSQL --pager="540bytelengthstringxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx" -e "select 1" > /dev/null 2>&1
265
 
--exec $MYSQL --character-sets-dir="540bytelengthstringxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx" -e "select 1" 2>&1
266
 
 
267
 
#
268
 
# bug #30164: Using client side macro inside server side comments generates broken queries
269
 
#
270
 
--exec $MYSQL test -e "/*! \C latin1 */ select 1;"
271
 
 
272
 
#
273
 
# Bug#29323 mysql client only accetps ANSI encoded files
274
 
#
275
 
#--write_file $MYSQLTEST_VARDIR/tmp/bug29323.sql
276
 
#select "This is a file starting with UTF8 BOM 0xEFBBBF";
277
 
#EOF
278
 
#--exec $MYSQL < $MYSQLTEST_VARDIR/tmp/bug29323.sql 2>&1
279
 
#remove_file $MYSQLTEST_VARDIR/tmp/bug29323.sql;
280
 
 
281
 
--echo End of 5.0 tests
282
 
 
283
 
#
284
 
# Bug#26780: patch to add auto vertical output option to the cli.
285
 
#
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;"
288
 
# Too short to wrap.
289
 
--exec $MYSQL test --auto-vertical-output --table -e "SELECT 1;"
290
 
 
291
 
--echo End of tests