postgresql/src/backend/commands
Tom Lane b1b71f1658 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
2018-04-20 17:15:31 -04:00
..
aggregatecmds.c Merge catalog/pg_foo_fn.h headers back into pg_foo.h headers. 2018-04-08 14:35:29 -04:00
alter.c Replace AclObjectKind with ObjectType 2018-01-19 14:01:15 -05:00
amcmds.c Update copyright for 2018 2018-01-02 23:30:12 -05:00
analyze.c Rename IndexInfo.ii_KeyAttrNumbers array 2018-04-12 13:02:45 +03:00
async.c Update copyright for 2018 2018-01-02 23:30:12 -05:00
cluster.c Combine options for RangeVarGetRelidExtended() into a flags argument. 2018-03-30 17:05:16 -07:00
collationcmds.c Merge catalog/pg_foo_fn.h headers back into pg_foo.h headers. 2018-04-08 14:35:29 -04:00
comment.c Update copyright for 2018 2018-01-02 23:30:12 -05:00
constraint.c Update copyright for 2018 2018-01-02 23:30:12 -05:00
conversioncmds.c Merge catalog/pg_foo_fn.h headers back into pg_foo.h headers. 2018-04-08 14:35:29 -04:00
copy.c Allow insert and update tuple routing and COPY for foreign tables. 2018-04-06 19:22:03 -04:00
createas.c Update copyright for 2018 2018-01-02 23:30:12 -05:00
dbcommands.c Rename TransactionChain functions 2018-03-16 13:18:06 -04:00
define.c Update copyright for 2018 2018-01-02 23:30:12 -05:00
discard.c Rename TransactionChain functions 2018-03-16 13:18:06 -04:00
dropcmds.c Add prokind column, replacing proisagg and proiswindow 2018-03-02 13:48:33 -05:00
event_trigger.c Fix race conditions when an event trigger is added concurrently with DDL. 2018-04-20 17:15:31 -04:00
explain.c Revert MERGE patch 2018-04-12 11:22:56 +01:00
extension.c Replace AclObjectKind with ObjectType 2018-01-19 14:01:15 -05:00
foreigncmds.c Replace AclObjectKind with ObjectType 2018-01-19 14:01:15 -05:00
functioncmds.c Support named and default arguments in CALL 2018-04-14 09:13:53 -04:00
indexcmds.c Better fix for deadlock hazard in CREATE INDEX CONCURRENTLY. 2018-04-18 12:07:37 -04:00
lockcmds.c Add more infinite recursion detection while locking a view. 2018-04-17 16:59:17 +09:00
Makefile Implement multivariate n-distinct coefficients 2017-03-24 14:06:10 -03:00
matview.c Indexes with INCLUDE columns and their support in B-tree 2018-04-07 23:00:39 +03:00
opclasscmds.c Support all SQL:2011 options for window frame clauses. 2018-02-07 00:06:56 -05:00
operatorcmds.c Merge catalog/pg_foo_fn.h headers back into pg_foo.h headers. 2018-04-08 14:35:29 -04:00
policy.c Rename MemoryContextCopySetIdentifier() for clarity 2018-04-06 12:37:54 -04:00
portalcmds.c Rename TransactionChain functions 2018-03-16 13:18:06 -04:00
prepare.c Revert MERGE patch 2018-04-12 11:22:56 +01:00
proclang.c Merge catalog/pg_foo_fn.h headers back into pg_foo.h headers. 2018-04-08 14:35:29 -04:00
publicationcmds.c Merge catalog/pg_foo_fn.h headers back into pg_foo.h headers. 2018-04-08 14:35:29 -04:00
schemacmds.c Replace AclObjectKind with ObjectType 2018-01-19 14:01:15 -05:00
seclabel.c Update copyright for 2018 2018-01-02 23:30:12 -05:00
sequence.c Combine options for RangeVarGetRelidExtended() into a flags argument. 2018-03-30 17:05:16 -07:00
statscmds.c Fix bogus Name assignment in CreateStatistics 2018-03-06 13:20:40 -03:00
subscriptioncmds.c Split the SetSubscriptionRelState function into two 2018-04-06 10:00:26 -04:00
tablecmds.c Reorganize partitioning code 2018-04-14 21:12:14 -03:00
tablespace.c Refactor dir/file permissions 2018-04-07 17:45:39 -04:00
trigger.c Reorganize partitioning code 2018-04-14 21:12:14 -03:00
tsearchcmds.c Avoid unnecessary use of pg_strcasecmp for already-downcased identifiers. 2018-01-26 18:25:14 -05:00
typecmds.c Merge catalog/pg_foo_fn.h headers back into pg_foo.h headers. 2018-04-08 14:35:29 -04:00
user.c Replace AclObjectKind with ObjectType 2018-01-19 14:01:15 -05:00
vacuum.c Merge catalog/pg_foo_fn.h headers back into pg_foo.h headers. 2018-04-08 14:35:29 -04:00
vacuumlazy.c Further cleanup of client dependencies on src/include/catalog headers. 2018-04-09 14:39:58 -04:00
variable.c Update copyright for 2018 2018-01-02 23:30:12 -05:00
view.c Avoid unnecessary use of pg_strcasecmp for already-downcased identifiers. 2018-01-26 18:25:14 -05:00