~drizzle-trunk/drizzle/development

« back to all changes in this revision

Viewing changes to tests/t/randgen_queries.test

  • Committer: Monty Taylor
  • Date: 2010-03-11 18:27:20 UTC
  • mfrom: (1333 staging)
  • mto: This revision was merged to the branch mainline in revision 1348.
  • Revision ID: mordred@inaugust.com-20100311182720-hd1h87y6cb1b1mp0
Merged trunk.

Show diffs side-by-side

added added

removed removed

Lines of Context:
 
1
--disable_warnings
 
2
drop table if exists t1;
 
3
--enable_warnings
 
4
 
 
5
# execute all the queries that randgen uses to setup and run its tests
 
6
--replace_column 2 ####.##.####
 
7
show variables like 'version';
 
8
--replace_column 1 ####.##.####
 
9
select version();
 
10
select database();
 
11
 
 
12
CREATE TABLE `t1` (
 
13
`col_bigint` bigint,
 
14
`col_text` text,
 
15
`col_char` char (1),
 
16
`col_enum` enum ('a','b','c','d','e','f','g','h','i','j','k','l','m','n','o','p','q','r','s','t','u','v','w','x','y','z'),
 
17
`col_int` int,
 
18
`col_char_not_null` char (1) not null,
 
19
`col_int_not_null_key` int not null,
 
20
`col_text_not_null` text not null,
 
21
`col_enum_not_null_key` enum ('a','b','c','d','e','f','g','h','i','j','k','l','m','n','o','p','q','r','s','t','u','v','w','x','y','z') not null,
 
22
`col_int_key` int,
 
23
`col_char_key` char (1),
 
24
`col_enum_not_null` enum ('a','b','c','d','e','f','g','h','i','j','k','l','m','n','o','p','q','r','s','t','u','v','w','x','y','z') not null,
 
25
`col_text_not_null_key` text not null,
 
26
pk integer auto_increment,
 
27
`col_bigint_key` bigint,
 
28
`col_int_not_null` int not null,
 
29
`col_bigint_not_null` bigint not null,
 
30
`col_bigint_not_null_key` bigint not null,
 
31
`col_char_not_null_key` char (1) not null,
 
32
`col_text_key` text,
 
33
`col_enum_key` enum ('a','b','c','d','e','f','g','h','i','j','k','l','m','n','o','p','q','r','s','t','u','v','w','x','y','z'),
 
34
/*Indices*/
 
35
key (`col_int_not_null_key` ),
 
36
key (`col_enum_not_null_key` ),
 
37
key (`col_int_key` ),
 
38
key (`col_char_key` ),
 
39
key (`col_text_not_null_key`  (255)),
 
40
primary key (pk),
 
41
key (`col_bigint_key` ),
 
42
key (`col_bigint_not_null_key` ),
 
43
key (`col_char_not_null_key` ),
 
44
key (`col_text_key`  (255)),
 
45
key (`col_enum_key` )) ENGINE=innodb;
 
46
set AUTOCOMMIT=OFF;
 
47
 
 
48
# Obviously, FUNCTION does not always means VIEW.
 
49
#
 
50
select table_schema, 
 
51
       table_name, 
 
52
       'STANDARD',
 
53
#       CASE WHEN table_type = 'STANDARD' THEN 'table' 
 
54
#            WHEN table_type = 'VIEW' THEN 'view' 
 
55
#            WHEN table_type = 'FUNCTION' then 'view' 
 
56
#       ELSE 'misc' END, 
 
57
       column_name,
 
58
       CASE WHEN IS_USED_IN_PRIMARY = 'TRUE' THEN 'primary' 
 
59
      #      WHEN column_key = 'MUL' THEN 'indexed' 
 
60
      #      WHEN column_key = 'UNI' THEN 'indexed' 
 
61
       ELSE 'indexed' END 
 
62
FROM data_dictionary.index_parts;
 
63
 
 
64
select AVG(`col_int_key`) + AVG(`col_int`) AS average1,
 
65
                        (SUM(`col_int_key`) + SUM(`col_int`)) / COUNT(*) AS average2,
 
66
                        COUNT(*) AS count FROM t1;
 
67
 
 
68
select collation_name,character_set_name FROM data_dictionary.collations;
 
69
select COUNT(*) from data_dictionary.tables;