pg.ddx.io  pgsql-committers@postgresql.org mailing list archive  
help / color / mirror / Atom feed
From: Jeff Davis <pgsql@j-davis.com>
To: Andres Freund <andres@anarazel.de>
To: Peter Eisentraut <peter@eisentraut.org>
Cc: Jeff Davis <jdavis@postgresql.org>
Cc: pgsql-committers@lists.postgresql.org
Subject: Re: pgsql: CREATE SUBSCRIPTION ... SERVER.
Date: Wed, 11 Mar 2026 17:59:40 -0700
Message-ID: <03d52b80fd264bb683fb2c46ad7a2934cb656f1a.camel@j-davis.com> (raw)
In-Reply-To: <xvdjrdqnpap3uq7owbaox3r7p5gf7sv62aaqf2ju3vb6yglatr@kvvwhoudrlxq>
References: <E1vyYHQ-002hOV-0R@gemulon.postgresql.org>
	<1bb21c7d-885f-4f07-a3ed-21b60d7c92c6@eisentraut.org>
	<xvdjrdqnpap3uq7owbaox3r7p5gf7sv62aaqf2ju3vb6yglatr@kvvwhoudrlxq>

On Wed, 2026-03-11 at 17:49 -0400, Andres Freund wrote:
> The only reason connection_text needs to be volatile is because it's
> modified
> in PG_TRY and then accessed in PG_FINALLY.  But what's the point of
> the
> latter? If an error was thrown, why would we want to construct the
> 'result'
> string, as the error isn't caught, there's no PG_CATCH.  So now the
> function
> builds the result string in case of an error, just to throw it away.

I believe it would be correct if the variable was not volatile at all,
because it's only set in the last statement of PG_TRY(), so the
PG_FINALLY() will never need to read the modified variable on the error
path. I added the volatile to follow the expected pattern, in case the
code is adjusted later.

That leaves some awkwardness, but I don't immediately see a cleaner way
to do it. Suggestions welcome.

> I'm also rather unconvinced by ForeignServerConnectionString()
> creating a
> temporary memory context. When would you ever use the function in a
> long lived
> memory context?

It's called by GetSubscription(), and the context is ApplyContext.

Regards,
	Jeff Davis






view thread (9+ messages)  latest in thread

Message-ID: <03d52b80fd264bb683fb2c46ad7a2934cb656f1a.camel@j-davis.com>
Permalink:  ../03d52b80fd264bb683fb2c46ad7a2934cb656f1a.camel@j-davis.com/
Also on:    postgresql.org/message-id/03d52b80fd264bb683fb2c46ad7a2934cb656f1a.camel@j-davis.com

 · 

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: pgsql-committers@postgresql.org
  Cc: pgsql@j-davis.com, andres@anarazel.de, peter@eisentraut.org, jdavis@postgresql.org, pgsql-committers@lists.postgresql.org
  Subject: Re: pgsql: CREATE SUBSCRIPTION ... SERVER.
  In-Reply-To: <03d52b80fd264bb683fb2c46ad7a2934cb656f1a.camel@j-davis.com>

* 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