Skip to content

Commit 0916714

Browse files
committed
Merge commit 'a98a052fd7652aff8047a581135b100e5b817569' into PGPRO9_6
2 parents 77055b6 + a98a052 commit 0916714

File tree

9 files changed

+165
-86
lines changed

9 files changed

+165
-86
lines changed

contrib/pg_pathman/README.md

Lines changed: 114 additions & 39 deletions
Large diffs are not rendered by default.

contrib/pg_pathman/expected/pathman_basic.out

Lines changed: 27 additions & 27 deletions
Original file line numberDiff line numberDiff line change
@@ -889,9 +889,9 @@ SELECT * FROM test.hash_rel WHERE id = 123;
889889
*/
890890
SELECT pathman.drop_partitions('test.hash_rel');
891891
NOTICE: drop cascades to 3 other objects
892-
NOTICE: 2 rows copied from test.hash_rel_2
893-
NOTICE: 3 rows copied from test.hash_rel_1
894892
NOTICE: 2 rows copied from test.hash_rel_0
893+
NOTICE: 3 rows copied from test.hash_rel_1
894+
NOTICE: 2 rows copied from test.hash_rel_2
895895
drop_partitions
896896
-----------------
897897
3
@@ -925,11 +925,11 @@ SELECT COUNT(*) FROM ONLY test.hash_rel;
925925
DROP TABLE test.hash_rel CASCADE;
926926
SELECT pathman.drop_partitions('test.num_range_rel');
927927
NOTICE: drop cascades to 4 other objects
928-
NOTICE: 0 rows copied from test.num_range_rel_6
929-
NOTICE: 2 rows copied from test.num_range_rel_4
930-
NOTICE: 1000 rows copied from test.num_range_rel_3
931-
NOTICE: 1000 rows copied from test.num_range_rel_2
932928
NOTICE: 998 rows copied from test.num_range_rel_1
929+
NOTICE: 1000 rows copied from test.num_range_rel_2
930+
NOTICE: 1000 rows copied from test.num_range_rel_3
931+
NOTICE: 2 rows copied from test.num_range_rel_4
932+
NOTICE: 0 rows copied from test.num_range_rel_6
933933
drop_partitions
934934
-----------------
935935
5
@@ -1108,9 +1108,9 @@ EXPLAIN (COSTS OFF) SELECT * FROM test."TeSt" WHERE a = 1;
11081108

11091109
SELECT pathman.drop_partitions('test."TeSt"');
11101110
NOTICE: drop cascades to 3 other objects
1111-
NOTICE: 3 rows copied from test."TeSt_2"
1112-
NOTICE: 0 rows copied from test."TeSt_1"
11131111
NOTICE: 0 rows copied from test."TeSt_0"
1112+
NOTICE: 0 rows copied from test."TeSt_1"
1113+
NOTICE: 3 rows copied from test."TeSt_2"
11141114
drop_partitions
11151115
-----------------
11161116
3
@@ -1163,11 +1163,11 @@ SELECT pathman.split_range_partition('test."RangeRel_1"', '2015-01-01'::DATE);
11631163

11641164
SELECT pathman.drop_partitions('test."RangeRel"');
11651165
NOTICE: function test.RangeRel_upd_trig_func() does not exist, skipping
1166-
NOTICE: 1 rows copied from test."RangeRel_6"
1167-
NOTICE: 0 rows copied from test."RangeRel_4"
1168-
NOTICE: 1 rows copied from test."RangeRel_3"
1169-
NOTICE: 1 rows copied from test."RangeRel_2"
11701166
NOTICE: 0 rows copied from test."RangeRel_1"
1167+
NOTICE: 1 rows copied from test."RangeRel_2"
1168+
NOTICE: 1 rows copied from test."RangeRel_3"
1169+
NOTICE: 0 rows copied from test."RangeRel_4"
1170+
NOTICE: 1 rows copied from test."RangeRel_6"
11711171
drop_partitions
11721172
-----------------
11731173
5
@@ -1199,9 +1199,9 @@ SELECT pathman.create_range_partitions('test."RangeRel"', 'id', 1, 100, 3);
11991199

