]> granicus.if.org Git - postgresql/commit
Fix race conditions when an event trigger is added concurrently with DDL.
authorTom Lane <tgl@sss.pgh.pa.us>
Fri, 20 Apr 2018 21:15:31 +0000 (17:15 -0400)
committerTom Lane <tgl@sss.pgh.pa.us>
Fri, 20 Apr 2018 21:15:31 +0000 (17:15 -0400)
commitb1b71f16581fb5385fa9f9a663ffee271cdfaba5
treeda0a5ad781fa9f5d8092a80c6fbc27ad5c678bf7
parentec38dcd363cd63f2a1f3cc4c47680bb16e8331b4
Fix race conditions when an event trigger is added concurrently with DDL.

EventTriggerTableRewrite crashed if there were table_rewrite triggers
present, but there had not been when the calling command started.

EventTriggerDDLCommandEnd called ddl_command_end triggers if present,
even if there had been no such triggers when the calling command started,
which would lead to a failure in pg_event_trigger_ddl_commands.

In both cases, fix by doing nothing; it's better to wait till the next
command when things will be properly initialized.

In passing, remove an elog(DEBUG1) call that might have seemed interesting
four years ago but surely isn't today.

We found this because of intermittent failures in the buildfarm.  Thanks
to Alvaro Herrera and Andrew Gierth for analysis.

Back-patch to 9.5; some of this code exists before that, but the specific
hazards we need to guard against don't.

Discussion: https://postgr.es/m/5767.1523995174@sss.pgh.pa.us
src/backend/commands/event_trigger.c