~drizzle-trunk/drizzle/development

1273.13.32 by Brian Aker
Big ole patch. This covers moving information_schema to old_* table names
1
# Test for data_dictionary.schemas &
1 by brian
clean slate
2
# show databases
3
4
--disable_warnings
5
DROP TABLE IF EXISTS t0,t1,t2,t3,t4,t5;
6
--enable_warnings
7
1273.13.41 by Brian Aker
Updating from additional schemas added.
8
# Test for data_dictionary.tables &
1 by brian
clean slate
9
# show tables
10
11
create database mysqltest;
12
create table mysqltest.t1(a int, b VARCHAR(30), KEY string_data (b));
13
create table test.t2(a int);
14
create table t3(a int, KEY a_data (a));
15
create table mysqltest.t4(a int);
16
create table t5 (id int auto_increment primary key);
17
insert into t5 values (10);
18
1643.3.13 by Brian Aker
Remove sort() and add in DEBUG mode to randomize the results of generators.
19
--sorted_result
1273.13.41 by Brian Aker
Updating from additional schemas added.
20
select table_name from data_dictionary.tables
1 by brian
clean slate
21
where table_schema = "mysqltest" and table_name like "t%";
22
1273.19.6 by Brian Aker
This remove the original info_schema system for the server. More still to
23
select * from data_dictionary.indexes where TABLE_SCHEMA = "mysqltest";
1 by brian
clean slate
24
25
show tables like 't%';
1320.1.18 by Brian Aker
Overhaul of SHOW TABLE STATUS.
26
--replace_column 1 #  6 # 7 # 8 # 9 # 10 #
27
show table status;
1273.13.37 by Brian Aker
Remove "full" syntax.
28
show columns from t3 like "a%";
1643.3.13 by Brian Aker
Remove sort() and add in DEBUG mode to randomize the results of generators.
29
--sorted_result
1273.19.5 by Brian Aker
Remove the old columns I_S table.
30
select * from data_dictionary.columns where table_name="t1"
1 by brian
clean slate
31
and column_name= "a";
32
33
connect (user3,localhost,mysqltest_2,,);
34
connection user3;
1643.3.13 by Brian Aker
Remove sort() and add in DEBUG mode to randomize the results of generators.
35
--sorted_result
1273.19.5 by Brian Aker
Remove the old columns I_S table.
36
select table_name, column_name from data_dictionary.columns 
1 by brian
clean slate
37
where table_schema = 'mysqltest' and table_name = 't1';
38
show columns from mysqltest.t1;
39
connect (user4,localhost,mysqltest_3,,mysqltest);
40
connection user4;
41
connection default;
42
43
drop tables mysqltest.t4, mysqltest.t1, t2, t3, t5;
44
drop database mysqltest;
45
46
#
47
# Bug#2719 information_schema: errors in "columns"
48
#
1643.3.13 by Brian Aker
Remove sort() and add in DEBUG mode to randomize the results of generators.
49
--sorted_result
1273.19.5 by Brian Aker
Remove the old columns I_S table.
50
select column_type from data_dictionary.columns
1273.19.6 by Brian Aker
This remove the original info_schema system for the server. More still to
51
where table_schema="data_dictionary" and table_name="COLUMNS" and
1 by brian
clean slate
52
(column_name="character_set_name" or column_name="collation_name");
53
54
#
55
# Bug#2718 information_schema: errors in "tables"
56
#
1273.13.41 by Brian Aker
Updating from additional schemas added.
57
--replace_column 1 #
1643.3.13 by Brian Aker
Remove sort() and add in DEBUG mode to randomize the results of generators.
58
--sorted_result
1273.13.41 by Brian Aker
Updating from additional schemas added.
59
select count(*) from data_dictionary.tables where 
1273.19.6 by Brian Aker
This remove the original info_schema system for the server. More still to
60
table_schema="data_dictionary" and table_name="COLUMNS";
1273.13.41 by Brian Aker
Updating from additional schemas added.
61
62
--replace_column 1 #
1643.3.13 by Brian Aker
Remove sort() and add in DEBUG mode to randomize the results of generators.
63
--sorted_result
1273.13.41 by Brian Aker
Updating from additional schemas added.
64
select count(*) from data_dictionary.tables
1 by brian
clean slate
65
where table_schema="mysql" and table_name="user";
66
67
#
68
# Bug #7215  information_schema: columns are longtext instead of varchar
69
# Bug #7217  information_schema: columns are varbinary() instead of timestamp
70
#
1643.3.13 by Brian Aker
Remove sort() and add in DEBUG mode to randomize the results of generators.
71
--sorted_result
1273.13.41 by Brian Aker
Updating from additional schemas added.
72
select table_schema, table_name, column_name from data_dictionary.columns where data_type = 'longtext';
1643.3.13 by Brian Aker
Remove sort() and add in DEBUG mode to randomize the results of generators.
73
--sorted_result
1273.13.41 by Brian Aker
Updating from additional schemas added.
74
select table_name, column_name, data_type from data_dictionary.columns where data_type = 'datetime';
1 by brian
clean slate
75
76
#
1273.13.41 by Brian Aker
Updating from additional schemas added.
77
# Bug #8164  subquery with data_dictionary.COLUMNS, 100 % CPU
1 by brian
clean slate
78
#
1643.3.13 by Brian Aker
Remove sort() and add in DEBUG mode to randomize the results of generators.
79
--sorted_result
1273.13.41 by Brian Aker
Updating from additional schemas added.
80
SELECT COUNT(*) FROM data_dictionary.tables A
1 by brian
clean slate
81
WHERE NOT EXISTS 
1273.13.41 by Brian Aker
Updating from additional schemas added.
82
(SELECT * FROM data_dictionary.columns B
1 by brian
clean slate
83
  WHERE A.TABLE_SCHEMA = B.TABLE_SCHEMA
84
  AND A.TABLE_NAME = B.TABLE_NAME);
