Skip to content

Commit 9226acb

Browse files
committed
pathman_partition_list view added to migration script
1 parent b061957 commit 9226acb

File tree

1 file changed

+48
-7
lines changed

1 file changed

+48
-7
lines changed

pg_pathman--1.0--1.1.sql

Lines changed: 48 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,24 @@
1-
/***********************************************************************
1+
/* ------------------------------------------------------------------------
2+
*
3+
* pg_pathman--1.0--1.1.sql
4+
* Migration scripts to version 1.1
5+
*
6+
* Copyright (c) 2015-2016, Postgres Professional
7+
*
8+
* ------------------------------------------------------------------------
9+
*/
10+
11+
12+
/* ------------------------------------------------------------------------
213
* Modify config params table
3-
**********************************************************************/
14+
* ----------------------------------------------------------------------*/
415
ALTER TABLE @extschema@.pathman_config_params ADD COLUMN init_callback REGPROCEDURE NOT NULL DEFAULT 0;
516
ALTER TABLE @extschema@.pathman_config_params ALTER COLUMN enable_parent SET DEFAULT FALSE;
617

7-
/* Enable permissions */
18+
19+
/* ------------------------------------------------------------------------
20+
* Enable permissions
21+
* ----------------------------------------------------------------------*/
822
GRANT SELECT, INSERT, UPDATE, DELETE
923
ON @extschema@.pathman_config, @extschema@.pathman_config_params
1024
TO public;
@@ -27,8 +41,10 @@ ALTER TABLE @extschema@.pathman_config_params ENABLE ROW LEVEL SECURITY;
2741

2842
GRANT SELECT ON @extschema@.pathman_concurrent_part_tasks TO PUBLIC;
2943

30-
/* Drop irrelevant functions */
31-
DROP FUNCTION @extschema@.invalidate_relcache(OID);
44+
45+
/* ------------------------------------------------------------------------
46+
* Drop irrelevant functions
47+
* ----------------------------------------------------------------------*/
3248
DROP FUNCTION @extschema@.pathman_set_param(REGCLASS, TEXT, BOOLEAN);
3349
DROP FUNCTION @extschema@.enable_parent(REGCLASS);
3450
DROP FUNCTION @extschema@.disable_parent(relation REGCLASS);
@@ -61,7 +77,10 @@ DROP FUNCTION @extschema@.get_range_by_part_oid(REGCLASS, REGCLASS, ANYELEMENT);
6177
DROP FUNCTION @extschema@.get_min_range_value(REGCLASS, ANYELEMENT);
6278
DROP FUNCTION @extschema@.get_max_range_value(REGCLASS, ANYELEMENT);
6379

64-
/* Alter functions' modifiers */
80+
81+
/* ------------------------------------------------------------------------
82+
* Alter functions' modifiers
83+
* ----------------------------------------------------------------------*/
6584
ALTER FUNCTION @extschema@.partitions_count(REGCLASS) STRICT;
6685
ALTER FUNCTION @extschema@.partition_data(REGCLASS, OUT BIGINT) STRICT;
6786
ALTER FUNCTION @extschema@.disable_pathman_for(REGCLASS) STRICT;
@@ -71,7 +90,29 @@ ALTER FUNCTION @extschema@.drop_triggers(REGCLASS) STRICT;
7190
ALTER FUNCTION @extschema@.check_overlap(REGCLASS, ANYELEMENT, ANYELEMENT) CALLED ON NULL INPUT;
7291
ALTER FUNCTION @extschema@.find_or_create_range_partition(REGCLASS, ANYELEMENT) CALLED ON NULL INPUT;
7392

74-
/* Create functions */
93+
94+
/* ------------------------------------------------------------------------
95+
* Add new views
96+
* ----------------------------------------------------------------------*/
97+
CREATE OR REPLACE FUNCTION @extschema@.show_partition_list()
98+
RETURNS TABLE (
99+
parent REGCLASS,
100+
partition REGCLASS,
101+
parttype INT4,
102+
partattr TEXT,
103+
range_min TEXT,
104+
range_max TEXT)
105+
AS 'pg_pathman', 'show_partition_list_internal' LANGUAGE C STRICT;
106+
107+
CREATE OR REPLACE VIEW @extschema@.pathman_partition_list
108+
AS SELECT * FROM @extschema@.show_partition_list();
109+
110+
GRANT SELECT ON @extschema@.pathman_partition_list TO PUBLIC;
111+
112+
113+
/* ------------------------------------------------------------------------
114+
* (Re)create functions
115+
* ----------------------------------------------------------------------*/
75116
CREATE OR REPLACE FUNCTION @extschema@.pathman_set_param(
76117
relation REGCLASS,
77118
param TEXT,

0 commit comments

Comments
 (0)