pgsql: Fix unsafe event-trigger coding in ProcessUtility().

From: Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us>
To: pgsql-committers(at)postgresql(dot)org
Subject: pgsql: Fix unsafe event-trigger coding in ProcessUtility().
Date: 2013-04-28 03:12:03
Message-ID: E1UWI1z-0001gp-9J@gemulon.postgresql.org
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-committers

Fix unsafe event-trigger coding in ProcessUtility().

We mustn't run any of the event-trigger support code when handling
utility statements like START TRANSACTION or ABORT, because that code
may need to refresh event-trigger cache data, which requires being
inside a valid transaction. (This mistake explains the consistent
build failures exhibited by the CLOBBER_CACHE_ALWAYS buildfarm members,
as well as some irreproducible failures on other members.)

The least messy fix seems to be to break standard_ProcessUtility into two
functions, one that handles all the statements not supported by event
triggers, and one that contains the event-trigger support code and handles
the statements that are supported by event triggers.

This change also fixes several inconsistencies, such as four cases where
support had been installed for "ddl_event_start" but not "ddl_event_end"
triggers, plus the fact that InvokeDDLCommandEventTriggersIfSupported()
paid no mind to isCompleteQuery.

Dimitri Fontaine and Tom Lane

Branch
------
master

Details
-------
http://git.postgresql.org/pg/commitdiff/5525e6c40bbda351a19b48317eba0f79aa32e447

Modified Files
--------------
src/backend/tcop/utility.c | 1195 +++++++++++++++++++++-----------------------
1 files changed, 569 insertions(+), 626 deletions(-)

Browse pgsql-committers by date

  From Date Subject
Next Message Tom Lane 2013-04-28 04:18:59 pgsql: Editorialize a bit on new ProcessUtility() API.
Previous Message Peter Eisentraut 2013-04-28 03:07:46 pgsql: pg_dump: Improve message formatting