~drizzle-trunk/drizzle/development

« back to all changes in this revision

Viewing changes to tests/t/subselect.test

  • Committer: Padraig O'Sullivan
  • Date: 2009-08-08 04:22:33 UTC
  • mto: (1115.3.4 captain)
  • mto: This revision was merged to the branch mainline in revision 1117.
  • Revision ID: osullivan.padraig@gmail.com-20090808042233-q0z88zc490z3f3r7
Renamed the Command class to be Statement. Renamed the command directory to
statement and also the command header file to statement. Updated various
source files to reflect this renaming.

Show diffs side-by-side

added added

removed removed

Lines of Context:
154
154
  `email` varchar(60) NOT NULL default '',
155
155
  PRIMARY KEY  (`pseudo`),
156
156
  UNIQUE KEY `email` (`email`)
157
 
);
 
157
) ROW_FORMAT=DYNAMIC;
158
158
 
159
159
INSERT INTO t8 (pseudo,email) VALUES ('joce','test');
160
160
INSERT INTO t8 (pseudo,email) VALUES ('joce1','test1');
199
199
  `maxnumrep` int NOT NULL default '0',
200
200
  PRIMARY KEY  (`numeropost`),
201
201
  UNIQUE KEY `maxnumrep` (`maxnumrep`)
202
 
);
 
202
) ROW_FORMAT=FIXED;
203
203
 
204
204
INSERT INTO t1 (numeropost,maxnumrep) VALUES (40143,1),(43506,2);
205
205
 
209
209
      `date` date NULL,
210
210
      `pseudo` varchar(35) NOT NULL default '',
211
211
       PRIMARY KEY  (`mot`,`pseudo`,`date`,`topic`)
212
 
    );
 
212
    ) ROW_FORMAT=DYNAMIC;
213
213
 
214
214
INSERT INTO t2 (mot,topic,date,pseudo) VALUES ('joce','40143','2002-10-22','joce'), ('joce','43506','2002-10-22','joce');
215
215
select numeropost as a FROM t1 GROUP BY (SELECT 1 FROM t1 HAVING a=1);
242
242
  `maxnumrep` int NOT NULL default '0',
243
243
  PRIMARY KEY  (`numeropost`),
244
244
  UNIQUE KEY `maxnumrep` (`maxnumrep`)
245
 
);
 
245
) ROW_FORMAT=FIXED;
246
246
 
247
247
INSERT INTO t1 (numeropost,maxnumrep) VALUES (1,0),(2,1);
248
248
-- error 1242
334
334
select * from t1;
335
335
insert into t2 values (1);
336
336
INSERT INTO t1 (x) VALUES ((SELECT SUM(a) FROM t2));
 
337
-- sleep 1
337
338
select * from t1;
338
339
INSERT INTO t1 (x) select (SELECT SUM(a)+1 FROM t2) FROM t2;
339
340
select * from t1;
343
344
-- error 1054
344
345
INSERT INTO t1 (x) VALUES ((SELECT SUM(x) FROM t2));
345
346
INSERT INTO t1 (x) VALUES ((SELECT SUM(a) FROM t2));
 
347
-- sleep 1
346
348
select * from t1;
347
349
--echo #
348
350
--echo #TODO: should be uncommented after bug 380 fix pushed
366
368
replace into t1 (x, y) VALUES ((SELECT a FROM t2), (SELECT a+2 FROM t2));
367
369
select * from t1;
368
370
replace into t1 (x, y) VALUES ((SELECT a+3 FROM t2), (SELECT a FROM t2));
 
371
-- sleep 1
369
372
--sorted_result
370
373
select * from t1;
371
374
replace into t1 (x, y) VALUES ((SELECT a+3 FROM t2), (SELECT a+1 FROM t2));
 
375
-- sleep 1
372
376
select * from t1;
373
377
replace into t1 (x, y) VALUES ((SELECT a+1 FROM t2), (SELECT a FROM t2));
374
378
--sorted_result
621
625
  `pseudo` varchar(35) NOT NULL default '',
622
626
  PRIMARY KEY  (`id`),
623
627
  UNIQUE KEY `pseudo` (`pseudo`)
624
 
) ENGINE=MyISAM ROW_FORMAT=DYNAMIC;
 
628
) ENGINE=MyISAM PACK_KEYS=1 ROW_FORMAT=DYNAMIC;
625
629
INSERT INTO t1 (pseudo) VALUES ('test');
626
630
SELECT 0 IN (SELECT 1 FROM t1 a);
627
631
EXPLAIN EXTENDED SELECT 0 IN (SELECT 1 FROM t1 a);
699
703
  PRIMARY KEY  (`id`),
700
704
  UNIQUE KEY `email` (`email`),
701
705
  UNIQUE KEY `pseudo` (`pseudo`)
702
 
) ENGINE=MyISAM ROW_FORMAT=DYNAMIC;
 
706
) ENGINE=MyISAM PACK_KEYS=1 ROW_FORMAT=DYNAMIC;
703
707
INSERT INTO t1 (id,pseudo,email) VALUES (1,'test','test'),(2,'test1','test1');
704
708
SELECT pseudo as a, pseudo as b FROM t1 GROUP BY (SELECT a) ORDER BY (SELECT id*1);
705
709
drop table if exists t1;