85
86
#
87
# Bug #9344  INFORMATION_SCHEMA, wrong content, numeric columns
88
#
89
90
create table t1
91
( x_bigint BIGINT,
92
  x_integer INTEGER,
396 by Brian Aker
Cleanup tiny and small int.
93
  x_int int,
1 by brian
clean slate
94
  x_decimal DECIMAL(5,3),
95
  x_numeric NUMERIC(5,3),
96
  x_real REAL,
97
  x_float FLOAT,
98
  x_double_precision DOUBLE PRECISION );
1643.3.13 by Brian Aker
Remove sort() and add in DEBUG mode to randomize the results of generators.
99
--sorted_result
1 by brian
clean slate
100
SELECT COLUMN_NAME, CHARACTER_MAXIMUM_LENGTH, CHARACTER_OCTET_LENGTH
1273.13.41 by Brian Aker
Updating from additional schemas added.
101
FROM data_dictionary.columns
1 by brian
clean slate
102
WHERE TABLE_NAME= 't1';
103
drop table t1;
104
105
#
106
# Bug #9404  information_schema: Weird error messages
107
# with SELECT SUM() ... GROUP BY queries
108
#
1273.13.41 by Brian Aker
Updating from additional schemas added.
109
SELECT table_schema, count(*) FROM data_dictionary.tables
1144.5.10 by Padraig O'Sullivan
Updated the information_schema test so that we do not include the memcached
110
WHERE table_name NOT LIKE 'ndb_%' AND 
1273.13.41 by Brian Aker
Updating from additional schemas added.
111
table_name NOT LIKE 'falcon%'
1273.13.60 by Brian Aker
Merge with trunk.
112
GROUP BY TABLE_SCHEMA ORDER BY table_schema;
1 by brian
clean slate
113
114
#
115
# Bug #11057 information_schema: columns table has some questionable contents
116
# Bug #12301 information_schema: NUMERIC_SCALE must be 0 for integer columns
117
#
118
create table t1(f1 LONGBLOB, f2 LONGTEXT);
1643.3.13 by Brian Aker
Remove sort() and add in DEBUG mode to randomize the results of generators.
119
--sorted_result
1 by brian
clean slate
120
select column_name,data_type,CHARACTER_OCTET_LENGTH,
121
       CHARACTER_MAXIMUM_LENGTH
