Skip to content

Commit 199cf98

Browse files
committed
Merge branch 'rel_future_beta' into rel_future_strings
2 parents b80e7ac + da061b4 commit 199cf98

38 files changed

+2681
-1720
lines changed

Makefile

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,8 @@ OBJS = src/init.o src/relation_info.o src/utils.o src/partition_filter.o \
77
src/pl_funcs.o src/pl_range_funcs.o src/pl_hash_funcs.o src/pathman_workers.o \
88
src/hooks.o src/nodes_common.o src/xact_handling.o src/utility_stmt_hooking.o \
99
src/planner_tree_modification.o src/debug_print.o src/partition_creation.o \
10-
src/compat/pg_compat.o $(WIN32RES)
10+
src/compat/pg_compat.o src/compat/relation_tags.o src/compat/expand_rte_hook.o \
11+
src/compat/rowmarks_fix.o $(WIN32RES)
1112

1213
PG_CPPFLAGS = -I$(CURDIR)/src/include
1314

@@ -24,6 +25,7 @@ DATA = pg_pathman--1.0--1.1.sql \
2425
PGFILEDESC = "pg_pathman - partitioning tool"
2526

2627
REGRESS = pathman_basic \
28+
pathman_only \
2729
pathman_cte \
2830
pathman_bgw \
2931
pathman_inserts \
@@ -35,7 +37,7 @@ REGRESS = pathman_basic \
3537
pathman_permissions \
3638
pathman_rowmarks \
3739
pathman_runtime_nodes \
38-
pathman_utility_stmt_hooking \
40+
pathman_utility_stmt \
3941
pathman_calamity
4042

4143
EXTRA_REGRESS_OPTS=--temp-config=$(top_srcdir)/$(subdir)/conf.add

expected/pathman_basic.out

Lines changed: 0 additions & 201 deletions
Original file line numberDiff line numberDiff line change
@@ -364,207 +364,6 @@ SELECT max(val) FROM test.insert_date_test; /* check last date */
364364

