~stewart/drizzle/embedded-innodb-create-select-transaction-arrgh

« back to all changes in this revision

Viewing changes to mysql-test/r/temp_table.result

  • Committer: brian
  • Date: 2008-06-25 05:29:13 UTC
  • Revision ID: brian@localhost.localdomain-20080625052913-6upwo0jsrl4lnapl
clean slate

Show diffs side-by-side

added added

removed removed

Lines of Context:
 
1
drop table if exists t1,t2;
 
2
drop view if exists v1;
 
3
CREATE TABLE t1 (c int not null, d char (10) not null);
 
4
insert into t1 values(1,""),(2,"a"),(3,"b");
 
5
CREATE TEMPORARY TABLE t1 (a int not null, b char (10) not null);
 
6
insert into t1 values(4,"e"),(5,"f"),(6,"g");
 
7
alter table t1 rename t2;
 
8
select * from t1;
 
9
c       d
 
10
1       
 
11
2       a
 
12
3       b
 
13
select * from t2;
 
14
a       b
 
15
4       e
 
16
5       f
 
17
6       g
 
18
CREATE TABLE t2 (x int not null, y int not null);
 
19
alter table t2 rename t1;
 
20
select * from t1;
 
21
a       b
 
22
4       e
 
23
5       f
 
24
6       g
 
25
create TEMPORARY TABLE t2 engine=heap select * from t1;
 
26
create TEMPORARY TABLE IF NOT EXISTS t2 (a int) engine=heap;
 
27
Warnings:
 
28
Note    1050    Table 't2' already exists
 
29
CREATE TEMPORARY TABLE t1 (a int not null, b char (10) not null);
 
30
ERROR 42S01: Table 't1' already exists
 
31
ALTER TABLE t1 RENAME t2;
 
32
ERROR 42S01: Table 't2' already exists
 
33
select * from t2;
 
34
a       b
 
35
4       e
 
36
5       f
 
37
6       g
 
38
alter table t2 add primary key (a,b);
 
39
drop table t1,t2;
 
40
select * from t1;
 
41
c       d
 
42
1       
 
43
2       a
 
44
3       b
 
45
drop table t2;
 
46
create temporary table t1 select *,2 as "e" from t1;
 
47
select * from t1;
 
48
c       d       e
 
49
1               2
 
50
2       a       2
 
51
3       b       2
 
52
drop table t1;
 
53
drop table t1;
 
54
CREATE TABLE t1 (pkCrash INTEGER PRIMARY KEY,strCrash VARCHAR(255));
 
55
INSERT INTO t1 ( pkCrash, strCrash ) VALUES ( 1, '1');
 
56
SELECT CONCAT_WS(pkCrash, strCrash) FROM t1;
 
57
CONCAT_WS(pkCrash, strCrash)
 
58
1
 
59
drop table t1;
 
60
create temporary table t1 select 1 as 'x';
 
61
drop table t1;
 
62
CREATE TABLE t1 (x INT);
 
63
INSERT INTO t1 VALUES (1), (2), (3);
 
64
CREATE TEMPORARY TABLE tmp SELECT *, NULL FROM t1;
 
65
drop table t1;
 
66
create temporary table t1 (id int(10) not null unique);
 
67
create temporary table t2 (id int(10) not null primary key, 
 
68
val int(10) not null);
 
69
insert into t1 values (1),(2),(4);
 
70
insert into t2 values (1,1),(2,1),(3,1),(4,2);
 
71
select one.id, two.val, elt(two.val,'one','two') from t1 one, t2 two where two.id=one.id order by one.id;
 
72
id      val     elt(two.val,'one','two')
 
73
1       1       one
 
74
2       1       one
 
75
4       2       two
 
76
drop table t1,t2;
 
77
create temporary table t1 (a int not null);
 
78
insert into t1 values (1),(1);
 
79
alter table t1 add primary key (a);
 
80
ERROR 23000: Duplicate entry '1' for key 'PRIMARY'
 
81
drop table t1;
 
82
CREATE TABLE t1 (
 
83
d datetime default NULL
 
84
) ENGINE=MyISAM;
 
85
INSERT INTO t1 VALUES ('2002-10-24 14:50:32'),('2002-10-24 14:50:33'),('2002-10-24 14:50:34'),('2002-10-24 14:50:34'),('2002-10-24 14:50:34'),('2002-10-24 14:50:35'),('2002-10-24 14:50:35'),('2002-10-24 14:50:35'),('2002-10-24 14:50:35'),('2002-10-24 14:50:36'),('2002-10-24 14:50:36'),('2002-10-24 14:50:36'),('2002-10-24 14:50:36'),('2002-10-24 14:50:37'),('2002-10-24 14:50:37'),('2002-10-24 14:50:37'),('2002-10-24 14:50:37'),('2002-10-24 14:50:38'),('2002-10-24 14:50:38'),('2002-10-24 14:50:38'),('2002-10-24 14:50:39'),('2002-10-24 14:50:39'),('2002-10-24 14:50:39'),('2002-10-24 14:50:39'),('2002-10-24 14:50:40'),('2002-10-24 14:50:40'),('2002-10-24 14:50:40');
 