1273.19.5 by Brian Aker
Remove the old columns I_S table.
122
from data_dictionary.columns
1 by brian
clean slate
123
where table_name='t1';
124
drop table t1;
396 by Brian Aker
Cleanup tiny and small int.
125
create table t1(f1 int, f2 int, f3 BIGINT, f4 int,
126
                f5 BIGINT, f6 int, f7 int);
1643.3.13 by Brian Aker
Remove sort() and add in DEBUG mode to randomize the results of generators.
127
--sorted_result
1 by brian
clean slate
128
select column_name, NUMERIC_PRECISION, NUMERIC_SCALE
1273.19.5 by Brian Aker
Remove the old columns I_S table.
129
from data_dictionary.columns
1 by brian
clean slate
130
where table_name='t1';
131
drop table t1;
132
133
#
134
# Bug#12518 COLUMN_DEFAULT has wrong value if NOT NULL is set
135
#
136
create table t1 (a int not null, b int);
1643.3.13 by Brian Aker
Remove sort() and add in DEBUG mode to randomize the results of generators.
137
--sorted_result
1273.19.5 by Brian Aker
Remove the old columns I_S table.
138
select column_name, column_default from data_dictionary.columns
1 by brian
clean slate
139
  where table_schema='test' and table_name='t1';
140
use test;
141
show columns from t1;
142
drop table t1;
143
144
#
145
#
146
# Bug#14089 FROM list subquery always fails when information_schema is current database
147
#
148
use test;
149
create table t1(id int);
150
insert into t1(id) values (1);
1643.3.13 by Brian Aker
Remove sort() and add in DEBUG mode to randomize the results of generators.
151
--sorted_result
1 by brian
clean slate
152
select 1 from (select 1 from test.t1) a;
1273.19.6 by Brian Aker
This remove the original info_schema system for the server. More still to
153
use data_dictionary;
1643.3.13 by Brian Aker
Remove sort() and add in DEBUG mode to randomize the results of generators.
154
--sorted_result
1 by brian
clean slate
155
select 1 from (select 1 from test.t1) a;
156
use test;
157
drop table t1;
158
159
#
160
# Bug#14271 I_S: columns has no size for (var)binary columns
161
#
233 by Brian Aker
Fix to remove binary/nchar
162
create table t1(f1 varbinary(32), f2 varbinary(64));
1643.3.13 by Brian Aker
Remove sort() and add in DEBUG mode to randomize the results of generators.
163
--sorted_result
1 by brian
clean slate
164
select character_maximum_length, character_octet_length
1273.19.5 by Brian Aker
Remove the old columns I_S table.
165
from data_dictionary.columns where table_name='t1';
1 by brian
clean slate
166
drop table t1;
167
1273.13.72 by Brian Aker
1) Reduced the size of VARIABLE_VALUE.
168
##
169
## Bug#15307 GROUP_CONCAT() with ORDER BY returns empty set on information_schema
170
##
1 by brian
clean slate
171
select column_type, group_concat(table_schema, '.', table_name), count(*) as num
1273.19.5 by Brian Aker
Remove the old columns I_S table.
172
from data_dictionary.columns where
1273.19.6 by Brian Aker
This remove the original info_schema system for the server. More still to
173
table_schema='data_dictionary' and
1 by brian
clean slate
174
(column_type = 'varchar(7)' or column_type = 'varchar(20)'
175
 or column_type = 'varchar(27)')
