@@ -190,8 +190,28 @@ SELECT COUNT(*) FROM ONLY test.num_range_rel;
190
190
0
191
191
(1 row)
192
192
193
+ /* test special case: ONLY statement with not-ONLY for partitioned table */
193
194
SELECT * FROM ONLY test.range_rel UNION SELECT * FROM test.range_rel;
194
195
ERROR: It is prohibited to apply ONLY modifier to partitioned tables which have already been mentioned without ONLY
196
+ SELECT * FROM test.range_rel UNION SELECT * FROM ONLY test.range_rel;
197
+ ERROR: It is prohibited to apply ONLY modifier to partitioned tables which have already been mentioned without ONLY
198
+ SELECT * FROM test.range_rel UNION SELECT * FROM test.range_rel UNION SELECT * FROM ONLY test.range_rel;
199
+ ERROR: It is prohibited to apply ONLY modifier to partitioned tables which have already been mentioned without ONLY
200
+ SELECT * FROM ONLY test.range_rel UNION SELECT * FROM test.range_rel UNION SELECT * FROM test.range_rel;
201
+ ERROR: It is prohibited to apply ONLY modifier to partitioned tables which have already been mentioned without ONLY
202
+ /* FIXME: result of next command execution is not right just yet */
203
+ WITH q1 AS (SELECT * FROM test.range_rel), q2 AS (SELECT * FROM ONLY test.range_rel) SELECT * FROM q1 JOIN q2 USING(id);
204
+ ERROR: It is prohibited to apply ONLY modifier to partitioned tables which have already been mentioned without ONLY
205
+ WITH q1 AS (SELECT * FROM ONLY test.range_rel) SELECT * FROM test.range_rel JOIN q1 USING(id);
206
+ id | dt | txt | dt | txt
207
+ ----+----+-----+----+-----
208
+ (0 rows)
209
+
210
+ SELECT * FROM test.range_rel WHERE id = (SELECT id FROM ONLY test.range_rel LIMIT 1);
211
+ id | dt | txt
212
+ ----+----+-----
213
+ (0 rows)
214
+
195
215
SET pg_pathman.enable_runtimeappend = OFF;
196
216
SET pg_pathman.enable_runtimemergeappend = OFF;
197
217
VACUUM;