365365
DROP TABLE test.insert_date_test CASCADE;
366366
NOTICE: drop cascades to 8 other objects
367-
/* Test special case: ONLY statement with not-ONLY for partitioned table */
368-
CREATE TABLE test.from_only_test(val INT NOT NULL);
369-
INSERT INTO test.from_only_test SELECT generate_series(1, 20);
370-
SELECT pathman.create_range_partitions('test.from_only_test', 'val', 1, 2);
371-
NOTICE: sequence "from_only_test_seq" does not exist, skipping
372-
create_range_partitions
373-
-------------------------
374-
10
375-
(1 row)
376-
377-
/* should be OK */
378-
EXPLAIN (COSTS OFF)
379-
SELECT * FROM ONLY test.from_only_test
380-
UNION SELECT * FROM test.from_only_test;
381-
QUERY PLAN
382-
-------------------------------------------------
383-
HashAggregate
384-
Group Key: from_only_test.val
385-
-> Append
386-
-> Seq Scan on from_only_test
387-
-> Append
388-
-> Seq Scan on from_only_test_1
389-
-> Seq Scan on from_only_test_2
390-
-> Seq Scan on from_only_test_3
391-
-> Seq Scan on from_only_test_4
392-
-> Seq Scan on from_only_test_5
393-
-> Seq Scan on from_only_test_6
394-
-> Seq Scan on from_only_test_7
395-
-> Seq Scan on from_only_test_8
396-
-> Seq Scan on from_only_test_9
397-
-> Seq Scan on from_only_test_10
398-
(15 rows)
399-
400-
/* should be OK */
401-
EXPLAIN (COSTS OFF)
402-
SELECT * FROM test.from_only_test
403-
UNION SELECT * FROM ONLY test.from_only_test;
404-
QUERY PLAN
405-
-------------------------------------------------
406-
HashAggregate
407-
Group Key: from_only_test_1.val
408-
-> Append
409-
-> Append
410-
-> Seq Scan on from_only_test_1
411-
-> Seq Scan on from_only_test_2
412-
-> Seq Scan on from_only_test_3
413-
-> Seq Scan on from_only_test_4
414-
-> Seq Scan on from_only_test_5
415-
-> Seq Scan on from_only_test_6
416-
-> Seq Scan on from_only_test_7
417-
-> Seq Scan on from_only_test_8
418-
-> Seq Scan on from_only_test_9
419-
-> Seq Scan on from_only_test_10
420-
-> Seq Scan on from_only_test
421-
(15 rows)
422-
423-
/* should be OK */
424-
EXPLAIN (COSTS OFF)
425-
SELECT * FROM test.from_only_test
426-
UNION SELECT * FROM test.from_only_test
427-
UNION SELECT * FROM ONLY test.from_only_test;
428-
QUERY PLAN
429-
---------------------------------------------------------------------
430-
HashAggregate
431-
Group Key: from_only_test_1.val
432-
-> Append
433-
-> Append
434-
-> Seq Scan on from_only_test_1
435-
-> Seq Scan on from_only_test_2
436-
-> Seq Scan on from_only_test_3
437-
-> Seq Scan on from_only_test_4
438-
-> Seq Scan on from_only_test_5
439-
-> Seq Scan on from_only_test_6
440-
-> Seq Scan on from_only_test_7
441-
-> Seq Scan on from_only_test_8
442-
-> Seq Scan on from_only_test_9
443-
-> Seq Scan on from_only_test_10
444-
-> Append
445-
-> Seq Scan on from_only_test_1 from_only_test_1_1
446-
-> Seq Scan on from_only_test_2 from_only_test_2_1
447-
-> Seq Scan on from_only_test_3 from_only_test_3_1
448-
-> Seq Scan on from_only_test_4 from_only_test_4_1
449-
-> Seq Scan on from_only_test_5 from_only_test_5_1
450-
-> Seq Scan on from_only_test_6 from_only_test_6_1
451-
-> Seq Scan on from_only_test_7 from_only_test_7_1
452-
-> Seq Scan on from_only_test_8 from_only_test_8_1
453-
-> Seq Scan on from_only_test_9 from_only_test_9_1
454-
-> Seq Scan on from_only_test_10 from_only_test_10_1
455-
-> Seq Scan on from_only_test
456-
(26 rows)
457-
458-
/* should be OK */
459-
EXPLAIN (COSTS OFF)
460-
SELECT * FROM ONLY test.from_only_test
461-
UNION SELECT * FROM test.from_only_test
462-
UNION SELECT * FROM test.from_only_test;
463-
QUERY PLAN
464-
---------------------------------------------------------------------
465-
HashAggregate
466-
Group Key: from_only_test.val
467-
-> Append
468-
-> Seq Scan on from_only_test
469-
-> Append
470-
-> Seq Scan on from_only_test_1
471-
-> Seq Scan on from_only_test_2
472-
-> Seq Scan on from_only_test_3
473-
-> Seq Scan on from_only_test_4
474-
-> Seq Scan on from_only_test_5
475-
-> Seq Scan on from_only_test_6
476-
-> Seq Scan on from_only_test_7
477-
-> Seq Scan on from_only_test_8
478-
-> Seq Scan on from_only_test_9
479-
-> Seq Scan on from_only_test_10
480-
-> Append
481-
-> Seq Scan on from_only_test_1 from_only_test_1_1
482-
-> Seq Scan on from_only_test_2 from_only_test_2_1
483-
-> Seq Scan on from_only_test_3 from_only_test_3_1
484-
-> Seq Scan on from_only_test_4 from_only_test_4_1
485-
-> Seq Scan on from_only_test_5 from_only_test_5_1
486-
-> Seq Scan on from_only_test_6 from_only_test_6_1
487-
-> Seq Scan on from_only_test_7 from_only_test_7_1
488-
-> Seq Scan on from_only_test_8 from_only_test_8_1
489-
-> Seq Scan on from_only_test_9 from_only_test_9_1
490-
-> Seq Scan on from_only_test_10 from_only_test_10_1
491-
(26 rows)
492-
493-
/* not ok, ONLY|non-ONLY in one query */
494-
EXPLAIN (COSTS OFF)
495-
SELECT * FROM test.from_only_test a JOIN ONLY test.from_only_test b USING(val);
496-
ERROR: it is prohibited to apply ONLY modifier to partitioned tables which have already been mentioned without ONLY
497-
EXPLAIN (COSTS OFF)
498-
WITH q1 AS (SELECT * FROM test.from_only_test),
499-
q2 AS (SELECT * FROM ONLY test.from_only_test)
500-
SELECT * FROM q1 JOIN q2 USING(val);
501-
QUERY PLAN
502-
---------------------------------------------
503-
Hash Join
504-
Hash Cond: (q1.val = q2.val)
505-
CTE q1
506-
-> Append
507-
-> Seq Scan on from_only_test_1
508-
-> Seq Scan on from_only_test_2
509-
-> Seq Scan on from_only_test_3
510-
-> Seq Scan on from_only_test_4
511-
-> Seq Scan on from_only_test_5
512-
-> Seq Scan on from_only_test_6
513-
-> Seq Scan on from_only_test_7
514-
-> Seq Scan on from_only_test_8
515-
-> Seq Scan on from_only_test_9
516-
-> Seq Scan on from_only_test_10
517-
CTE q2
518-
-> Seq Scan on from_only_test
519-
-> CTE Scan on q1
520-
-> Hash
521-
-> CTE Scan on q2
522-
(19 rows)
523-
524-
EXPLAIN (COSTS OFF)
525-
WITH q1 AS (SELECT * FROM ONLY test.from_only_test)
526-
SELECT * FROM test.from_only_test JOIN q1 USING(val);
527-
QUERY PLAN
528-
----------------------------------------------
529-
Hash Join
530-
Hash Cond: (from_only_test_1.val = q1.val)
531-
CTE q1
532-
-> Seq Scan on from_only_test
533-
-> Append
534-
-> Seq Scan on from_only_test_1
535-
-> Seq Scan on from_only_test_2
536-
-> Seq Scan on from_only_test_3
537-
-> Seq Scan on from_only_test_4
538-
-> Seq Scan on from_only_test_5
539-
-> Seq Scan on from_only_test_6
540-
-> Seq Scan on from_only_test_7
541-
-> Seq Scan on from_only_test_8
542-
-> Seq Scan on from_only_test_9
543-
-> Seq Scan on from_only_test_10
544-
-> Hash
545-
-> CTE Scan on q1
546-
(17 rows)
547-
548-
EXPLAIN (COSTS OFF)
549-
SELECT * FROM test.range_rel WHERE id = (SELECT id FROM ONLY test.range_rel LIMIT 1);
550-
QUERY PLAN
551-
--------------------------------------------------------
552-
Append
553-
InitPlan 1 (returns $0)
554-
-> Limit
555-
-> Seq Scan on range_rel
556-
-> Index Scan using range_rel_1_pkey on range_rel_1
557-
Index Cond: (id = $0)
558-
-> Index Scan using range_rel_2_pkey on range_rel_2
559-
Index Cond: (id = $0)
560-
-> Index Scan using range_rel_3_pkey on range_rel_3
561-
Index Cond: (id = $0)
562-
-> Index Scan using range_rel_4_pkey on range_rel_4
563-
Index Cond: (id = $0)
564-
(12 rows)
565-
566-
DROP TABLE test.from_only_test CASCADE;
567-
NOTICE: drop cascades to 10 other objects
568367
SET pg_pathman.enable_runtimeappend = OFF;
569368
SET pg_pathman.enable_runtimemergeappend = OFF;
570369
VACUUM;

