pg.ddx.io  pgsql-committers@postgresql.org mailing list archive  
help / color / mirror / Atom feed
From: Tom Lane <tgl@sss.pgh.pa.us>
To: pgsql-committers@lists.postgresql.org
Subject: pgsql: Avoid doing catalog lookups in postgres_fdw's conversion_error_c
Date: Tue, 06 Jul 2021 16:36:37 +0000
Message-ID: <E1m0o3p-0006ja-6W@gemulon.postgresql.org> (raw)

Avoid doing catalog lookups in postgres_fdw's conversion_error_callback.

As in 50371df26, this is a bad idea since the callback can't really
know what error is being thrown and thus whether or not it is safe
to attempt catalog accesses.  Rather than pushing said accesses into
the mainline code where they'd usually be a waste of cycles, we can
look at the query's rangetable instead.

This change does mean that we'll be printing query aliases (if any
were used) rather than the table or column's true name.  But that
doesn't seem like a bad thing: it's certainly a more useful definition
in self-join cases, for instance.  In any case, it seems unlikely that
any applications would be depending on this detail, so it seems safe
to change.

Patch by me.  Original complaint by Andres Freund; Bharath Rupireddy
noted the connection to conversion_error_callback.

Discussion: https://postgr.es/m/20210106020229.ne5xnuu6wlondjpe@alap3.anarazel.de

Branch
------
REL_14_STABLE

Details
-------
https://git.postgresql.org/pg/commitdiff/86d4914210e9e7f8f8c32defacc71744d0222feb

Modified Files
--------------
contrib/postgres_fdw/expected/postgres_fdw.out | 14 +++--
contrib/postgres_fdw/postgres_fdw.c            | 78 ++++++++++++--------------
contrib/postgres_fdw/sql/postgres_fdw.sql      |  8 ++-
3 files changed, 49 insertions(+), 51 deletions(-)



view thread (12+ messages)  latest in thread

Message-ID: <E1m0o3p-0006ja-6W@gemulon.postgresql.org>
Permalink:  ../E1m0o3p-0006ja-6W@gemulon.postgresql.org/
Also on:    postgresql.org/message-id/E1m0o3p-0006ja-6W@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 from your mail client; the link fills in
  the headers below: reply via email
  Some clients, webmail especially, drop In-Reply-To and References from
  a link, and the reply then starts a new thread: use the mbox below.

  To: pgsql-committers@postgresql.org
  Cc: tgl@sss.pgh.pa.us
  Subject: Re: pgsql: Avoid doing catalog lookups in postgres_fdw's conversion_error_c
  In-Reply-To: <E1m0o3p-0006ja-6W@gemulon.postgresql.org>
  References: <E1m0o3p-0006ja-6W@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