86
flush status;
 
87
select * from t1 group by d;
 
88
d
 
89
2002-10-24 14:50:32
 
90
2002-10-24 14:50:33
 
91
2002-10-24 14:50:34
 
92
2002-10-24 14:50:35
 
93
2002-10-24 14:50:36
 
94
2002-10-24 14:50:37
 
95
2002-10-24 14:50:38
 
96
2002-10-24 14:50:39
 
97
2002-10-24 14:50:40
 
98
show status like "created_tmp%tables";
 
99
Variable_name   Value
 
100
Created_tmp_disk_tables 0
 
101
Created_tmp_tables      1
 
102
drop table t1;
 
103
create temporary table v1 as select 'This is temp. table' A;
 
104
create view v1 as select 'This is view' A;
 
105
select * from v1;
 
106
A
 
107
This is temp. table
 
108
show create table v1;
 
109
Table   Create Table
 
110
v1      CREATE TEMPORARY TABLE `v1` (
 
111
  `A` varchar(19) NOT NULL DEFAULT ''
 
112
) ENGINE=MyISAM DEFAULT CHARSET=latin1
 
113
show create view v1;
 
114
View    Create View     character_set_client    collation_connection
 
115
v1      CREATE ALGORITHM=UNDEFINED DEFINER=`root`@`localhost` SQL SECURITY DEFINER VIEW `v1` AS select 'This is view' AS `A`    latin1  latin1_swedish_ci
 
116
drop view v1;
 
117
select * from v1;
 
118
A
 
119
This is temp. table
 
120
create view v1 as select 'This is view again' A;
 
121
select * from v1;
 
122
A
 
123
This is temp. table
 
124
drop table v1;
 
125
select * from v1;
 
126
A
 
127
This is view again
 
128
drop view v1;
 
129
create table t1 (a int, b int, index(a), index(b));
 
130
create table t2 (c int auto_increment, d varchar(255), primary key (c));
 
131
insert into t1 values (3,1),(3,2);
 
132
insert into t2 values (NULL, 'foo'), (NULL, 'bar');
 
133
select d, c from t1 left join t2 on b = c where a = 3 order by d;
 
134
d       c
 
135
bar     2
 
136
foo     1
 
137
drop table t1, t2;
 
138
DROP TABLE IF EXISTS t1;
 
139
CREATE TABLE t1 (i INT);
 
140
LOCK TABLE t1 WRITE;
 
141
CREATE TEMPORARY TABLE t1 (i INT);
 
142
The following command should not block
 
143
DROP TEMPORARY TABLE t1;
 
144
DROP TABLE t1;
 
145
CREATE TABLE t1 (i INT);
 
146
CREATE TEMPORARY TABLE t2 (i INT);
 
147
DROP TEMPORARY TABLE t2, t1;
 
148
ERROR 42S02: Unknown table 't1'
 
149
SELECT * FROM t2;
 
150
ERROR 42S02: Table 'test.t2' doesn't exist
 
151
SELECT * FROM t1;
 
152
i
 
153
DROP TABLE t1;
 
154
End of 4.1 tests.
 
155
CREATE TABLE t1 ( c FLOAT( 20, 14 ) );
 
156
INSERT INTO t1 VALUES( 12139 );
 
157
CREATE TABLE t2 ( c FLOAT(30,18) );
 
158
INSERT INTO t2 VALUES( 123456 );
 
159
SELECT AVG( c ) FROM t1 UNION SELECT 1;
 
160
AVG( c )
 
161
12139
 
162
1
 
163
SELECT 1 UNION SELECT AVG( c ) FROM t1;
 
164
1
 
165
1
 
166
12139
 
167
SELECT 1 UNION SELECT * FROM t2 UNION SELECT 1;
 
168
1
 
169
1
 
170
123456
 
171
SELECT c/1 FROM t1 UNION SELECT 1;
 
172
c/1
 
173
12139
 
174
1
 
175
DROP TABLE t1, t2;
 
176
create temporary table t1 (a int);
 
177
insert into t1 values (4711);
 
178
select * from t1;
 
179
a
 
180
4711
 
181
truncate t1;
 
182
insert into t1 values (42);
 
183
select * from t1;
 
184
a
 
185
42
 
186
drop table t1;
 
187
CREATE TEMPORARY TABLE t1(a INT, b VARCHAR(20));
 
188
INSERT INTO t1 VALUES(1, 'val1'), (2, 'val2'), (3, 'val3');
 
189
DELETE FROM t1 WHERE a=1;
 
190
SELECT count(*) FROM t1;
 
191
count(*)
 
192
2
 
193
DELETE FROM t1;
 
194
SELECT * FROM t1;
 
195
a       b
 
196
DROP TABLE t1;
 
197
End of 5.1 tests