public inbox for [email protected]  
help / color / mirror / Atom feed
From: Etsuro Fujita <[email protected]>
To: [email protected]
Subject: pgsql: postgres_fdw: Fix deparsing of remote column names in stats impo
Date: Thu, 14 May 2026 08:07:19 +0000
Message-ID: <[email protected]> (raw)

postgres_fdw: Fix deparsing of remote column names in stats import.

build_remattrmap() deparses a list of remote column names for a query
that retrieves attribute stats for them from the remote server.
Previously, it did so by using the array-literal syntax with each column
name individually quoted by quote_identifier(), causing the query to
fail on the remote server with a syntax error or no results when that
column name included a single quote or backslash, as quote_identifier()
doesn't escape those characters, making the query invalid or incorrect.
Fix by switching from the array-literal syntax to the ARRAY constructor
syntax with each column name individually quoted by
deparseStringLiteral().

Oversight in commit 28972b6fc.

Reported-by: Satya Narlapuram <[email protected]>
Reported-by: Ayush Tiwari <[email protected]>
Author: Ayush Tiwari <[email protected]>
Reviewed-by: Alex Guo <[email protected]>
Reviewed-by: Zhenwei Shang <[email protected]>
Reviewed-by: Etsuro Fujita <[email protected]>
Discussion: https://postgr.es/m/CAHg%2BQDc9%3DWtYi%3DJW6QUL6ASOJc6PcGPTuxoMkhnkQ7oi7j5atg%40mail.gmail.com
Discussion: https://postgr.es/m/CAJTYsWWGhVDFjr%2BsmdYdU-Q_TT9YMzXA4QcLCr7rizDOyrEEow%40mail.gmail.com

Branch
------
master

Details
-------
https://git.postgresql.org/pg/commitdiff/5107398e6d5ecad96f3d1c0efcfc9aa02b9cdff9

Modified Files
--------------
contrib/postgres_fdw/expected/postgres_fdw.out | 12 ++++++++++++
contrib/postgres_fdw/postgres_fdw.c            |  8 ++++----
contrib/postgres_fdw/sql/postgres_fdw.sql      | 13 +++++++++++++
3 files changed, 29 insertions(+), 4 deletions(-)



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]
  Subject: Re: pgsql: postgres_fdw: Fix deparsing of remote column names in stats impo
  In-Reply-To: <[email protected]>

* 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