pg.ddx.io  pgsql-committers@postgresql.org mailing list archive  
help / color / mirror / Atom feed
From: Michael Paquier <michael@paquier.xyz>
To: pgsql-committers@lists.postgresql.org
Subject: pgsql: postgres_fdw: Use psql variables for connection parameters
Date: Mon, 01 Sep 2025 00:05:45 +0000
Message-ID: <E1uss3M-002cfq-2W@gemulon.postgresql.org> (raw)

postgres_fdw: Use psql variables for connection parameters

Several statements need to reference the current connection's current
database name and current port value.  Until now, this has been
accomplished by creating dynamic SQL statements inside of a DO block,
which is not as easy to parse.  It also takes away some of the
granularity of any error messages that might occur, making debugging
harder.

By capturing the connection-specific settings into psql variables, it
becomes possible to write simpler SQL statements for the FDW objects.
This eliminates most of DO blocks used in this test, making it a bit
more readable and shorter.

Author: Author: Corey Huinker <corey.huinker@gmail.com>
Discussion: https://postgr.es/m/CADkLM=cpUiJ3QF7aUthTvaVMmgQcm7QqZBRMDLhBRTR+gJX-Og@mail.gmail.com

Branch
------
master

Details
-------
https://git.postgresql.org/pg/commitdiff/36aed19fd99021ad9f727e4fd4bceb086a7cf54d

Modified Files
--------------
contrib/postgres_fdw/expected/postgres_fdw.out | 42 +++++++-----------------
contrib/postgres_fdw/sql/postgres_fdw.sql      | 44 ++++++++------------------
2 files changed, 25 insertions(+), 61 deletions(-)



Message-ID: <E1uss3M-002cfq-2W@gemulon.postgresql.org>
Permalink:  ../E1uss3M-002cfq-2W@gemulon.postgresql.org/
Also on:    postgresql.org/message-id/E1uss3M-002cfq-2W@gemulon.postgresql.org

 · 

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: michael@paquier.xyz, pgsql-committers@lists.postgresql.org
  Subject: Re: pgsql: postgres_fdw: Use psql variables for connection parameters
  In-Reply-To: <E1uss3M-002cfq-2W@gemulon.postgresql.org>

* 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