Created
August 14, 2019 14:45
-
-
Save pauldzy/9e581f9672480bf78b792b793aaa97d6 to your computer and use it in GitHub Desktop.
Alternative notify_ddl_postgrest event trigger
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
CREATE OR REPLACE FUNCTION public.notify_ddl_postgrest() | |
RETURNS event_trigger | |
AS $$ | |
DECLARE | |
obj RECORD; | |
BEGIN | |
FOR obj IN SELECT * FROM pg_event_trigger_ddl_commands() | |
LOOP | |
IF obj.object_type IN ('type','function','procedure') | |
THEN | |
NOTIFY ddl_command_end; | |
END IF; | |
END LOOP; | |
END; | |
$$ LANGUAGE 'plpgsql'; | |
CREATE EVENT TRIGGER ddl_postgrest ON ddl_command_end EXECUTE PROCEDURE public.notify_ddl_postgrest(); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment