~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
#
1802.7.2 by Brian Aker
1) Fixed a couple of tests that were still relying on counts of tables in
109
--replace_column 2 #
1273.13.41 by Brian Aker
Updating from additional schemas added.
110
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
111
WHERE table_name NOT LIKE 'ndb_%' AND 
1273.13.41 by Brian Aker
Updating from additional schemas added.
112
table_name NOT LIKE 'falcon%'
1273.13.60 by Brian Aker
Merge with trunk.
113
GROUP BY TABLE_SCHEMA ORDER BY table_schema;
1 by brian
clean slate
114
115
#
116
# Bug #11057 information_schema: columns table has some questionable contents
117
# Bug #12301 information_schema: NUMERIC_SCALE must be 0 for integer columns
118
#
119
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.
120
--sorted_result
1 by brian
clean slate
121
select column_name,data_type,CHARACTER_OCTET_LENGTH,
122
       CHARACTER_MAXIMUM_LENGTH
1273.19.5 by Brian Aker
Remove the old columns I_S table.
123
from data_dictionary.columns
1 by brian
clean slate
124
where table_name='t1';
125
drop table t1;
396 by Brian Aker
Cleanup tiny and small int.
126
create table t1(f1 int, f2 int, f3 BIGINT, f4 int,
127
                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.
128
--sorted_result
1 by brian
clean slate
129
select column_name, NUMERIC_PRECISION, NUMERIC_SCALE
1273.19.5 by Brian Aker
Remove the old columns I_S table.
130
from data_dictionary.columns
1 by brian
clean slate
131
where table_name='t1';
132
drop table t1;
133
134
#
135
# Bug#12518 COLUMN_DEFAULT has wrong value if NOT NULL is set
136
#
137
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.
138
--sorted_result
1273.19.5 by Brian Aker
Remove the old columns I_S table.
139
select column_name, column_default from data_dictionary.columns
1 by brian
clean slate
140
  where table_schema='test' and table_name='t1';
141
use test;
142
show columns from t1;
143
drop table t1;
144
145
#
146
#
147
# Bug#14089 FROM list subquery always fails when information_schema is current database
148
#
149
use test;
150
create table t1(id int);
151
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.
152
--sorted_result
1 by brian
clean slate
153
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
154
use data_dictionary;
1643.3.13 by Brian Aker
Remove sort() and add in DEBUG mode to randomize the results of generators.
155
--sorted_result
1 by brian
clean slate
156
select 1 from (select 1 from test.t1) a;
157
use test;
158
drop table t1;
159
160
#
161
# Bug#14271 I_S: columns has no size for (var)binary columns
162
#
233 by Brian Aker
Fix to remove binary/nchar
163
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.
164
--sorted_result
1 by brian
clean slate
165
select character_maximum_length, character_octet_length
1273.19.5 by Brian Aker
Remove the old columns I_S table.
166
from data_dictionary.columns where table_name='t1';
1 by brian
clean slate
167
drop table t1;
168
1273.13.72 by Brian Aker
1) Reduced the size of VARIABLE_VALUE.
169
##
170
## Bug#15307 GROUP_CONCAT() with ORDER BY returns empty set on information_schema
171
##
1 by brian
clean slate
172
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.
173
from data_dictionary.columns where
1273.19.6 by Brian Aker
This remove the original info_schema system for the server. More still to
174
table_schema='data_dictionary' and
1 by brian
clean slate
175
(column_type = 'varchar(7)' or column_type = 'varchar(20)'
176
 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
177
group by column_type order by column_type, num;
1 by brian
clean slate
178
179
#
180
# Bug#19236 bad COLUMNS.CHARACTER_MAXIMUM_LENGHT and CHARACTER_OCTET_LENGTH
181
#
377.1.4 by Brian Aker
Big, fat, UTF-8 patch. This fixes some of the oddities around only one
182
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.
183
--sorted_result
1 by brian
clean slate
184
select CHARACTER_MAXIMUM_LENGTH, CHARACTER_OCTET_LENGTH from
1273.19.5 by Brian Aker
Remove the old columns I_S table.
185
data_dictionary.columns where table_schema='test' and table_name = 't1';
1 by brian
clean slate
186
drop table t1;
187
188
#
189
# Bug#19599 duplication of information_schema column value in a CONCAT expr with user var
190
#
191
set @a:= '.';
192
create table t1(f1 char(5));
193
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.
194
--sorted_result
1 by brian
clean slate
195
select concat(@a, table_name), @a, table_name
1273.13.41 by Brian Aker
Updating from additional schemas added.
196
from data_dictionary.tables where table_schema = 'test';
1 by brian
clean slate
197
drop table t1,t2;
198
199
#
200
# Bug#18925: subqueries with MIN/MAX functions on INFORMARTION_SCHEMA 
201
#
202
203
SELECT t.table_name, c1.column_name
1273.13.41 by Brian Aker
Updating from additional schemas added.
204
  FROM data_dictionary.tables t
1 by brian
clean slate
205
       INNER JOIN
1273.19.5 by Brian Aker
Remove the old columns I_S table.
206
       data_dictionary.columns c1
1 by brian
clean slate
207
       ON t.table_schema = c1.table_schema AND
208
          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
209
  WHERE t.table_schema = 'data_dictionary' AND
1 by brian
clean slate
210
        c1.ordinal_position =
211
        ( SELECT COALESCE(MIN(c2.ordinal_position),1)
1273.19.5 by Brian Aker
Remove the old columns I_S table.
212
            FROM data_dictionary.columns c2
1 by brian
clean slate
213
            WHERE c2.table_schema = t.table_schema AND
214
                  c2.table_name = t.table_name AND
215
                  c2.column_name LIKE '%SCHEMA%'
216
        )
1273.13.60 by Brian Aker
Merge with trunk.
217
  AND t.table_name NOT LIKE 'falcon%'
218
  ORDER BY t.table_name, c1.column_name;
219
1 by brian
clean slate
220
SELECT t.table_name, c1.column_name
1273.13.41 by Brian Aker
Updating from additional schemas added.
221
  FROM data_dictionary.tables t
1 by brian
clean slate
222
       INNER JOIN
1273.19.5 by Brian Aker
Remove the old columns I_S table.
223
       data_dictionary.columns c1
1 by brian
clean slate
224
       ON t.table_schema = c1.table_schema AND
225
          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
226
  WHERE t.table_schema = 'data_dictionary' AND
1 by brian
clean slate
227
        c1.ordinal_position =
228
        ( SELECT COALESCE(MIN(c2.ordinal_position),1)
1273.19.5 by Brian Aker
Remove the old columns I_S table.
229
            FROM data_dictionary.columns c2
1273.19.6 by Brian Aker
This remove the original info_schema system for the server. More still to
230
            WHERE c2.table_schema = 'data_dictionary' AND
1 by brian
clean slate
231
                  c2.table_name = t.table_name AND
232
                  c2.column_name LIKE '%SCHEMA%'
233
        )
1273.13.60 by Brian Aker
Merge with trunk.
234
  AND t.table_name NOT LIKE 'falcon%'
235
  ORDER BY t.table_name, c1.column_name;
1 by brian
clean slate
236
237
#
238
# Bug#21231: query with a simple non-correlated subquery over
239
#            INFORMARTION_SCHEMA.TABLES 
240
#
241
1273.13.41 by Brian Aker
Updating from additional schemas added.
242
SELECT MAX(table_name) FROM data_dictionary.tables;
243
SELECT table_name from data_dictionary.tables
1 by brian
clean slate
244
  WHERE table_name=(SELECT MAX(table_name)
1273.13.60 by Brian Aker
Merge with trunk.
245
                      FROM data_dictionary.tables)
246
  ORDER BY table_name;
1273.13.72 by Brian Aker
1) Reduced the size of VARIABLE_VALUE.
247
1 by brian
clean slate
248
# Bug#23299 Some queries against INFORMATION_SCHEMA with subqueries fail
249
#
223 by Brian Aker
Cleanup int() work.
250
create table t1 (f1 int);
251
create table t2 (f1 int, f2 int);
1 by brian
clean slate
252
1273.13.72 by Brian Aker
1) Reduced the size of VARIABLE_VALUE.
253
#select table_name from data_dictionary.tables
254
#where table_schema = 'test' and table_name not in
1273.19.5 by Brian Aker
Remove the old columns I_S table.
255
#(select table_name from data_dictionary.columns
1273.13.72 by Brian Aker
1) Reduced the size of VARIABLE_VALUE.
256
# where table_schema = 'test' and column_name = 'f3')
257
#ORDER BY table_name;
1273.13.60 by Brian Aker
Merge with trunk.
258
1 by brian
clean slate
259
drop table t1,t2;
260
261
262
#
263
# Bug#24630  Subselect query crashes mysqld
264
#
1643.3.13 by Brian Aker
Remove sort() and add in DEBUG mode to randomize the results of generators.
265
--sorted_result
1273.13.41 by Brian Aker
Updating from additional schemas added.
266
select 1 as f1 from data_dictionary.tables  where "CHARACTER_SETS"=
2017.3.1 by Brian Aker
Merge catalog with current trunk.
267
(select cast(table_name as char)  from data_dictionary.tables WHERE TABLE_SCHEMA=schema()
268
 AND TABLE_NAME = "CHARACTER_SETS"
269
 order by table_name limit 1) AND TABLE_SCHEMA=schema() limit 1;