12001200
SELECT pathman.drop_partitions('test."RangeRel"');
12011201
NOTICE: function test.RangeRel_upd_trig_func() does not exist, skipping
1202-
NOTICE: 0 rows copied from test."RangeRel_3"
1203-
NOTICE: 0 rows copied from test."RangeRel_2"
12041202
NOTICE: 0 rows copied from test."RangeRel_1"
1203+
NOTICE: 0 rows copied from test."RangeRel_2"
1204+
NOTICE: 0 rows copied from test."RangeRel_3"
12051205
drop_partitions
12061206
-----------------
12071207
3
@@ -1358,20 +1358,20 @@ DELETE FROM range_rel r USING tmp t WHERE r.dt = '2010-01-02' AND r.id = t.id;
13581358
/* Create range partitions from whole range */
13591359
SELECT drop_partitions('range_rel');
13601360
NOTICE: function public.range_rel_upd_trig_func() does not exist, skipping
1361-
NOTICE: 0 rows copied from range_rel_15
1362-
NOTICE: 0 rows copied from range_rel_14
1363-
NOTICE: 14 rows copied from range_rel_13
1364-
NOTICE: 31 rows copied from range_rel_12
1365-
NOTICE: 30 rows copied from range_rel_11
1366-
NOTICE: 31 rows copied from range_rel_10
1367-
NOTICE: 30 rows copied from range_rel_9
1368-
NOTICE: 31 rows copied from range_rel_8
1369-
NOTICE: 31 rows copied from range_rel_7
1370-
NOTICE: 29 rows copied from range_rel_6
1371-
NOTICE: 31 rows copied from range_rel_5
1372-
NOTICE: 30 rows copied from range_rel_4
1373-
NOTICE: 31 rows copied from range_rel_3
13741361
NOTICE: 44 rows copied from range_rel_1
1362+
NOTICE: 31 rows copied from range_rel_3
1363+
NOTICE: 30 rows copied from range_rel_4
1364+
NOTICE: 31 rows copied from range_rel_5
1365+
NOTICE: 29 rows copied from range_rel_6
1366+
NOTICE: 31 rows copied from range_rel_7
1367+
NOTICE: 31 rows copied from range_rel_8
1368+
NOTICE: 30 rows copied from range_rel_9
1369+
NOTICE: 31 rows copied from range_rel_10
1370+
NOTICE: 30 rows copied from range_rel_11
1371+
NOTICE: 31 rows copied from range_rel_12
1372+
NOTICE: 14 rows copied from range_rel_13
1373+
NOTICE: 0 rows copied from range_rel_14
1374+
NOTICE: 0 rows copied from range_rel_15
13751375
drop_partitions
13761376
-----------------
13771377
14

contrib/pg_pathman/expected/pathman_callbacks.out

Lines changed: 8 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -18,10 +18,10 @@ NOTICE: sequence "abc_seq" does not exist, skipping
1818
2
1919
(1 row)
2020

21-
SELECT set_part_init_callback('callbacks.abc',
22-
'callbacks.abc_on_part_created_callback');
23-
set_part_init_callback
24-
------------------------
21+
SELECT set_init_callback('callbacks.abc',
22+
'callbacks.abc_on_part_created_callback');
23+
set_init_callback
24+
-------------------
2525

2626
(1 row)
2727

@@ -62,10 +62,10 @@ NOTICE: 0 rows copied from callbacks.abc_6
6262
(1 row)
6363

6464
/* set callback to be called on HASH partitions */
65-
SELECT set_part_init_callback('callbacks.abc',
66-
'callbacks.abc_on_part_created_callback');
67-
set_part_init_callback
68-
------------------------
65+
SELECT set_init_callback('callbacks.abc',
66+
'callbacks.abc_on_part_created_callback');
67+
set_init_callback
68+
-------------------
6969

7070
(1 row)
7171

contrib/pg_pathman/hash.sql

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,7 @@ CREATE OR REPLACE FUNCTION @extschema@.create_hash_partitions(
1515
parent_relid REGCLASS,
1616
attribute TEXT,
1717
partitions_count INTEGER,
18-
partition_data BOOLEAN DEFAULT true)
18+
partition_data BOOLEAN DEFAULT TRUE)
1919
RETURNS INTEGER AS
2020
$$
2121
DECLARE

