Re: Subscription tests fail under CLOBBER_CACHE_ALWAYS

Amit Langote <amitlangote09@gmail.com>

From: Amit Langote <amitlangote09@gmail.com>
To: Michael Paquier <michael@paquier.xyz>
Cc: Amit Kapila <amit.kapila16@gmail.com>, Tom Lane <tgl@sss.pgh.pa.us>, PostgreSQL Hackers <pgsql-hackers@lists.postgresql.org>
Date: 2021-05-19T06:53:57Z
Lists: pgsql-hackers
On Wed, May 19, 2021 at 2:05 PM Michael Paquier <michael@paquier.xyz> wrote:
> On Wed, May 19, 2021 at 10:26:28AM +0530, Amit Kapila wrote:
> > How about moving AfterTriggerEndQuery() to apply_handle_*_internal
> > calls? That way, we might not even need to change Push/Pop calls.
>
> Isn't that going to be a problem when a tuple is moved to a new
> partition in the tuple routing?  This does a DELETE followed by an
> INSERT, but the operation is an UPDATE.

That indeed doesn't work.  Once AfterTriggerEndQuery() would get
called for DELETE from apply_handle_delete_internal(), after triggers
of the subsequent INSERT can't be processed, instead causing:

ERROR:  AfterTriggerSaveEvent() called outside of query

IOW, the patch you posted earlier seems like the way to go.

-- 
Amit Langote
EDB: http://www.enterprisedb.com



Commits

  1. Be more verbose when the postmaster unexpectedly quits.

  2. Fix access to no-longer-open relcache entry in logical-rep worker.