1225.1.33 by Padraig O'Sullivan
Added an extra column to the ORDER BY clause for one of the larger queries in the I_S test case in
176
group by column_type order by column_type, num;
1 by brian
clean slate
177
178
#
179
# Bug#19236 bad COLUMNS.CHARACTER_MAXIMUM_LENGHT and CHARACTER_OCTET_LENGTH
180
#
377.1.4 by Brian Aker
Big, fat, UTF-8 patch. This fixes some of the oddities around only one
181
create table t1(f1 char(1) not null, f2 char(9) not null);
1643.3.13 by Brian Aker
Remove sort() and add in DEBUG mode to randomize the results of generators.
182
--sorted_result
1 by brian
clean slate
183
select CHARACTER_MAXIMUM_LENGTH, CHARACTER_OCTET_LENGTH from
1273.19.5 by Brian Aker
Remove the old columns I_S table.
184
data_dictionary.columns where table_schema='test' and table_name = 't1';
1 by brian
clean slate
185
drop table t1;
186
187
#
188
# Bug#19599 duplication of information_schema column value in a CONCAT expr with user var
189
#
190
set @a:= '.';
191
create table t1(f1 char(5));
192
create table t2(f1 char(5));
1643.3.13 by Brian Aker
Remove sort() and add in DEBUG mode to randomize the results of generators.
193
--sorted_result
1 by brian
clean slate
194
select concat(@a, table_name), @a, table_name
1273.13.41 by Brian Aker
Updating from additional schemas added.
195
from data_dictionary.tables where table_schema = 'test';
1 by brian
clean slate
196
drop table t1,t2;
197
198
#
199
# Bug#18925: subqueries with MIN/MAX functions on INFORMARTION_SCHEMA 
200
#
201
202
SELECT t.table_name, c1.column_name
1273.13.41 by Brian Aker
Updating from additional schemas added.
203
  FROM data_dictionary.tables t
1 by brian
clean slate
204
       INNER JOIN
1273.19.5 by Brian Aker
Remove the old columns I_S table.
205
       data_dictionary.columns c1
1 by brian
clean slate
206
       ON t.table_schema = c1.table_schema AND
207
          t.table_name = c1.table_name
1273.19.6 by Brian Aker
This remove the original info_schema system for the server. More still to
208
  WHERE t.table_schema = 'data_dictionary' AND
1 by brian
clean slate
209
        c1.ordinal_position =
210
        ( SELECT COALESCE(MIN(c2.ordinal_position),1)
1273.19.5 by Brian Aker
Remove the old columns I_S table.
211
            FROM data_dictionary.columns c2
1 by brian
clean slate
212
            WHERE c2.table_schema = t.table_schema AND
213
                  c2.table_name = t.table_name AND
214
                  c2.column_name LIKE '%SCHEMA%'
215
        )
1273.13.60 by Brian Aker
Merge with trunk.
216
  AND t.table_name NOT LIKE 'falcon%'
217
  ORDER BY t.table_name, c1.column_name;
218
1 by brian
clean slate
219
SELECT t.table_name, c1.column_name
1273.13.41 by Brian Aker
Updating from additional schemas added.
220
  FROM data_dictionary.tables t
1 by brian
clean slate
221
       INNER JOIN
1273.19.5 by Brian Aker
Remove the old columns I_S table.
222
       data_dictionary.columns c1
1 by brian
clean slate
223
       ON t.table_schema = c1.table_schema AND
224
          t.table_name = c1.table_name
1273.19.6 by Brian Aker
This remove the original info_schema system for the server. More still to
225
  WHERE t.table_schema = 'data_dictionary' AND
1 by brian
clean slate
226
        c1.ordinal_position =
227
        ( SELECT COALESCE(MIN(c2.ordinal_position),1)
1273.19.5 by Brian Aker
Remove the old columns I_S table.
228
            FROM data_dictionary.columns c2
1273.19.6 by Brian Aker
This remove the original info_schema system for the server. More still to
229
            WHERE c2.table_schema = 'data_dictionary' AND
1 by brian
clean slate
230
                  c2.table_name = t.table_name AND
231
                  c2.column_name LIKE '%SCHEMA%'
232
        )
