@@ -262,6 +262,64 @@ EXPLAIN (COSTS OFF) SELECT * FROM test.improved_dummy WHERE id = 101 OR id = 5 A
262262
263263DROP TABLE test.improved_dummy CASCADE;
264264NOTICE: drop cascades to 11 other objects
265+ /* Test pathman_rel_pathlist_hook() with INSERT query */
266+ CREATE TABLE test.insert_into_select(val int NOT NULL);
267+ INSERT INTO test.insert_into_select SELECT generate_series(1, 100);
268+ SELECT pathman.create_range_partitions('test.insert_into_select', 'val', 1, 20);
269+ NOTICE: sequence "insert_into_select_seq" does not exist, skipping
270+ create_range_partitions
271+ -------------------------
272+ 5
273+ (1 row)
274+
275+ CREATE TABLE test.insert_into_select_copy (LIKE test.insert_into_select); /* INSERT INTO ... SELECT ... */
276+ EXPLAIN (COSTS OFF)
277+ INSERT INTO test.insert_into_select_copy
278+ SELECT * FROM test.insert_into_select
279+ WHERE val <= 80;
280+ QUERY PLAN
281+ ----------------------------------------------
282+ Insert on insert_into_select_copy
283+ -> Append
284+ -> Seq Scan on insert_into_select_1
285+ -> Seq Scan on insert_into_select_2
286+ -> Seq Scan on insert_into_select_3
287+ -> Seq Scan on insert_into_select_4
288+ Filter: (val <= 80)
289+ (7 rows)
290+
291+ SELECT pathman.set_enable_parent('test.insert_into_select', true);
292+ set_enable_parent
293+ -------------------
294+
295+ (1 row)
296+
297+ EXPLAIN (COSTS OFF)
298+ INSERT INTO test.insert_into_select_copy
299+ SELECT * FROM test.insert_into_select
300+ WHERE val <= 80;
301+ QUERY PLAN
302+ ----------------------------------------------
303+ Insert on insert_into_select_copy
304+ -> Append
305+ -> Seq Scan on insert_into_select
306+ Filter: (val <= 80)
307+ -> Seq Scan on insert_into_select_1
308+ -> Seq Scan on insert_into_select_2
309+ -> Seq Scan on insert_into_select_3
310+ -> Seq Scan on insert_into_select_4
311+ Filter: (val <= 80)
312+ (9 rows)
313+
314+ INSERT INTO test.insert_into_select_copy SELECT * FROM test.insert_into_select;
315+ SELECT count(*) FROM test.insert_into_select_copy;
316+ count
317+ -------
318+ 100
319+ (1 row)
320+
321+ DROP TABLE test.insert_into_select_copy, test.insert_into_select CASCADE;
322+ NOTICE: drop cascades to 5 other objects
265323/* test special case: ONLY statement with not-ONLY for partitioned table */
266324CREATE TABLE test.from_only_test(val INT NOT NULL);
267325INSERT INTO test.from_only_test SELECT generate_series(1, 20);
@@ -1909,6 +1967,6 @@ EXPLAIN (COSTS OFF) SELECT * FROM test.index_on_childs WHERE c1 > 100 AND c1 < 2
19091967(12 rows)
19101968
19111969DROP SCHEMA test CASCADE;
1912- NOTICE: drop cascades to47 other objects
1970+ NOTICE: drop cascades to48 other objects
19131971DROP EXTENSION pg_pathman CASCADE;
19141972DROP SCHEMA pathman CASCADE;