~ubuntu-branches/ubuntu/trusty/drizzle/trusty

« back to all changes in this revision

Viewing changes to tests/r/pbxt/information_schema.result

  • Committer: Bazaar Package Importer
  • Author(s): Monty Taylor
  • Date: 2010-10-02 14:17:48 UTC
  • mfrom: (1.1.1 upstream)
  • mto: (2.1.17 sid)
  • mto: This revision was merged to the branch mainline in revision 3.
  • Revision ID: james.westby@ubuntu.com-20101002141748-m6vbfbfjhrw1153e
Tags: 2010.09.1802-1
* New upstream release.
* Removed pid-file argument hack.
* Updated GPL-2 address to be new address.
* Directly copy in drizzledump.1 since debian doesn't have sphinx 1.0 yet.
* Link to jquery from libjs-jquery. Add it as a depend.
* Add drizzled.8 symlink to the install files.

Show diffs side-by-side

added added

removed removed

Lines of Context:
 
1
DROP TABLE IF EXISTS t0,t1,t2,t3,t4,t5;
 
2
create database mysqltest;
 
3
create table mysqltest.t1(a int, b VARCHAR(30), KEY string_data (b));
 
4
create table test.t2(a int);
 
5
create table t3(a int, KEY a_data (a));
 
6
create table mysqltest.t4(a int);
 
7
create table t5 (id int auto_increment primary key);
 
8
insert into t5 values (10);
 
9
select table_name from data_dictionary.tables
 
10
where table_schema = "mysqltest" and table_name like "t%";
 
11
table_name
 
12
t1
 
13
t4
 
14
select * from data_dictionary.indexes where TABLE_SCHEMA = "mysqltest";
 
15
TABLE_SCHEMA    TABLE_NAME      INDEX_NAME      IS_USED_IN_PRIMARY      IS_UNIQUE       IS_NULLABLE     KEY_LENGTH      INDEX_TYPE      INDEX_COMMENT
 
16
mysqltest       t1      string_data     NO      NO      YES     120     UNKNOWN NULL
 
17
show tables like 't%';
 
18
Tables_in_test (t%)
 
19
t2
 
20
t3
 
21
t5
 
22
show table status;
 
23
Session Schema  Name    Type    Engine  Version Rows    Avg_row_length  Table_size      Auto_increment
 
24
#       test    t5      STANDARD        PBXT    #       #       #       #       #
 
25
show columns from t3 like "a%";
 
26
Field   Type    Null    Default Default_is_NULL On_Update
 
27
a       INTEGER YES             YES     
 
28
select * from data_dictionary.columns where table_name="t1"
 
29
and column_name= "a";
 
30
TABLE_SCHEMA    TABLE_NAME      COLUMN_NAME     COLUMN_TYPE     ORDINAL_POSITION        COLUMN_DEFAULT  COLUMN_DEFAULT_IS_NULL  COLUMN_DEFAULT_UPDATE   IS_NULLABLE     IS_INDEXED      IS_USED_IN_PRIMARY      IS_UNIQUE       IS_MULTI        IS_FIRST_IN_MULTI       INDEXES_FOUND_IN        DATA_TYPE       CHARACTER_MAXIMUM_LENGTH        CHARACTER_OCTET_LENGTH  NUMERIC_PRECISION       NUMERIC_SCALE   COLLATION_NAME  COLUMN_COMMENT
 
31
mysqltest       t1      a       INTEGER 0       NULL    YES             YES     NO      NO      NO      NO      NO      0       INTEGER 0       0       0       0               NULL
 
32
select table_name, column_name from data_dictionary.columns 
 
33
where table_schema = 'mysqltest' and table_name = 't1';
 
34
table_name      column_name
 
35
t1      a
 
36
t1      b
 
37
show columns from mysqltest.t1;
 
38
Field   Type    Null    Default Default_is_NULL On_Update
 
39
a       INTEGER YES             YES     
 
40
b       VARCHAR YES             YES     
 
41
drop tables mysqltest.t4, mysqltest.t1, t2, t3, t5;
 
42
drop database mysqltest;
 
43
select column_type from data_dictionary.columns
 
44
where table_schema="data_dictionary" and table_name="COLUMNS" and
 
45
(column_name="character_set_name" or column_name="collation_name");
 
46
column_type
 
47
VARCHAR
 