1273.13.60 by Brian Aker
Merge with trunk.
233
  AND t.table_name NOT LIKE 'falcon%'
234
  ORDER BY t.table_name, c1.column_name;
1 by brian
clean slate
235
236
#
237
# Bug#21231: query with a simple non-correlated subquery over
238
#            INFORMARTION_SCHEMA.TABLES 
239
#
240
1273.13.41 by Brian Aker
Updating from additional schemas added.
241
SELECT MAX(table_name) FROM data_dictionary.tables;
242
SELECT table_name from data_dictionary.tables
1 by brian
clean slate
243
  WHERE table_name=(SELECT MAX(table_name)
1273.13.60 by Brian Aker
Merge with trunk.
244
                      FROM data_dictionary.tables)
245
  ORDER BY table_name;
1273.13.72 by Brian Aker
1) Reduced the size of VARIABLE_VALUE.
246
1 by brian
clean slate
247
# Bug#23299 Some queries against INFORMATION_SCHEMA with subqueries fail
248
#
223 by Brian Aker
Cleanup int() work.
249
create table t1 (f1 int);
250
create table t2 (f1 int, f2 int);
1 by brian
clean slate
251
1273.13.72 by Brian Aker
1) Reduced the size of VARIABLE_VALUE.
252
#select table_name from data_dictionary.tables
253
#where table_schema = 'test' and table_name not in
1273.19.5 by Brian Aker
Remove the old columns I_S table.
254
#(select table_name from data_dictionary.columns
1273.13.72 by Brian Aker
1) Reduced the size of VARIABLE_VALUE.
255
# where table_schema = 'test' and column_name = 'f3')
256
#ORDER BY table_name;
1273.13.60 by Brian Aker
Merge with trunk.
257
1 by brian
clean slate
258
drop table t1,t2;
259
260
261
#
262
# Bug#24630  Subselect query crashes mysqld
263
#
1643.3.13 by Brian Aker
Remove sort() and add in DEBUG mode to randomize the results of generators.
264
--sorted_result
1273.13.41 by Brian Aker
Updating from additional schemas added.
265
select 1 as f1 from data_dictionary.tables  where "CHARACTER_SETS"=
266
(select cast(table_name as char)  from data_dictionary.tables
1 by brian
clean slate
267
 order by table_name limit 1) limit 1;
268
269
select t.table_name, group_concat(t.table_schema, '.', t.table_name),
270
       count(*) as num1
1273.13.41 by Brian Aker
Updating from additional schemas added.
271
from data_dictionary.tables t
1273.19.5 by Brian Aker
Remove the old columns I_S table.
272
inner join data_dictionary.columns c1
1 by brian
clean slate
273
on t.table_schema = c1.table_schema AND t.table_name = c1.table_name
1273.19.6 by Brian Aker
This remove the original info_schema system for the server. More still to
274
where t.table_schema = 'data_dictionary' AND
1 by brian
clean slate
275
      t.table_name not like 'falcon%' AND
276
        c1.ordinal_position =
277
        (select isnull(c2.column_type) -
278
         isnull(group_concat(c2.table_schema, '.', c2.table_name)) +
279
         count(*) as num
1273.19.5 by Brian Aker
Remove the old columns I_S table.
280
         from data_dictionary.columns c2 where
1273.19.6 by Brian Aker
This remove the original info_schema system for the server. More still to
281
         c2.table_schema='data_dictionary' and
1 by brian
clean slate
282
         (c2.column_type = 'varchar(7)' or c2.column_type = 'varchar(20)')
283
          group by c2.column_type order by num limit 1)
