make enable/disable trigger idempotent
This commit is contained in:
parent
ab6720ad32
commit
e3138cd56a
@ -91,9 +91,10 @@ CREATE OR REPLACE FUNCTION CDB_EnableGhostTablesTrigger()
|
||||
RETURNS void
|
||||
AS $$
|
||||
BEGIN
|
||||
DROP EVENT TRIGGER IF EXISTS link_ghost_tables;
|
||||
CREATE EVENT TRIGGER link_ghost_tables
|
||||
ON ddl_command_end
|
||||
WHEN TAG IN ('CREATE TABLE', 'SELECT INTO', 'DROP TABLE', 'ALTER TABLE', 'CREATE TRIGGER', 'DROP TRIGGER', 'CREATE VIEW', 'DROP VIEW', 'ALTER VIEW')
|
||||
WHEN TAG IN ('CREATE TABLE', 'SELECT INTO', 'DROP TABLE', 'ALTER TABLE', 'CREATE TRIGGER', 'DROP TRIGGER')
|
||||
EXECUTE PROCEDURE CDB_SaveDDLTransaction();
|
||||
END;
|
||||
$$ LANGUAGE plpgsql VOLATILE PARALLEL UNSAFE;
|
||||
@ -103,6 +104,6 @@ CREATE OR REPLACE FUNCTION CDB_DisableGhostTablesTrigger()
|
||||
RETURNS void
|
||||
AS $$
|
||||
BEGIN
|
||||
DROP EVENT TRIGGER link_ghost_tables;
|
||||
DROP EVENT TRIGGER IF EXISTS link_ghost_tables;
|
||||
END;
|
||||
$$ LANGUAGE plpgsql VOLATILE PARALLEL UNSAFE;
|
||||
|
Loading…
Reference in New Issue
Block a user