event trigger clarification

Started by Marc Millasover 2 years ago5 messagesgeneral
Jump to latest
#1Marc Millas
marc.millas@mokadb.com

Hi,
the doc v15 states: " pg_event_trigger_ddl_commands returns a list of
DDL commands
executed by each user action, when invoked in a function attached to a
ddl_command_end event trigger."
When some ddl command is executed within a block, I would like to know if
the event trigger fires when the line is executed or at commit time.

thanks.

Marc MILLAS
Senior Architect
+33607850334
www.mokadb.com

#2Erik Wienhold
ewie@ewie.name
In reply to: Marc Millas (#1)
Re: event trigger clarification

On 30/08/2023 17:12 CEST Marc Millas <marc.millas@mokadb.com> wrote:

the doc v15 states: " pg_event_trigger_ddl_commands returns a list of DDL
commands executed by each user action, when invoked in a function attached
to a ddl_command_end event trigger."
When some ddl command is executed within a block, I would like to know if the
event trigger fires when the line is executed or at commit time.

The event trigger fires just before[1]https://git.postgresql.org/gitweb/?p=postgresql.git;a=blob;f=src/backend/tcop/utility.c;h=6b0a8652622b26887ea2ccd15ced3300e951c5dc#l1120/after[2]https://git.postgresql.org/gitweb/?p=postgresql.git;a=blob;f=src/backend/tcop/utility.c;h=6b0a8652622b26887ea2ccd15ced3300e951c5dc#l1923 executing a complete command.
So not at commit time.

[1]: https://git.postgresql.org/gitweb/?p=postgresql.git;a=blob;f=src/backend/tcop/utility.c;h=6b0a8652622b26887ea2ccd15ced3300e951c5dc#l1120
[2]: https://git.postgresql.org/gitweb/?p=postgresql.git;a=blob;f=src/backend/tcop/utility.c;h=6b0a8652622b26887ea2ccd15ced3300e951c5dc#l1923

--
Erik

#3David G. Johnston
david.g.johnston@gmail.com
In reply to: Marc Millas (#1)
Re: event trigger clarification

On Wednesday, August 30, 2023, Marc Millas <marc.millas@mokadb.com> wrote:

Hi,
the doc v15 states: " pg_event_trigger_ddl_commands returns a list of DDL commands
executed by each user action, when invoked in a function attached to a
ddl_command_end event trigger."
When some ddl command is executed within a block, I would like to know if
the event trigger fires when the line is executed or at commit time.

https://www.postgresql.org/docs/current/event-trigger-definition.html

There is nothing there about event execution being able to be deferred.

David J.

#4Marc Millas
marc.millas@mokadb.com
In reply to: David G. Johnston (#3)
Re: event trigger clarification

Thanks !
Marc MILLAS
Senior Architect
+33607850334
www.mokadb.com

On Wed, Aug 30, 2023 at 8:44 PM David G. Johnston <
david.g.johnston@gmail.com> wrote:

Show quoted text

On Wednesday, August 30, 2023, Marc Millas <marc.millas@mokadb.com> wrote:

Hi,
the doc v15 states: " pg_event_trigger_ddl_commands returns a list of DDL commands
executed by each user action, when invoked in a function attached to a
ddl_command_end event trigger."
When some ddl command is executed within a block, I would like to know if
the event trigger fires when the line is executed or at commit time.

https://www.postgresql.org/docs/current/event-trigger-definition.html

There is nothing there about event execution being able to be deferred.

David J.

#5Marc Millas
marc.millas@mokadb.com
In reply to: Erik Wienhold (#2)
Re: event trigger clarification

Thanks !
Marc MILLAS
Senior Architect
+33607850334
www.mokadb.com

On Wed, Aug 30, 2023 at 6:18 PM Erik Wienhold <ewie@ewie.name> wrote:

Show quoted text

On 30/08/2023 17:12 CEST Marc Millas <marc.millas@mokadb.com> wrote:

the doc v15 states: " pg_event_trigger_ddl_commands returns a list of DDL
commands executed by each user action, when invoked in a function

attached

to a ddl_command_end event trigger."
When some ddl command is executed within a block, I would like to know

if the

event trigger fires when the line is executed or at commit time.

The event trigger fires just before[1]/after[2] executing a complete
command.
So not at commit time.

[1]
https://git.postgresql.org/gitweb/?p=postgresql.git;a=blob;f=src/backend/tcop/utility.c;h=6b0a8652622b26887ea2ccd15ced3300e951c5dc#l1120
[2]
https://git.postgresql.org/gitweb/?p=postgresql.git;a=blob;f=src/backend/tcop/utility.c;h=6b0a8652622b26887ea2ccd15ced3300e951c5dc#l1923

--
Erik