284
group by t.table_name order by num1, t.table_name;
285
286
#
287
# Bug#25859    ALTER DATABASE works w/o parameters
288
#
289
--error ER_PARSE_ERROR
290
alter database;
291
--error ER_PARSE_ERROR
292
alter database test;
293
294
#
295
# Bug#27747 database metadata doesn't return sufficient column default info
296
#
297
create table t1 (
298
  f1 varchar(50),
299
  f2 varchar(50) not null,
300
  f3 varchar(50) default '',
301
  f4 varchar(50) default NULL,
302
  f5 bigint not null,
303
  f6 bigint not null default 10,
304
  f7 datetime not null,
305
  f8 datetime default '2006-01-01'
306
);
1273.19.5 by Brian Aker
Remove the old columns I_S table.
307
#select column_default from data_dictionary.columns where table_name= 't1' ORDER BY column_default;
1 by brian
clean slate
308
show columns from t1;
309
drop table t1;
310
311
SET max_heap_table_size = DEFAULT;
312
USE test;
313
314
--echo End of 5.0 tests.
315
316
#
1273.13.39 by Brian Aker
Remove old schemata plugin.
317
# Bug#30795 Query on data_dictionary.schemas, wrong result
1 by brian
clean slate
318
#
1643.3.13 by Brian Aker
Remove sort() and add in DEBUG mode to randomize the results of generators.
319
--sorted_result
1273.13.39 by Brian Aker
Remove old schemata plugin.
320
SELECT SCHEMA_NAME FROM data_dictionary.schemas
1273.19.6 by Brian Aker
This remove the original info_schema system for the server. More still to
321
WHERE SCHEMA_NAME ='data_dictionary';
1 by brian
clean slate
322
                                                                                                 
323
#
324
# Bug#31381 Error in retrieving Data from INFORMATION_SCHEMA
325
#
1643.3.13 by Brian Aker
Remove sort() and add in DEBUG mode to randomize the results of generators.
326
--sorted_result
1273.13.39 by Brian Aker
Remove old schemata plugin.
327
SELECT TABLE_COLLATION FROM data_dictionary.tables
1 by brian
clean slate
328
WHERE TABLE_SCHEMA='mysql' and TABLE_NAME= 'db';
329
998 by Brian Aker
Patch on show processlist from davi@apache.org
330
--echo #
331
--echo # Test that the query is visible to self and others.
332
--echo #
333
1643.3.13 by Brian Aker
Remove sort() and add in DEBUG mode to randomize the results of generators.
334
--sorted_result
1273.13.35 by Brian Aker
Remove processlist from old I_S.
335
SELECT info FROM data_dictionary.processlist WHERE id = CONNECTION_ID();
1067.2.4 by Padraig O'Sullivan
Updated the I_S test case to perform queries on the PROCESSLIST table. Also
336
337
#
338
# do a query on the PROCESSLIST table in I_S to ensure it works correctly
339
#
1643.3.13 by Brian Aker
Remove sort() and add in DEBUG mode to randomize the results of generators.
340
--sorted_result
1067.2.4 by Padraig O'Sullivan
Updated the I_S test case to perform queries on the PROCESSLIST table. Also
341
SELECT info, command, db
1273.13.35 by Brian Aker
Remove processlist from old I_S.
342
FROM data_dictionary.processlist
1067.2.4 by Padraig O'Sullivan
Updated the I_S test case to perform queries on the PROCESSLIST table. Also
343
WHERE id = CONNECTION_ID();
344
1067.3.2 by Padraig O'Sullivan
Updating the I_S test case to perform a query on the CHARCTER_SET table.
345
#
1081.2.5 by Padraig O'Sullivan
Updated the I_S test case and result file after extracting TABLES into the
346
# query TABLES
347
#
1273.13.72 by Brian Aker
1) Reduced the size of VARIABLE_VALUE.
348
#SELECT table_schema, table_name
349
#FROM data_dictionary.tables
350
#WHERE table_schema="data_dictionary"
351
#ORDER BY table_name;