Skip to content

Commit f6548ba

Browse files
committed
make function disable_pathman_for() also remove row in pathman_config_params
1 parent 3056b6d commit f6548ba

File tree

3 files changed

+46
-1
lines changed

3 files changed

+46
-1
lines changed

expected/pathman_calamity.out

Lines changed: 34 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -303,6 +303,39 @@ SELECT create_hash_partitions('calamity.hash_two_times', 'val', 2);
303303

304304
SELECT create_hash_partitions_internal('calamity.hash_two_times', 'val', 2);
305305
ERROR: cannot add new HASH partitions
306+
/* check function disable_pathman_for() */
307+
CREATE TABLE calamity.to_be_disabled(val INT NOT NULL);
308+
SELECT create_hash_partitions('calamity.to_be_disabled', 'val', 3); /* add row to main config */
309+
create_hash_partitions
310+
------------------------
311+
3
312+
(1 row)
313+
314+
SELECT set_enable_parent('calamity.to_be_disabled', true); /* add row to params */
315+
set_enable_parent
316+
-------------------
317+
318+
(1 row)
319+
320+
SELECT disable_pathman_for('calamity.to_be_disabled'); /* should delete both rows */
321+
NOTICE: function calamity.to_be_disabled_upd_trig_func() does not exist, skipping
322+
disable_pathman_for
323+
---------------------
324+
325+
(1 row)
326+
327+
SELECT count(*) FROM pathman_config WHERE partrel = 'calamity.to_be_disabled'::REGCLASS;
328+
count
329+
-------
330+
0
331+
(1 row)
332+
333+
SELECT count(*) FROM pathman_config_params WHERE partrel = 'calamity.to_be_disabled'::REGCLASS;
334+
count
335+
-------
336+
0
337+
(1 row)
338+
306339
DROP SCHEMA calamity CASCADE;
307-
NOTICE: drop cascades to 11 other objects
340+
NOTICE: drop cascades to 15 other objects
308341
DROP EXTENSION pg_pathman;

init.sql

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -340,7 +340,11 @@ $$
340340
BEGIN
341341
PERFORM @extschema@.validate_relname(parent_relid);
342342

343+
/* Delete rows from both config tables */
343344
DELETE FROM @extschema@.pathman_config WHERE partrel = parent_relid;
345+
DELETE FROM @extschema@.pathman_config_params WHERE partrel = parent_relid;
346+
347+
/* Drop triggers on update */
344348
PERFORM @extschema@.drop_triggers(parent_relid);
345349

346350
/* Notify backend about changes */

sql/pathman_calamity.sql

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -114,6 +114,14 @@ CREATE TABLE calamity.hash_two_times(val serial);
114114
SELECT create_hash_partitions('calamity.hash_two_times', 'val', 2);
115115
SELECT create_hash_partitions_internal('calamity.hash_two_times', 'val', 2);
116116

117+
/* check function disable_pathman_for() */
118+
CREATE TABLE calamity.to_be_disabled(val INT NOT NULL);
119+
SELECT create_hash_partitions('calamity.to_be_disabled', 'val', 3); /* add row to main config */
120+
SELECT set_enable_parent('calamity.to_be_disabled', true); /* add row to params */
121+
SELECT disable_pathman_for('calamity.to_be_disabled'); /* should delete both rows */
122+
SELECT count(*) FROM pathman_config WHERE partrel = 'calamity.to_be_disabled'::REGCLASS;
123+
SELECT count(*) FROM pathman_config_params WHERE partrel = 'calamity.to_be_disabled'::REGCLASS;
124+
117125

118126
DROP SCHEMA calamity CASCADE;
119127
DROP EXTENSION pg_pathman;

0 commit comments

Comments
 (0)