48
select count(*) from data_dictionary.tables where 
 
49
table_schema="data_dictionary" and table_name="COLUMNS";
 
50
count(*)
 
51
#
 
52
select count(*) from data_dictionary.tables
 
53
where table_schema="mysql" and table_name="user";
 
54
count(*)
 
55
#
 
56
select table_schema, table_name, column_name from data_dictionary.columns where data_type = 'longtext';
 
57
table_schema    table_name      column_name
 
58
select table_name, column_name, data_type from data_dictionary.columns where data_type = 'datetime';
 
59
table_name      column_name     data_type
 
60
SELECT COUNT(*) FROM data_dictionary.tables A
 
61
WHERE NOT EXISTS 
 
62
(SELECT * FROM data_dictionary.columns B
 
63
WHERE A.TABLE_SCHEMA = B.TABLE_SCHEMA
 
64
AND A.TABLE_NAME = B.TABLE_NAME);
 
65
COUNT(*)
 
66
0
 
67
create table t1
 
68
( x_bigint BIGINT,
 
69
x_integer INTEGER,
 
70
x_int int,
 
71
x_decimal DECIMAL(5,3),
 
72
x_numeric NUMERIC(5,3),
 
73
x_real REAL,
 
74
x_float FLOAT,
 
75
x_double_precision DOUBLE PRECISION );
 
76
SELECT COLUMN_NAME, CHARACTER_MAXIMUM_LENGTH, CHARACTER_OCTET_LENGTH
 
77
FROM data_dictionary.columns
 
78
WHERE TABLE_NAME= 't1';
 
79
COLUMN_NAME     CHARACTER_MAXIMUM_LENGTH        CHARACTER_OCTET_LENGTH
 
80
x_bigint        0       0
 
81
x_decimal       0       0
 
82
x_double_precision      0       0
 
83
x_float 0       0
 
84
x_int   0       0
 
85
x_integer       0       0
 
86
x_numeric       0       0
 
87
x_real  0       0
 
88
drop table t1;
 
89
SELECT table_schema, count(*) FROM data_dictionary.tables
 
90
WHERE table_name NOT LIKE 'ndb_%' AND 
 
91
table_name NOT LIKE 'falcon%'
 
92
GROUP BY TABLE_SCHEMA ORDER BY table_schema;
 
93
table_schema    count(*)
 
94
DATA_DICTIONARY 42
 
95
INFORMATION_SCHEMA      20
 
96
create table t1(f1 LONGBLOB, f2 LONGTEXT);
 
97
select column_name,data_type,CHARACTER_OCTET_LENGTH,
 
98
CHARACTER_MAXIMUM_LENGTH
 
99
from data_dictionary.columns
 
100
where table_name='t1';
 
101
column_name     data_type       CHARACTER_OCTET_LENGTH  CHARACTER_MAXIMUM_LENGTH
 
102
f1      BLOB    0       0
 
103
f2      BLOB    0       0
 
104
drop table t1;
 
105
create table t1(f1 int, f2 int, f3 BIGINT, f4 int,
 
106
f5 BIGINT, f6 int, f7 int);
 
107
select column_name, NUMERIC_PRECISION, NUMERIC_SCALE
 
108
from data_dictionary.columns
 
109
where table_name='t1';
 
110
column_name     NUMERIC_PRECISION       NUMERIC_SCALE
 
111
f1      0       0
 
112
f2      0       0
 
113
f3      0       0
 
114
f4      0       0
 
115
f5      0       0
 
116
f6      0       0
 
117
f7      0       0
 
118
drop table t1;
 
119
create table t1 (a int not null, b int);
 
120
select column_name, column_default from data_dictionary.columns
 
121
where table_schema='test' and table_name='t1';
 
122
column_name     column_default
 
123
a       NULL
 
124
b       NULL
 
125
use test;
 
126
show columns from t1;
 
127
Field   Type    Null    Default Default_is_NULL On_Update
 
128
a       INTEGER NO              NO      
 
129
b       INTEGER YES             YES     
 
130
drop table t1;
 
131
use test;
 
132
create table t1(id int);
 
133
insert into t1(id) values (1);
 
134
select 1 from (select 1 from test.t1) a;
 
135
1
 
136
1
 
137
use data_dictionary;
 
138
select 1 from (select 1 from test.t1) a;
 
139
1
 
140
1
 
