You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Copy file name to clipboardExpand all lines: tests/sqllogictests/suites/base/09_fuse_engine/09_0026_merge_into
+24-20Lines changed: 24 additions & 20 deletions
Original file line number
Diff line number
Diff line change
@@ -40,13 +40,17 @@ select * from t2 order by a,b,c;
40
40
2 b_7 c_7
41
41
3 b_6 c_6
42
42
43
+
## test source alias
44
+
statement error 1005
45
+
merge into t1 using (select * from t2 ) on t1.a = t2.a when matched then update set t1.c = t2.c,t1.c = t2.c;
46
+
43
47
# section I: basic test for match and unmatch
44
48
45
49
statement error 1006
46
-
merge into t1 using (select * from t2 as t2) on t1.a = t2.a when matched then update set t1.c = t2.c,t1.c = t2.c;
50
+
merge into t1 using (select * from t2 ) as t2 on t1.a = t2.a when matched then update set t1.c = t2.c,t1.c = t2.c;
47
51
48
52
statement ok
49
-
merge into t1 using (select * from t2 as t2) on t1.a = t2.a when matched then update set t1.c = t2.c;
53
+
merge into t1 using (select * from t2 ) as t2 on t1.a = t2.a when matched then update set t1.c = t2.c;
50
54
51
55
query TTT
52
56
select * from t1 order by a,b,c;
@@ -68,7 +72,7 @@ select * from t2 order by a,b,c;
68
72
4 b_8 c_8
69
73
70
74
statement ok
71
-
merge into t1 using (select * from t2 as t2) on t1.a = t2.a when matched then update set t1.c = t2.c when not matched then insert (a,b,c) values(t2.a,t2.b,t2.c);
75
+
merge into t1 using (select * from t2 ) as t2 on t1.a = t2.a when matched then update set t1.c = t2.c when not matched then insert (a,b,c) values(t2.a,t2.b,t2.c);
72
76
73
77
query TTT
74
78
select * from t1 order by a,b,c;
@@ -83,7 +87,7 @@ statement ok
83
87
insert into t2 values(1,'b_9','c_9');
84
88
85
89
statement error 4001
86
-
merge into t1 using (select * from t2 as t2) on t1.a = t2.a when matched then update set t1.c = t2.c when not matched then insert (a,b,c) values(t2.a,t2.b,t2.c);
90
+
merge into t1 using (select * from t2 ) as t2 on t1.a = t2.a when matched then update set t1.c = t2.c when not matched then insert (a,b,c) values(t2.a,t2.b,t2.c);
87
91
88
92
query TTT
89
93
select * from t1 order by a,b,c;
@@ -116,7 +120,7 @@ select * from t2 order by a,b,c;
116
120
5 b_9 c_9
117
121
118
122
statement ok
119
-
merge into t1 using (select * from t2 as t2) on t1.a = t2.a when matched then delete;
123
+
merge into t1 using (select * from t2 ) as t2 on t1.a = t2.a when matched then delete;
120
124
121
125
query ITT
122
126
select * from t1 order by a,b,c;
@@ -135,10 +139,10 @@ select * from t1 order by a,b,c;
135
139
3 b_2 c_2
136
140
137
141
statement error 1065
138
-
merge into t1 using (select * from t2 as t2) on t1.a = t2.a when matched then delete when matched then update set t1.c = t2.c when not matched and t2.c = 'c_8' then insert (a,b,c) values(t2.a,t2.b,t2.c);
142
+
merge into t1 using (select * from t2 ) as t2 on t1.a = t2.a when matched then delete when matched then update set t1.c = t2.c when not matched and t2.c = 'c_8' then insert (a,b,c) values(t2.a,t2.b,t2.c);
139
143
140
144
statement ok
141
-
merge into t1 using (select * from t2 as t2) on t1.a = t2.a when matched and t1.b = 'b_1' then delete when matched then update set t1.c = t2.c when not matched and t2.c = 'c_8' then insert (a,b,c) values(t2.a,t2.b,t2.c);
145
+
merge into t1 using (select * from t2 ) as t2 on t1.a = t2.a when matched and t1.b = 'b_1' then delete when matched then update set t1.c = t2.c when not matched and t2.c = 'c_8' then insert (a,b,c) values(t2.a,t2.b,t2.c);
142
146
143
147
query TTT
144
148
select * from t1 order by a,b,c;
@@ -148,7 +152,7 @@ select * from t1 order by a,b,c;
148
152
4 b_8 c_8
149
153
150
154
statement ok
151
-
merge into t1 using (select * from t2 as t2) on t1.a = t2.a when matched then delete when not matched and t2.c = 'c_9' then insert (a,b,c) values(t2.a,t2.b,t2.c);
155
+
merge into t1 using (select * from t2 ) as t2 on t1.a = t2.a when matched then delete when not matched and t2.c = 'c_9' then insert (a,b,c) values(t2.a,t2.b,t2.c);
152
156
153
157
query TTT
154
158
select * from t1 order by a,b,c;
@@ -157,7 +161,7 @@ select * from t1 order by a,b,c;
157
161
5 b_9 c_9
158
162
159
163
statement ok
160
-
merge into t1 using (select * from t2 as t2) on t1.a = t2.a when not matched and t2.c = 'c_8' then insert (a,b) values(t2.a,t2.b) when not matched and t2.c = 'c_7' then insert (a,c) values(t2.a,t2.c);
164
+
merge into t1 using (select * from t2 ) as t2 on t1.a = t2.a when not matched and t2.c = 'c_8' then insert (a,b) values(t2.a,t2.b) when not matched and t2.c = 'c_7' then insert (a,c) values(t2.a,t2.c);
161
165
162
166
query TTT
163
167
select * from t1 order by a,b,c;
@@ -180,11 +184,11 @@ select * from t2 order by a,b,c;
180
184
5 b_9 c_9
181
185
182
186
statement error 4001
183
-
merge into t1 using (select * from t2 as t2) on t1.a = t2.a when matched and t2.c = 'c_9' then update set t1.b = 'b_11' when matched and t2.c = 'c_10' then delete;
187
+
merge into t1 using (select * from t2 ) as t2 on t1.a = t2.a when matched and t2.c = 'c_9' then update set t1.b = 'b_11' when matched and t2.c = 'c_10' then delete;
184
188
185
189
## idempotent delete test
186
190
statement ok
187
-
merge into t1 using (select * from t2 as t2) on t1.a = t2.a when matched then delete;
191
+
merge into t1 using (select * from t2 ) as t2 on t1.a = t2.a when matched then delete;
188
192
189
193
query TTT
190
194
select * from t1 order by a,b,c;
@@ -228,10 +232,10 @@ select * from t2 order by a,b,c;
228
232
229
233
## test insert columns mismatch
230
234
statement error 1065
231
-
merge into t1 using (select * from t2 as t2) on t1.a = t2.a when not matched then insert values(t2.a,t2.c);
235
+
merge into t1 using (select * from t2 ) as t2 on t1.a = t2.a when not matched then insert values(t2.a,t2.c);
232
236
233
237
statement ok
234
-
merge into t1 using (select * from t2 as t2) on t1.a = t2.a when matched then update * when not matched then insert *;
238
+
merge into t1 using (select * from t2 ) as t2 on t1.a = t2.a when matched then update * when not matched then insert *;
235
239
236
240
query TTT
237
241
select * from t1 order by a,b,c;
@@ -242,10 +246,10 @@ select * from t1 order by a,b,c;
242
246
243
247
## test multi same name for star
244
248
statement error 1065
245
-
merge into t1 using (select a,b,c,a from t2 as t2) on t1.a = t2.a when matched then update *;
249
+
merge into t1 using (select a,b,c,a from t2 ) as t2 on t1.a = t2.a when matched then update *;
246
250
247
251
statement error 1065
248
-
merge into t1 using (select a,b,c,a,b from t2 as t2) on t1.a = t2.a when not matched then insert *;
252
+
merge into t1 using (select a,b,c,a,b from t2 ) as t2 on t1.a = t2.a when not matched then insert *;
249
253
250
254
## stage file test
251
255
statement ok
@@ -389,7 +393,7 @@ select * from t2 order by a,b,c;
389
393
NULL b_3 c_3
390
394
391
395
statement ok
392
-
merge into t1 using (select * from t2) on t1.a = t2.a when matched then delete when not matched then insert *;
396
+
merge into t1 using (select * from t2) as t2 on t1.a = t2.a when matched then delete when not matched then insert *;
393
397
394
398
query TTT
395
399
select * from t1 order by a,b,c;
@@ -400,7 +404,7 @@ NULL b_1 c_1
400
404
NULL b_3 c_3
401
405
402
406
statement ok
403
-
merge into t1 using (select * from t2) on t1.a = t2.a when matched then delete;
407
+
merge into t1 using (select * from t2) as t2 on t1.a = t2.a when matched then delete;
404
408
405
409
query TTT
406
410
select * from t1 order by a,b,c;
@@ -429,7 +433,7 @@ statement ok
429
433
insert into t2 values(1,'a1','b1');
430
434
431
435
statement ok
432
-
merge into t1 as t3 using (select * from t2 as t2) on t3.a = t2.a when not matched then insert (a,b,c) values(t2.a,t2.b,t2.c);
436
+
merge into t1 as t3 using (select * from t2 ) as t2 on t3.a = t2.a when not matched then insert (a,b,c) values(t2.a,t2.b,t2.c);
433
437
434
438
query TTT
435
439
select * from t1 order by a,b,c;
@@ -449,7 +453,7 @@ statement ok
449
453
INSERT INTO salaries VALUES(1, 50000.00),(2, 60000.00);
450
454
451
455
statement ok
452
-
MERGE INTO salaries USING (SELECT * FROM employees) ON salaries.employee_id = employees.employee_id WHEN MATCHED AND employees.department = 'HR' THEN UPDATE SET salaries.salary = salaries.salary + 1000.00 WHEN MATCHED THEN UPDATE SET salaries.salary = salaries.salary + 500.00 WHEN NOT MATCHED THEN INSERT (employee_id, salary) VALUES (employees.employee_id, 55000.00);
456
+
MERGE INTO salaries USING (SELECT * FROM employees) as employees ON salaries.employee_id = employees.employee_id WHEN MATCHED AND employees.department = 'HR' THEN UPDATE SET salaries.salary = salaries.salary + 1000.00 WHEN MATCHED THEN UPDATE SET salaries.salary = salaries.salary + 500.00 WHEN NOT MATCHED THEN INSERT (employee_id, salary) VALUES (employees.employee_id, 55000.00);
453
457
454
458
query TTT
455
459
select * from salaries order by employee_id;
@@ -473,7 +477,7 @@ statement ok
473
477
insert into t2_source values(1),(2);
474
478
475
479
statement ok
476
-
merge into t1_target using (select * from t2_source) on t1_target.a = t2_source.a when matched then update * when not matched then insert *;
480
+
merge into t1_target using (select * from t2_source) as t2_source on t1_target.a = t2_source.a when matched then update * when not matched then insert *;
Copy file name to clipboardExpand all lines: tests/sqllogictests/suites/ee/01_ee_system/01_0001_computed_column
+4-4Lines changed: 4 additions & 4 deletions
Original file line number
Diff line number
Diff line change
@@ -211,13 +211,13 @@ statement ok
211
211
insert into t_source_merge values('a1','b1','c1'),('a2','b2','c2');
212
212
213
213
statement error 1006
214
-
merge into t_stored_merge as t1 using (select * from t_source_merge as t2) on t1.a = t2.a when not matched then insert (a,b,c) values(t2.a,t2.b,t2.c);
214
+
merge into t_stored_merge as t1 using (select * from t_source_merge as t2) as t2 on t1.a = t2.a when not matched then insert (a,b,c) values(t2.a,t2.b,t2.c);
215
215
216
216
statement error 1006
217
-
merge into t_stored_merge as t1 using (select * from t_source_merge as t2) on t1.a = t2.a when matched then update set t1.b = t2.b when not matched then insert (a,c) values(t2.a,t2.c);
217
+
merge into t_stored_merge as t1 using (select * from t_source_merge as t2) as t2 on t1.a = t2.a when matched then update set t1.b = t2.b when not matched then insert (a,c) values(t2.a,t2.c);
218
218
219
219
statement ok
220
-
merge into t_stored_merge as t1 using (select * from t_source_merge as t2) on t1.a = t2.a when not matched then insert (a,c) values(t2.a,t2.c);
220
+
merge into t_stored_merge as t1 using (select * from t_source_merge as t2) as t2 on t1.a = t2.a when not matched then insert (a,c) values(t2.a,t2.c);
221
221
222
222
query TTT
223
223
select * from t_stored_merge order by a,b,c;
@@ -248,7 +248,7 @@ a1 b1 c1
248
248
a2 b2 c2
249
249
250
250
statement ok
251
-
merge into t_stored_merge as t1 using (select * from t_source_merge as t2) on t1.a = t2.a when matched then update set t1.c = t2.c when not matched then insert (a,c) values(t2.a,t2.c);
251
+
merge into t_stored_merge as t1 using (select * from t_source_merge as t2) as t2 on t1.a = t2.a when matched then update set t1.c = t2.c when not matched then insert (a,c) values(t2.a,t2.c);
0 commit comments