From: Michael Paquier <michael@paquier.xyz>
To: Alvaro Herrera <alvherre@alvh.no-ip.org>
Cc: Postgres hackers <pgsql-hackers@postgresql.org>
Subject: Re: pgsql: Fix event triggers for partitioned tables
Date: Mon, 8 Oct 2018 18:12:58 +0900
Message-ID: <20181008091258.GC2754@paquier.xyz> (raw)
In-Reply-To: <E1g8uuM-00056u-Cu@gemulon.postgresql.org>
References: <E1g8uuM-00056u-Cu@gemulon.postgresql.org>
Hi Alvaro,
On Sat, Oct 06, 2018 at 10:18:46PM +0000, Alvaro Herrera wrote:
> Fix event triggers for partitioned tables
>
> Index DDL cascading on partitioned tables introduced a way for ALTER
> TABLE to be called reentrantly. This caused an an important deficiency
> in event trigger support to be exposed: on exiting the reentrant call,
> the alter table state object was clobbered, causing a crash when the
> outer alter table tries to finalize its processing. Fix the crash by
> creating a stack of event trigger state objects. There are still ways
> to cause things to misbehave (and probably other crashers) with more
> elaborate tricks, but at least it now doesn't crash in the obvious
> scenario.
This commit is producing a warning with my compiler:
event_trigger.c:1764:9: note: in expansion of macro ‘OidIsValid’
Assert(OidIsValid(currentEventTriggerState->currentCommand));
The fix is obvious because currentCommand is a pointer and not an Oid.
Please see attached. Should I fix it myself?
--
Michael
Attachments:event-trigger-warning.patch (text/x-diff, 634B) downloaddiff --git a/src/backend/commands/event_trigger.c b/src/backend/commands/event_trigger.cindex 2c1dc47541..9a702e4097 100644--- a/src/backend/commands/event_trigger.c+++ b/src/backend/commands/event_trigger.c@@ -1761,7 +1761,7 @@ EventTriggerCollectAlterTableSubcmd(Node *subcmd, ObjectAddress address)
return;
Assert(IsA(subcmd, AlterTableCmd));
- Assert(OidIsValid(currentEventTriggerState->currentCommand));+ Assert(currentEventTriggerState->currentCommand != NULL);
Assert(OidIsValid(currentEventTriggerState->currentCommand->d.alterTable.objectId));
oldcxt = MemoryContextSwitchTo(currentEventTriggerState->cxt);
signature.asc (application/pgp-signature, 832B) download
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 from your mail client; the link fills in
the headers below: reply via email
Some clients, webmail especially, drop In-Reply-To and References from
a link, and the reply then starts a new thread: use the mbox below.
To: pgsql-committers@postgresql.org
Cc: michael@paquier.xyz, alvherre@alvh.no-ip.org, pgsql-hackers@postgresql.org
Subject: Re: pgsql: Fix event triggers for partitioned tables
In-Reply-To: <20181008091258.GC2754@paquier.xyz>
References: <E1g8uuM-00056u-Cu@gemulon.postgresql.org> <20181008091258.GC2754@paquier.xyz>
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
This inbox is served by DDX for PostgreSQL; see mirroring instructions
for how to clone and mirror all data and code used for this inbox