141
use test;
 
142
drop table t1;
 
143
create table t1(f1 varbinary(32), f2 varbinary(64));
 
144
select character_maximum_length, character_octet_length
 
145
from data_dictionary.columns where table_name='t1';
 
146
character_maximum_length        character_octet_length
 
147
32      128
 
148
64      256
 
149
drop table t1;
 
150
select column_type, group_concat(table_schema, '.', table_name), count(*) as num
 
151
from data_dictionary.columns where
 
152
table_schema='data_dictionary' and
 
153
(column_type = 'varchar(7)' or column_type = 'varchar(20)'
 
154
 or column_type = 'varchar(27)')
 
155
group by column_type order by column_type, num;
 
156
column_type     group_concat(table_schema, '.', table_name)     num
 
157
create table t1(f1 char(1) not null, f2 char(9) not null);
 
158
select CHARACTER_MAXIMUM_LENGTH, CHARACTER_OCTET_LENGTH from
 
159
data_dictionary.columns where table_schema='test' and table_name = 't1';
 
160
CHARACTER_MAXIMUM_LENGTH        CHARACTER_OCTET_LENGTH
 
161
1       4
 
162
9       36
 
163
drop table t1;
 
164
set @a:= '.';
 
165
create table t1(f1 char(5));
 
166
create table t2(f1 char(5));
 
167
select concat(@a, table_name), @a, table_name
 
168
from data_dictionary.tables where table_schema = 'test';
 
169
concat(@a, table_name)  @a      table_name
 
170
.t1     .       t1
 
171
.t2     .       t2
 
172
drop table t1,t2;
 
173
SELECT t.table_name, c1.column_name
 
174
FROM data_dictionary.tables t
 
175
INNER JOIN
 
176
data_dictionary.columns c1
 
177
ON t.table_schema = c1.table_schema AND
 
178
t.table_name = c1.table_name
 
179
WHERE t.table_schema = 'data_dictionary' AND
 
180
c1.ordinal_position =
 
181
( SELECT COALESCE(MIN(c2.ordinal_position),1)
 
182
FROM data_dictionary.columns c2
 
183
WHERE c2.table_schema = t.table_schema AND
 
184
c2.table_name = t.table_name AND
 
185
c2.column_name LIKE '%SCHEMA%'
 
186
        )
 
187
AND t.table_name NOT LIKE 'falcon%'
 
188
  ORDER BY t.table_name, c1.column_name;
 
189
table_name      column_name
 
190
CHARACTER_SETS  DEFAULT_COLLATE_NAME
 
191
COLLATIONS      COLLATION_NAME
 
192
COLUMNS TABLE_SCHEMA
 
193
CUMULATIVE_SQL_COMMANDS COUNT_SELECT
 
194
CUMULATIVE_USER_STATS   BYTES_RECEIVED
 
195
CURRENT_SQL_COMMANDS    IP
 
196
DRIZZLE_PROTOCOL_STATUS VARIABLE_VALUE
 
197
GLOBAL_STATEMENTS       VARIABLE_VALUE
 
198
GLOBAL_STATUS   VARIABLE_VALUE
 
199
GLOBAL_VARIABLES        VARIABLE_VALUE
 
200
INDEXES TABLE_SCHEMA
 
201
INDEX_PARTS     TABLE_SCHEMA
 
202
INNODB_CMP      COMPRESS_OPS
 
203
INNODB_CMPMEM   PAGES_USED
 
204
INNODB_CMPMEM_RESET     PAGES_USED
 
205
INNODB_CMP_RESET        COMPRESS_OPS
 
206
INNODB_LOCKS    LOCK_TRX_ID
 
207
INNODB_LOCK_WAITS       REQUESTED_LOCK_ID
 
208
INNODB_STATUS   VARIABLE_VALUE
 
209
INNODB_TRX      TRX_STATE
 
210
MODULES MODULE_VERSION
 
211
MYSQL_PROTOCOL_STATUS   VARIABLE_VALUE
 
212
PLUGINS PLUGIN_TYPE
 
213
PROCESSLIST     USER
 
214
REFERENTIAL_CONSTRAINTS CONSTRAINT_SCHEMA
 
215
REPLICATION_STREAMS     APPLIER
 
216
SCHEMAS SCHEMA_NAME
 
217
SCOREBOARD_STATISTICS   NUMBER_OF_RANGE_LOCKS
 
