File tree Expand file tree Collapse file tree 1 file changed +26
-0
lines changed Expand file tree Collapse file tree 1 file changed +26
-0
lines changed Original file line number Diff line number Diff line change @@ -89,6 +89,7 @@ DROP FUNCTION @extschema@.on_create_partitions(REGCLASS);
89
89
DROP FUNCTION @extschema@.on_update_partitions(REGCLASS);
90
90
DROP FUNCTION @extschema@.on_remove_partitions(REGCLASS);
91
91
DROP FUNCTION @extschema@.is_attribute_nullable(REGCLASS, TEXT );
92
+ DROP FUNCTION @extschema@.build_check_constraint_name(REGCLASS, TEXT );
92
93
DROP FUNCTION @extschema@.build_check_constraint_name(REGCLASS, INT2);
93
94
DROP FUNCTION @extschema@.add_to_pathman_config(REGCLASS, TEXT , TEXT );
94
95
DROP FUNCTION @extschema@.lock_partitioned_relation(REGCLASS);
257
258
$$ LANGUAGE plpgsql;
258
259
259
260
261
+ CREATE OR REPLACE FUNCTION @extschema@.pathman_ddl_trigger_func()
262
+ RETURNS event_trigger AS $$
263
+ DECLARE
264
+ obj RECORD;
265
+ pg_class_oid OID ;
266
+ relids REGCLASS[];
267
+
268
+ BEGIN
269
+ pg_class_oid = ' pg_catalog.pg_class' ::regclass;
270
+
271
+ /* Find relids to remove from config */
272
+ SELECT array_agg(cfg .partrel ) INTO relids
273
+ FROM pg_event_trigger_dropped_objects() AS events
274
+ JOIN @extschema@.pathman_config AS cfg ON cfg .partrel ::oid = events .objid
275
+ WHERE events .classid = pg_class_oid AND events .objsubid = 0 ;
276
+
277
+ /* Cleanup pathman_config */
278
+ DELETE FROM @extschema@.pathman_config WHERE partrel = ANY(relids);
279
+
280
+ /* Cleanup params table too */
281
+ DELETE FROM @extschema@.pathman_config_params WHERE partrel = ANY(relids);
282
+ END
283
+ $$ LANGUAGE plpgsql;
284
+
285
+
260
286
CREATE OR REPLACE FUNCTION @extschema@.create_naming_sequence(
261
287
parent_relid REGCLASS)
262
288
RETURNS TEXT AS $$
You can’t perform that action at this time.
0 commit comments