public inbox for [email protected]
help / color / mirror / Atom feedFrom: Igor Korot <[email protected]>
To: Adrian Klaver <[email protected]>
Cc: pgsql-generallists.postgresql.org <[email protected]>
Subject: Re: How to get a notification
Date: Fri, 7 Feb 2025 13:02:19 -0600
Message-ID: <CA+FnnTwe-JrnToK1tZD9J+ZMMM571cSvX3tyf0i3feL7QWSDOA@mail.gmail.com> (raw)
In-Reply-To: <[email protected]>
References: <CA+FnnTw1fUZz8=4gqKFgfXw2RePNxpy1JjcPtD2w3vh6mdXhQw@mail.gmail.com>
<[email protected]>
Hi, Adrian,
On Fri, Feb 7, 2025 at 11:07 AM Adrian Klaver <[email protected]> wrote:
>
> On 2/5/25 23:21, Igor Korot wrote:
> > 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?
>
> An alternate solution:
>
> https://www.pgaudit.org/
>
> Whether it is better or not is something you will need to decide.
>
> > 2. How do I receive notification abut the event with the object name?
>
> Use information from here?:
>
> https://www.postgresql.org/docs/current/functions-event-triggers.html#PG-EVENT-TRIGGER-DDL-COMMAND-E...
Thx for the link
So basically all I need to do is to call
SELECT pg_event_trigger_ddl_commands ()
right?
In both ODBC amd libpq interfaces?
Thank you.
>
> >
> > Thank you.
> >
> >
>
> --
> Adrian Klaver
> [email protected]
>
view thread (6+ messages) latest in thread
reply
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Reply to all the recipients using the --to and --cc options:
reply via email
To: [email protected]
Cc: [email protected], [email protected], [email protected]
Subject: Re: How to get a notification
In-Reply-To: <CA+FnnTwe-JrnToK1tZD9J+ZMMM571cSvX3tyf0i3feL7QWSDOA@mail.gmail.com>
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
This inbox is served by agora; see mirroring instructions
for how to clone and mirror all data and code used for this inbox