contrib/pg_pathman/init.sql

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -135,9 +135,9 @@ LANGUAGE plpgsql STRICT;
135135
/*
136136
* Set partition creation callback
137137
*/
138-
CREATE OR REPLACE FUNCTION @extschema@.set_part_init_callback(
138+
CREATE OR REPLACE FUNCTION @extschema@.set_init_callback(
139139
relation REGCLASS,
140-
callback REGPROC)
140+
callback REGPROC DEFAULT 0)
141141
RETURNS VOID AS
142142
$$
143143
BEGIN
@@ -535,7 +535,8 @@ BEGIN
535535

536536
FOR v_rec IN (SELECT inhrelid::REGCLASS AS tbl
537537
FROM pg_catalog.pg_inherits
538-
WHERE inhparent::regclass = parent_relid)
538+
WHERE inhparent::regclass = parent_relid
539+
ORDER BY inhrelid ASC)
539540
LOOP
540541
IF NOT delete_data THEN
541542
EXECUTE format('WITH part_data AS (DELETE FROM %s RETURNING *)

contrib/pg_pathman/sql/pathman_callbacks.sql

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -18,8 +18,8 @@ $$ language plpgsql;
1818
CREATE TABLE callbacks.abc(a serial, b int);
1919
SELECT create_range_partitions('callbacks.abc', 'a', 1, 100, 2);
2020

21-
SELECT set_part_init_callback('callbacks.abc',
22-
'callbacks.abc_on_part_created_callback');
21+
SELECT set_init_callback('callbacks.abc',
22+
'callbacks.abc_on_part_created_callback');
2323

2424
INSERT INTO callbacks.abc VALUES (123, 1);
2525
INSERT INTO callbacks.abc VALUES (223, 1);
@@ -32,8 +32,8 @@ SELECT drop_partitions('callbacks.abc');
3232

3333

3434
/* set callback to be called on HASH partitions */
35-
SELECT set_part_init_callback('callbacks.abc',
36-
'callbacks.abc_on_part_created_callback');
35+
SELECT set_init_callback('callbacks.abc',
36+
'callbacks.abc_on_part_created_callback');
3737
SELECT create_hash_partitions('callbacks.abc', 'a', 5);
3838

3939

contrib/pg_pathman/src/init.c

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -118,7 +118,7 @@ init_main_pathman_toggles(void)
118118
NULL,
119119
&pg_pathman_init_state.pg_pathman_enable,
120120
true,
121-
PGC_USERSET,
121+
PGC_SUSET,
122122
0,
123123
NULL,
124124
pg_pathman_enable_assign_hook,
@@ -130,7 +130,7 @@ init_main_pathman_toggles(void)
130130
NULL,
131131
&pg_pathman_init_state.auto_partition,
132132
true,
133-
PGC_USERSET,
133+
PGC_SUSET,
134134
0,
135135
NULL,
136136
NULL,
@@ -142,7 +142,7 @@ init_main_pathman_toggles(void)
142142
NULL,
143143
&pg_pathman_init_state.override_copy,
144144
true,
145-
PGC_USERSET,
145+
PGC_SUSET,
146146
0,
147147
NULL,
148148
NULL,

contrib/pg_pathman/src/partition_filter.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -92,7 +92,7 @@ init_partition_filter_static_data(void)
9292
NULL,
9393
&pg_pathman_enable_partition_filter,
9494
true,
95-
PGC_USERSET,
95+
PGC_SUSET,
9696
0,
9797
NULL,
9898
NULL,

contrib/pg_pathman/src/utils.c

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -700,6 +700,9 @@ validate_on_part_init_cb(Oid procid, bool emit_error)
700700
Form_pg_proc functup;
701701
bool is_ok = true;
702702

703+
if (procid == InvalidOid)
704+
return true;
705+
703706
tp = SearchSysCache1(PROCOID, ObjectIdGetDatum(procid));
704707
if (!HeapTupleIsValid(tp))
705708
elog(ERROR, "cache lookup failed for function %u", procid);

0 commit comments

Comments
 (0)
pFad - Phonifier reborn

Pfad - The Proxy pFad of © 2024 Garber Painting. All rights reserved.

Note: This service is not intended for secure transactions such as banking, social media, email, or purchasing. Use at your own risk. We assume no liability whatsoever for broken pages.


Alternative Proxies:

Alternative Proxy

pFad Proxy

pFad v3 Proxy

pFad v4 Proxy