public inbox for [email protected]  
help / color / mirror / Atom feed
From: Nathan Bossart <[email protected]>
To: Tom Lane <[email protected]>
Cc: Jacob Champion <[email protected]>
Cc: [email protected]
Subject: Re: alert clients when prepared statements are deallocated
Date: Tue, 2 Jun 2026 17:11:52 -0500
Message-ID: <ah9VKGwwlgqF-hi7@nathan> (raw)
In-Reply-To: <ahna7lre-xAn7DIS@nathan>
References: <ahm_4eOKkkKJ3Gds@nathan>
	<[email protected]>
	<ahna7lre-xAn7DIS@nathan>

I've spent quite a bit of time on this one.  Attached is a new version of
the patch.  A few notes:

* This version uses a protocol extension instead of bumping the protocol
version.  It looks like this is the first such extension, so it's entirely
possible I'm missing something.  Note that this should work for any version
of PostgreSQL released since 2018 (see commit ae65f6066d), but IIUC older
versions will error on the protocol extension.  I'm a little concerned that
this could break pg_upgrade from early versions of v10 (which will be the
minimum supported source version in v20), so we might need to provide a way
to disable it in libpq.

* I sketched out an alternative design that would allow client applications
to retrieve the notifications at their leisure, but I stopped when I
realized this would actually add quite a bit of complexity.  We have to
think about duplicate reports, specifying which statements to collect,
clearing reports, and other subtle behavior.  I'm hopeful that the callback
mechanism is good enough for now.  If feedback indicates it is not, we can
certainly re-evaluate as a follow-up effort.

* I didn't add notifications for unnamed prepared statements.  I'm not
seeing a real use-case for that, but I admittedly haven't thought about it
too hard.

* I haven't added any tests in this patch.  My thinking is that it will get
tested as part of the libpq-LO-interface revamp in the other thread.

* I'm a little worried about race conditions involving a client trying to
use a statement while a deallocation message is in flight, but I haven't
identified anything concrete so far.  This is something I'd like to
investigate some more, though.

-- 
nathan


view thread (13+ messages)  latest in thread

reply

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 using the --to and --cc options:
  reply via email

  To: [email protected]
  Cc: [email protected], [email protected], [email protected]
  Subject: Re: alert clients when prepared statements are deallocated
  In-Reply-To: <ah9VKGwwlgqF-hi7@nathan>

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

This inbox is served by agora; see mirroring instructions
for how to clone and mirror all data and code used for this inbox