expected/pathman_inserts.out

Lines changed: 16 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -856,6 +856,21 @@ NOTICE: AFTER INSERTION TRIGGER ON TABLE storage_14 HAS EXPIRED. INSERTED ROW:
856856
256 | 128 | test_inserts.storage_14
857857
(27 rows)
858858

859+
/* test gap case (missing partition in between) */
860+
CREATE TABLE test_inserts.test_gap(val INT NOT NULL);
861+
INSERT INTO test_inserts.test_gap SELECT generate_series(1, 30);
862+
SELECT create_range_partitions('test_inserts.test_gap', 'val', 1, 10);
863+
NOTICE: sequence "test_gap_seq" does not exist, skipping
864+
create_range_partitions
865+
-------------------------
866+
3
867+
(1 row)
868+
869+
DROP TABLE test_inserts.test_gap_2; /* make a gap */
870+
INSERT INTO test_inserts.test_gap VALUES(15); /* not ok */
871+
ERROR: cannot spawn a partition
872+
DROP TABLE test_inserts.test_gap CASCADE;
873+
NOTICE: drop cascades to 2 other objects
859874
DROP SCHEMA test_inserts CASCADE;
860-
NOTICE: drop cascades to 19 other objects
875+
NOTICE: drop cascades to 20 other objects
861876
DROP EXTENSION pg_pathman CASCADE;

0 commit comments

Comments
 (0)