218
SESSION_STATEMENTS      VARIABLE_VALUE
 
219
SESSION_STATUS  VARIABLE_VALUE
 
220
SESSION_VARIABLES       VARIABLE_VALUE
 
221
SHOW_COLUMNS    Type
 
222
SHOW_INDEXES    Unique
 
223
SHOW_SCHEMAS    SCHEMA_NAME
 
224
SHOW_TABLE_STATUS       Schema
 
225
SHOW_TEMPORARY_TABLES   TABLE_SCHEMA
 
226
TABLES  TABLE_SCHEMA
 
227
TABLE_CACHE     TABLE_SCHEMA
 
228
TABLE_CONSTRAINTS       CONSTRAINT_SCHEMA
 
229
TABLE_DEFINITION_CACHE  TABLE_SCHEMA
 
230
SELECT t.table_name, c1.column_name
 
231
FROM data_dictionary.tables t
 
232
INNER JOIN
 
233
data_dictionary.columns c1
 
234
ON t.table_schema = c1.table_schema AND
 
235
t.table_name = c1.table_name
 
236
WHERE t.table_schema = 'data_dictionary' AND
 
237
c1.ordinal_position =
 
238
( SELECT COALESCE(MIN(c2.ordinal_position),1)
 
239
FROM data_dictionary.columns c2
 
240
WHERE c2.table_schema = 'data_dictionary' AND
 
241
c2.table_name = t.table_name AND
 
242
c2.column_name LIKE '%SCHEMA%'
 
243
        )
 
244
AND t.table_name NOT LIKE 'falcon%'
 
245
  ORDER BY t.table_name, c1.column_name;
 
246
table_name      column_name
 
247
CHARACTER_SETS  DEFAULT_COLLATE_NAME
 
248
COLLATIONS      COLLATION_NAME
 
249
COLUMNS TABLE_SCHEMA
 
250
CUMULATIVE_SQL_COMMANDS COUNT_SELECT
 
251
CUMULATIVE_USER_STATS   BYTES_RECEIVED
 
252
CURRENT_SQL_COMMANDS    IP
 
253
DRIZZLE_PROTOCOL_STATUS VARIABLE_VALUE
 
254
GLOBAL_STATEMENTS       VARIABLE_VALUE
 
255
GLOBAL_STATUS   VARIABLE_VALUE
 
256
GLOBAL_VARIABLES        VARIABLE_VALUE
 
257
INDEXES TABLE_SCHEMA
 
258
INDEX_PARTS     TABLE_SCHEMA
 
259
INNODB_CMP      COMPRESS_OPS
 
260
INNODB_CMPMEM   PAGES_USED
 
261
INNODB_CMPMEM_RESET     PAGES_USED
 
262
INNODB_CMP_RESET        COMPRESS_OPS
 
263
INNODB_LOCKS    LOCK_TRX_ID
 
264
INNODB_LOCK_WAITS       REQUESTED_LOCK_ID
 
265
INNODB_STATUS   VARIABLE_VALUE
 
266
INNODB_TRX      TRX_STATE
 
267
MODULES MODULE_VERSION
 
268
MYSQL_PROTOCOL_STATUS   VARIABLE_VALUE
 
269
PLUGINS PLUGIN_TYPE
 
270
PROCESSLIST     USER
 
271
REFERENTIAL_CONSTRAINTS CONSTRAINT_SCHEMA
 
272
REPLICATION_STREAMS     APPLIER
 
273
SCHEMAS SCHEMA_NAME
 
274
SCOREBOARD_STATISTICS   NUMBER_OF_RANGE_LOCKS
 
275
SESSION_STATEMENTS      VARIABLE_VALUE
 
276
SESSION_STATUS  VARIABLE_VALUE
 
277
SESSION_VARIABLES       VARIABLE_VALUE
 
278
SHOW_COLUMNS    Type
 
279
SHOW_INDEXES    Unique
 
280
SHOW_SCHEMAS    SCHEMA_NAME
 
281
SHOW_TABLE_STATUS       Schema
 
282
SHOW_TEMPORARY_TABLES   TABLE_SCHEMA
 
283
TABLES  TABLE_SCHEMA
 
284
TABLE_CACHE     TABLE_SCHEMA
 
285
TABLE_CONSTRAINTS       CONSTRAINT_SCHEMA
 
