Skip to content

Commit d0fb919

Browse files
author
Maksim Milyutin
committed
Add tests for special case with ONLY statement
1 parent 2704b14 commit d0fb919

File tree

2 files changed

+28
-0
lines changed

2 files changed

+28
-0
lines changed

expected/pathman_basic.out

Lines changed: 20 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -190,8 +190,28 @@ SELECT COUNT(*) FROM ONLY test.num_range_rel;
190190
0
191191
(1 row)
192192

193+
/* test special case: ONLY statement with not-ONLY for partitioned table */
193194
SELECT * FROM ONLY test.range_rel UNION SELECT * FROM test.range_rel;
194195
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+
195215
SET pg_pathman.enable_runtimeappend = OFF;
196216
SET pg_pathman.enable_runtimemergeappend = OFF;
197217
VACUUM;

sql/pathman_basic.sql

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -57,7 +57,15 @@ INSERT INTO test.num_range_rel
5757
SELECT COUNT(*) FROM test.num_range_rel;
5858
SELECT COUNT(*) FROM ONLY test.num_range_rel;
5959

60+
/* test special case: ONLY statement with not-ONLY for partitioned table */
6061
SELECT * FROM ONLY test.range_rel UNION SELECT * FROM test.range_rel;
62+
SELECT * FROM test.range_rel UNION SELECT * FROM ONLY test.range_rel;
63+
SELECT * FROM test.range_rel UNION SELECT * FROM test.range_rel UNION SELECT * FROM ONLY test.range_rel;
64+
SELECT * FROM ONLY test.range_rel UNION SELECT * FROM test.range_rel UNION SELECT * FROM test.range_rel;
65+
/* FIXME: result of next command execution is not right just yet */
66+
WITH q1 AS (SELECT * FROM test.range_rel), q2 AS (SELECT * FROM ONLY test.range_rel) SELECT * FROM q1 JOIN q2 USING(id);
67+
WITH q1 AS (SELECT * FROM ONLY test.range_rel) SELECT * FROM test.range_rel JOIN q1 USING(id);
68+
SELECT * FROM test.range_rel WHERE id = (SELECT id FROM ONLY test.range_rel LIMIT 1);
6169

6270
SET pg_pathman.enable_runtimeappend = OFF;
6371
SET pg_pathman.enable_runtimemergeappend = OFF;

0 commit comments

Comments
 (0)