How to get a notification

From: Igor Korot <ikorot01(at)gmail(dot)com>
To: "pgsql-generallists(dot)postgresql(dot)org" <pgsql-general(at)lists(dot)postgresql(dot)org>
Subject: How to get a notification
Date: 2025-02-06 07:21:17
Message-ID: CA+FnnTw1fUZz8=4gqKFgfXw2RePNxpy1JjcPtD2w3vh6mdXhQw@mail.gmail.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-general

Hi, ALL,
In my code I'm running following:

queries.push_back( L"CREATE FUNCTION
__watch_schema_changes() RETURNS event_trigger LANGUAGE plpgsql AS $$
BEGIN NOTIFY tg_tag; END; $$;" );
queries.push_back( L"CREATE EVENT TRIGGER
schema_change_notify ON ddl_command_end WHEN TAG IN(\'CREATE TABLE\',
\'ALTER TABLE\', \'DROP TABLE\', \'CREATE INDEX\', \'DROP INDEX\')
EXECUTE PROCEDURE __watch_schema_changes();" );

My questions are:
1 Is there a better way to get notification about CREATE/ALTER/DROP TABLE?
2. How do I receive notification abut the event with the object name?

Thank you.

Responses

Browse pgsql-general by date

  From Date Subject
Next Message Paul Foerster 2025-02-06 09:04:21 libc to libicu via pg_dump/pg_restore?
Previous Message Adrian Klaver 2025-02-06 00:25:10 Re: Table copy