286
TABLE_DEFINITION_CACHE  TABLE_SCHEMA
 
287
SELECT MAX(table_name) FROM data_dictionary.tables;
 
288
MAX(table_name)
 
289
VIEW_TABLE_USAGE
 
290
SELECT table_name from data_dictionary.tables
 
291
WHERE table_name=(SELECT MAX(table_name)
 
292
FROM data_dictionary.tables)
 
293
ORDER BY table_name;
 
294
table_name
 
295
VIEW_TABLE_USAGE
 
296
create table t1 (f1 int);
 
297
create table t2 (f1 int, f2 int);
 
298
drop table t1,t2;
 
299
select 1 as f1 from data_dictionary.tables  where "CHARACTER_SETS"=
 
300
(select cast(table_name as char)  from data_dictionary.tables
 
301
order by table_name limit 1) limit 1;
 
302
f1
 
303
1
 
304
select t.table_name, group_concat(t.table_schema, '.', t.table_name),
 
305
count(*) as num1
 
306
from data_dictionary.tables t
 
307
inner join data_dictionary.columns c1
 
308
on t.table_schema = c1.table_schema AND t.table_name = c1.table_name
 
309
where t.table_schema = 'data_dictionary' AND
 
310
t.table_name not like 'falcon%' AND
 
311
c1.ordinal_position =
 
312
(select isnull(c2.column_type) -
 
313
isnull(group_concat(c2.table_schema, '.', c2.table_name)) +
 
314
count(*) as num
 
315
from data_dictionary.columns c2 where
 
316
c2.table_schema='data_dictionary' and
 
317
(c2.column_type = 'varchar(7)' or c2.column_type = 'varchar(20)')
 
318
group by c2.column_type order by num limit 1)
 
319
group by t.table_name order by num1, t.table_name;
 
320
table_name      group_concat(t.table_schema, '.', t.table_name) num1
 
321
alter database;
 
322
ERROR 42000: You have an error in your SQL syntax; check the manual that corresponds to your Drizzle server version for the right syntax to use near '' at line 1
 
323
alter database test;
 
324
ERROR 42000: You have an error in your SQL syntax; check the manual that corresponds to your Drizzle server version for the right syntax to use near '' at line 1
 
325
create table t1 (
 
326
f1 varchar(50),
 
327
f2 varchar(50) not null,
 
328
f3 varchar(50) default '',
 
329
f4 varchar(50) default NULL,
 
330
f5 bigint not null,
 
331
f6 bigint not null default 10,
 
332
f7 datetime not null,
 
333
f8 datetime default '2006-01-01'
 
334
);
 
335
show columns from t1;
 
336
Field   Type    Null    Default Default_is_NULL On_Update
 
337
f1      VARCHAR YES             YES     
 
338
f2      VARCHAR NO              NO      
 
339
f3      VARCHAR YES             NO      
 
340
f4      VARCHAR YES             YES     
 
341
f5      BIGINT  NO              NO      
 
342
f6      BIGINT  NO      10      NO      
 
343
f7      DATETIME        NO              NO      
 
344
f8      DATETIME        YES     2006-01-01 00:00:00     NO      
 
345
drop table t1;
 
346
SET max_heap_table_size = DEFAULT;
 
347
USE test;
 
348
End of 5.0 tests.
 
349
SELECT SCHEMA_NAME FROM data_dictionary.schemas
 
350
WHERE SCHEMA_NAME ='data_dictionary';
 
351
SCHEMA_NAME
 
352
data_dictionary
 
353
SELECT TABLE_COLLATION FROM data_dictionary.tables
 
354
WHERE TABLE_SCHEMA='mysql' and TABLE_NAME= 'db';
 
355
TABLE_COLLATION
 
356
#
 
357
# Test that the query is visible to self and others.
 
358
#
 
359
SELECT info FROM data_dictionary.processlist WHERE id = CONNECTION_ID();
 
360
info
 
361
SELECT info FROM data_dictionary.processlist WHERE id = CONNECTION_ID()
 
362
SELECT info, command, db
 
363
FROM data_dictionary.processlist
 
364
WHERE id = CONNECTION_ID();
 
365
info    command db
 
366
FROM data_dictionary.processlist
 
367
SELECT info, command, db
 
368
WHERE id = CONNECTION_ID()      Query   test