~drizzle-trunk/drizzle/development

« back to all changes in this revision

Viewing changes to tests/r/derived.result

Reverted 1103

Show diffs side-by-side

added added

removed removed

Lines of Context:
1
1
drop table if exists t1,t2,t3;
 
2
Warnings:
 
3
Note    1051    Unknown table 't1'
 
4
Note    1051    Unknown table 't2'
 
5
Note    1051    Unknown table 't3'
2
6
select * from (select 2) b;
3
7
2
4
8
2
37
41
ERROR 42S22: Unknown column 'a' in 'where clause'
38
42
SELECT (SELECT 1) as a FROM (SELECT 1 FROM t1  HAVING a=1) as a;
39
43
ERROR 42S22: Unknown column 'a' in 'having clause'
40
 
select * from t1 as x1, (select * from t1) as x2 where x1.a != 0;
 
44
select * from t1 as x1, (select * from t1) as x2;
41
45
a       b       a       b
42
46
1       a       1       a
43
47
2       b       1       a
55
59
2       b       3       c
56
60
3       c       3       c
57
61
3       c       3       c
58
 
explain select * from t1 as x1, (select * from t1) as x2 where x1.a != 0;
 
62
explain select * from t1 as x1, (select * from t1) as x2;
59
63
id      select_type     table   type    possible_keys   key     key_len ref     rows    Extra
60
 
1       PRIMARY x1      ALL     NULL    NULL    NULL    NULL    4       Using where
 
64
1       PRIMARY x1      ALL     NULL    NULL    NULL    NULL    4       
61
65
1       PRIMARY <derived2>      ALL     NULL    NULL    NULL    NULL    4       Using join buffer
62
66
2       DERIVED t1      ALL     NULL    NULL    NULL    NULL    4       
63
67
drop table if exists  t2,t3;
140
144
18      18
141
145
19      19
142
146
20      20
143
 
explain select count(*) from t1 as tt1, (select * from t1) as tt2 where tt1.a != 0;
 
147
explain select count(*) from t1 as tt1, (select * from t1) as tt2;
144
148
id      select_type     table   type    possible_keys   key     key_len ref     rows    Extra
145
 
1       PRIMARY tt1     range   a       a       4       NULL    X       Using where; Using index
 
149
1       PRIMARY tt1     index   NULL    a       4       NULL    X       Using index
146
150
1       PRIMARY <derived2>      ALL     NULL    NULL    NULL    NULL    X       Using join buffer
147
151
2       DERIVED t1      ALL     NULL    NULL    NULL    NULL    X       
148
152
drop table t1;
205
209
1
206
210
create table t1 (a int);
207
211
insert into t1 values (1),(2),(3);
 
212
update (select * from t1) as t1 set a = 5;
 
213
ERROR HY000: The target table t1 of the UPDATE is not updatable
208
214
delete from (select * from t1);
209
215
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 '(select * from t1)' at line 1
210
216
insert into  (select * from t1) values (5);
225
231
drop table t1;
226
232
create table t1 (a int);
227
233
insert into t1 values (1),(2);
228
 
select * from ( select * from t1 union select * from t1) a,(select * from t1 union select * from t1) b where a.a != 0;
 
234
select * from ( select * from t1 union select * from t1) a,(select * from t1 union select * from t1) b;
229
235
a       a
230
236
1       1
231
237
2       1
232
238
1       2
233
239
2       2
234
 
explain select * from ( select * from t1 union select * from t1) a,(select * from t1 union select * from t1) b where a.a != 0;
 
240
explain select * from ( select * from t1 union select * from t1) a,(select * from t1 union select * from t1) b;
235
241
id      select_type     table   type    possible_keys   key     key_len ref     rows    Extra
236
 
1       PRIMARY <derived2>      ALL     NULL    NULL    NULL    NULL    2       Using where
 
242
1       PRIMARY <derived2>      ALL     NULL    NULL    NULL    NULL    2       
237
243
1       PRIMARY <derived4>      ALL     NULL    NULL    NULL    NULL    2       Using join buffer
238
244
4       DERIVED t1      ALL     NULL    NULL    NULL    NULL    2       
239
245
5       UNION   t1      ALL     NULL    NULL    NULL    NULL    2       
242
248
3       UNION   t1      ALL     NULL    NULL    NULL    NULL    2       
243
249
NULL    UNION RESULT    <union2,3>      ALL     NULL    NULL    NULL    NULL    NULL    
244
250
drop table t1;
 
251
CREATE TABLE `t1` (
 
252
`N` int NOT NULL default '0',
 
253
`M` int default '0'
 
254
);
 
255
INSERT INTO `t1` (N, M) VALUES (1, 0),(1, 0),(1, 0),(2, 0),(2, 0),(3, 0);
 
256
UPDATE `t1` AS P1 INNER JOIN (SELECT N FROM `t1` GROUP BY N HAVING Count(M) > 1) AS P2 ON P1.N = P2.N SET P1.M = 2;
 
257
select * from t1;
 
258
N       M
 
259
1       2
 
260
1       2
 
261
1       2
 
262
2       2
 
263
2       2
 
264
3       0
 
265
UPDATE `t1` AS P1 INNER JOIN (SELECT aaaa FROM `t1` GROUP BY N HAVING Count(M) > 1) AS P2 ON P1.N = P2.N SET P1.M = 2;
 
266
ERROR 42S22: Unknown column 'aaaa' in 'field list'
 
267
delete P1.* from `t1` AS P1 INNER JOIN (SELECT N FROM `t1` GROUP BY N HAVING Count(M) > 1) AS P2 ON P1.N = P2.N;
 
268
select * from t1;
 
269
N       M
 
270
3       0
 
271
delete P1.* from `t1` AS P1 INNER JOIN (SELECT aaa FROM `t1` GROUP BY N HAVING Count(M) > 1) AS p2 ON P1.N = p2.N;
 
272
ERROR 42S22: Unknown column 'aaa' in 'field list'
 
273
drop table t1;
245
274
CREATE TEMPORARY TABLE t1 (
246
275
OBJECTID int NOT NULL default 0,
247
276
SORTORDER int NOT NULL auto_increment,
328
357
drop table t1, t2, t3;
329
358
create table t1 (a int);
330
359
create table t2 (a int);
331
 
select * from (select * from t1,t2 where t1.a != 0) foo;
 
360
select * from (select * from t1,t2) foo;
332
361
a       a
333
362
drop table t1,t2;
334
363
create table t1 (ID int not null auto_increment,