~drizzle-trunk/drizzle/development

« back to all changes in this revision

Viewing changes to tests/t/derived.test

  • Committer: Brian Aker
  • Date: 2010-04-05 23:46:43 UTC
  • Revision ID: brian@gaz-20100405234643-0he3xnj902rc70r8
Fixing tests to work with PBXT.

Show diffs side-by-side

added added

removed removed

Lines of Context:
1
1
# Initialize
 
2
--disable_warnings
2
3
drop table if exists t1,t2,t3;
 
4
--enable_warnings
3
5
 
4
6
select * from (select 2) b;
5
7
-- error 1054
102
104
#
103
105
create table t1 (a int);
104
106
insert into t1 values (1),(2),(3);
105
 
update (select * from t1) as t1 set a = 5;
106
107
-- error 1064
107
108
delete from (select * from t1);
108
109
-- error 1064
127
127
drop table t1;
128
128
 
129
129
#
130
 
# multi-update & multi-delete with derived tables
131
 
#
132
 
CREATE TABLE `t1` (
133
 
  `N` int NOT NULL default '0',
134
 
  `M` int default '0'
135
 
) ENGINE=MyISAM;
136
 
INSERT INTO `t1` (N, M) VALUES (1, 0),(1, 0),(1, 0),(2, 0),(2, 0),(3, 0);
137
 
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;
138
 
select * from t1;
139
 
# TODO: Bug lp:311109
140
 
#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, P2.N = 2;
141
 
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;
142
 
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;
143
 
select * from t1;
144
 
--replace_result P2 p2
145
 
# TODO: Bug lp:311111
146
 
#--error ER_NON_UPDATABLE_TABLE
147
 
#delete P1.*,P2.* from `t1` AS P1 INNER JOIN (SELECT N FROM `t1` GROUP BY N HAVING Count(M) > 1) AS P2 ON P1.N = P2.N;
148
 
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;
149
 
drop table t1;
150
 
 
151
 
#
152
130
# correct lex->current_select
153
131
#
154
 
CREATE TABLE t1 (
 
132
CREATE TEMPORARY TABLE t1 (
155
133
  OBJECTID int NOT NULL default 0,
156
134
  SORTORDER int NOT NULL auto_increment,
157
135
  KEY t1_SortIndex (SORTORDER),
158
136
  KEY t1_IdIndex (OBJECTID)
159
137
) ENGINE=MyISAM;
160
 
CREATE TABLE t2 (
 
138
CREATE TEMPORARY TABLE t2 (
161
139
  ID int default NULL,
162
140
  PARID int default NULL,
163
141
  UNIQUE KEY t2_ID_IDX (ID),
164
142
  KEY t2_PARID_IDX (PARID)
165
143
) engine=MyISAM;
166
144
INSERT INTO t2 VALUES (1000,0),(1001,0),(1002,0),(1003,0),(1008,1),(1009,1),(1010,1),(1011,1),(1016,2);
167
 
CREATE TABLE t3 (
 
145
CREATE TEMPORARY TABLE t3 (
168
146
  ID int default NULL,
169
147
  DATA decimal(10,2) default NULL,
170
148
  UNIQUE KEY t3_ID_IDX (ID)