From: Tom Lane <tgl@sss.pgh.pa.us>
To: Alvaro Herrera <alvherre@2ndquadrant.com>
Cc: Robert Haas <robertmhaas@gmail.com>
Cc: PostgreSQL Hackers <pgsql-hackers@lists.postgresql.org>
Subject: Re: Rearranging ALTER TABLE to avoid multi-operations bugs
Date: Wed, 30 Oct 2019 01:44:05 -0400
Message-ID: <29370.1572414245@sss.pgh.pa.us> (raw)
In-Reply-To: <20191030011039.GA9097@alvherre.pgsql>
References: <20191030011039.GA9097@alvherre.pgsql>
Alvaro Herrera <alvherre@2ndquadrant.com> writes:
> On 2019-Oct-29, Tom Lane wrote:
>> The thing I think you are actually worried about is the interaction
>> with event triggers, which is already a pretty horrid mess in this
>> code today. I don't really follow the comment here about
>> "ordering of queued commands". It looks like that comment dates to
>> Alvaro's commit b488c580a ... can either of you elucidate that?
> The point of that comment is that if you enqueue the commands as they
> are returned by pg_event_trigger_ddl_commands() (say by writing them to
> a table) they must be emitted in an order that allows them to be
> re-executed in a remote server that duplicates this one, and the final
> state should be "the same".
Hm. I don't think I understand what is the use-case behind all this.
If "ALTER TABLE tab DO SOMETHING" generates some subcommands to do what
it's supposed to do, and then an event trigger is interested in replaying
that ALTER, how is it supposed to avoid having the subcommands happen
twice? That is, it seems like we'd be better off to suppress the
generated subcommands from the event stream, because they'd just get
generated again anyway from execution of the primary command. Or, if
there's something that is interested in knowing that those subcommands
happened, that's fine, but they'd better be marked somehow as informative
rather than something you want to explicitly replay. (And if they are
just informative, why is the ordering so critical?)
regards, tom lane
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-hackers@postgresql.org
Cc: tgl@sss.pgh.pa.us, alvherre@2ndquadrant.com, robertmhaas@gmail.com
Subject: Re: Rearranging ALTER TABLE to avoid multi-operations bugs
In-Reply-To: <29370.1572414245@sss.pgh.pa.us>
References: <20191030011039.GA9097@alvherre.pgsql> <29370.1572414245@sss.pgh.pa.us>
* 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