1 by brian
clean slate
270
271
select t.table_name, group_concat(t.table_schema, '.', t.table_name),
272
       count(*) as num1
1273.13.41 by Brian Aker
Updating from additional schemas added.
273
from data_dictionary.tables t
1273.19.5 by Brian Aker
Remove the old columns I_S table.
274
inner join data_dictionary.columns c1
1 by brian
clean slate
275
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
276
where t.table_schema = 'data_dictionary' AND
1 by brian
clean slate
277
      t.table_name not like 'falcon%' AND
278
        c1.ordinal_position =
279
        (select isnull(c2.column_type) -
280
         isnull(group_concat(c2.table_schema, '.', c2.table_name)) +
281
         count(*) as num
1273.19.5 by Brian Aker
Remove the old columns I_S table.
282
         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
283
         c2.table_schema='data_dictionary' and
1 by brian
clean slate
284
         (c2.column_type = 'varchar(7)' or c2.column_type = 'varchar(20)')
285
          group by c2.column_type order by num limit 1)
286
group by t.table_name order by num1, t.table_name;
287
288
#
289
# Bug#25859    ALTER DATABASE works w/o parameters
290
#
291
--error ER_PARSE_ERROR
292
alter database;
293
--error ER_PARSE_ERROR
294
alter database test;
295
296
#
297
# Bug#27747 database metadata doesn't return sufficient column default info
298
#
299
create table t1 (
300
  f1 varchar(50),
301
  f2 varchar(50) not null,
302
  f3 varchar(50) default '',
303
  f4 varchar(50) default NULL,
304
  f5 bigint not null,
305
  f6 bigint not null default 10,
306
  f7 datetime not null,
307
  f8 datetime default '2006-01-01'
308
);
1273.19.5 by Brian Aker
Remove the old columns I_S table.
309
#select column_default from data_dictionary.columns where table_name= 't1' ORDER BY column_default;
1 by brian
clean slate
310
show columns from t1;
311
drop table t1;
312
313
SET max_heap_table_size = DEFAULT;
314
USE test;
315
316
--echo End of 5.0 tests.
317
318
#
1273.13.39 by Brian Aker
Remove old schemata plugin.
319
# Bug#30795 Query on data_dictionary.schemas, wrong result
1 by brian
clean slate
320
#
1643.3.13 by Brian Aker
Remove sort() and add in DEBUG mode to randomize the results of generators.
321
--sorted_result
1273.13.39 by Brian Aker
Remove old schemata plugin.
322
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
323
WHERE SCHEMA_NAME ='data_dictionary';
1 by brian
clean slate
324
                                                                                                 
