Skip to content

Commit 19e59f0

Browse files
committed
Merge commit '4e2d48cf89e400a1926b97b0c8702ccc872e7006' into PGPRO9_6_pathman
2 parents 11a2dfb + 4e2d48c commit 19e59f0

File tree

9 files changed

+1250
-43
lines changed

9 files changed

+1250
-43
lines changed

contrib/pg_pathman/Makefile

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,8 @@ EXTVERSION = 1.3
1616
DATA_built = pg_pathman--$(EXTVERSION).sql
1717

1818
DATA = pg_pathman--1.0--1.1.sql \
19-
pg_pathman--1.1--1.2.sql
19+
pg_pathman--1.1--1.2.sql \
20+
pg_pathman--1.2--1.3.sql
2021

2122
PGFILEDESC = "pg_pathman - partitioning tool"
2223

contrib/pg_pathman/expected/pathman_calamity.out

Lines changed: 75 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -670,3 +670,78 @@ NOTICE: drop cascades to table calamity.test_range_oid_1
670670
DROP SCHEMA calamity CASCADE;
671671
NOTICE: drop cascades to 18 other objects
672672
DROP EXTENSION pg_pathman;
673+
/*
674+
* ------------------------------------------
675+
* Special tests (uninitialized pg_pathman)
676+
* ------------------------------------------
677+
*/
678+
CREATE SCHEMA calamity;
679+
CREATE EXTENSION pg_pathman;
680+
/* check function pathman_cache_search_relid() */
681+
CREATE TABLE calamity.survivor(val INT NOT NULL);
682+
SELECT create_range_partitions('calamity.survivor', 'val', 1, 10, 2);
683+
NOTICE: sequence "survivor_seq" does not exist, skipping
684+
create_range_partitions
685+
-------------------------
686+
2
687+
(1 row)
688+
689+
DROP EXTENSION pg_pathman CASCADE;
690+
SET pg_pathman.enable = f; /* DON'T LOAD CONFIG */
691+
NOTICE: RuntimeAppend, RuntimeMergeAppend and PartitionFilter nodes and some other options have been disabled
692+
CREATE EXTENSION pg_pathman;
693+
SHOW pg_pathman.enable;
694+
pg_pathman.enable
695+
-------------------
696+
off
697+
(1 row)
698+
699+
SELECT add_to_pathman_config('calamity.survivor', 'val', '10'); /* not ok */
700+
ERROR: pg_pathman is not initialized yet
701+
SELECT * FROM pathman_partition_list; /* not ok */
702+
ERROR: pg_pathman is not initialized yet
703+
SELECT get_part_range('calamity.survivor', 0, NULL::INT); /* not ok */
704+
ERROR: pg_pathman is not initialized yet
705+
EXPLAIN (COSTS OFF) SELECT * FROM calamity.survivor; /* OK */
706+
QUERY PLAN
707+
------------------------------
708+
Append
709+
-> Seq Scan on survivor
710+
-> Seq Scan on survivor_1
711+
-> Seq Scan on survivor_2
712+
(4 rows)
713+
714+
SET pg_pathman.enable = t; /* LOAD CONFIG */
715+
NOTICE: RuntimeAppend, RuntimeMergeAppend and PartitionFilter nodes and some other options have been enabled
716+
SELECT add_to_pathman_config('calamity.survivor', 'val', '10'); /* OK */
717+
add_to_pathman_config
718+
-----------------------
719+
t
720+
(1 row)
721+
722+
SELECT * FROM pathman_partition_list; /* OK */
723+
parent | partition | parttype | partattr | range_min | range_max
724+
-------------------+---------------------+----------+----------+-----------+-----------
725+
calamity.survivor | calamity.survivor_1 | 2 | val | 1 | 11
726+
calamity.survivor | calamity.survivor_2 | 2 | val | 11 | 21
727+
(2 rows)
728+
729+
SELECT get_part_range('calamity.survivor', 0, NULL::INT); /* OK */
730+
get_part_range
731+
----------------
732+
{1,11}
733+
(1 row)
734+
735+
EXPLAIN (COSTS OFF) SELECT * FROM calamity.survivor; /* OK */
736+
QUERY PLAN
737+
------------------------------
738+
Append
739+
-> Seq Scan on survivor_1
740+
-> Seq Scan on survivor_2
741+
(3 rows)
742+
743+
DROP TABLE calamity.survivor CASCADE;
744+
NOTICE: drop cascades to 2 other objects
745+
DROP SCHEMA calamity CASCADE;
746+
NOTICE: drop cascades to sequence calamity.survivor_seq
747+
DROP EXTENSION pg_pathman;

contrib/pg_pathman/init.sql

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -251,7 +251,7 @@ LANGUAGE plpgsql;
251251
CREATE OR REPLACE FUNCTION @extschema@.show_partition_list()
252252
RETURNS TABLE (
253253
parent REGCLASS,
254-
"partition" REGCLASS,
254+
partition REGCLASS,
255255
parttype INT4,
256256
partattr TEXT,
257257
range_min TEXT,
@@ -880,7 +880,7 @@ LANGUAGE C STRICT;
880880
*/
881881
CREATE OR REPLACE FUNCTION @extschema@.invoke_on_partition_created_callback(
882882
parent_relid REGCLASS,
883-
"partition" REGCLASS,
883+
partition_relid REGCLASS,
884884
init_callback REGPROCEDURE,
885885
start_value ANYELEMENT,
886886
end_value ANYELEMENT)
@@ -892,7 +892,7 @@ LANGUAGE C;
892892
*/
893893
CREATE OR REPLACE FUNCTION @extschema@.invoke_on_partition_created_callback(
894894
parent_relid REGCLASS,
895-
"partition" REGCLASS,
895+
partition_relid REGCLASS,
896896
init_callback REGPROCEDURE)
897897
RETURNS VOID AS 'pg_pathman', 'invoke_on_partition_created_callback'
898898
LANGUAGE C;

0 commit comments

Comments
 (0)