pgsql: postgres_fdw: Use psql variables for connection parameters

From: Michael Paquier <michael(at)paquier(dot)xyz>
To: pgsql-committers(at)lists(dot)postgresql(dot)org
Subject: pgsql: postgres_fdw: Use psql variables for connection parameters
Date: 2025-09-01 00:05:45
Message-ID: E1uss3M-002cfq-2W@gemulon.postgresql.org
Views: Whole Thread | Raw Message | Download mbox | Resend email
Thread:
Lists: pgsql-committers

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(dot)huinker(at)gmail(dot)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(-)

Browse pgsql-committers by date

  From Date Subject
Next Message Peter Eisentraut 2025-09-01 11:12:25 pgsql: Translation updates
Previous Message Richard Guo 2025-08-31 00:00:40 pgsql: Fix const-simplification for constraints and stats