325
#
326
# Bug#31381 Error in retrieving Data from INFORMATION_SCHEMA
327
#
1643.3.13 by Brian Aker
Remove sort() and add in DEBUG mode to randomize the results of generators.
328
--sorted_result
1273.13.39 by Brian Aker
Remove old schemata plugin.
329
SELECT TABLE_COLLATION FROM data_dictionary.tables
1 by brian
clean slate
330
WHERE TABLE_SCHEMA='mysql' and TABLE_NAME= 'db';
331
998 by Brian Aker
Patch on show processlist from davi@apache.org
332
--echo #
333
--echo # Test that the query is visible to self and others.
334
--echo #
335
1643.3.13 by Brian Aker
Remove sort() and add in DEBUG mode to randomize the results of generators.
336
--sorted_result
1273.13.35 by Brian Aker
Remove processlist from old I_S.
337
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
338
339
#
340
# do a query on the PROCESSLIST table in I_S to ensure it works correctly
341
#
1643.3.13 by Brian Aker
Remove sort() and add in DEBUG mode to randomize the results of generators.
342
--sorted_result
1067.2.4 by Padraig O'Sullivan
Updated the I_S test case to perform queries on the PROCESSLIST table. Also
343
SELECT info, command, db
1273.13.35 by Brian Aker
Remove processlist from old I_S.
344
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
345
WHERE id = CONNECTION_ID();
346
1067.3.2 by Padraig O'Sullivan
Updating the I_S test case to perform a query on the CHARCTER_SET table.
347
#
1081.2.5 by Padraig O'Sullivan
Updated the I_S test case and result file after extracting TABLES into the
348
# query TABLES
349
#
1273.13.72 by Brian Aker
1) Reduced the size of VARIABLE_VALUE.
350
#SELECT table_schema, table_name
351
#FROM data_dictionary.tables
352
#WHERE table_schema="data_dictionary"
353
#ORDER BY table_name;