pg.ddx.io  pgsql-committers@postgresql.org mailing list archive  
help / color / mirror / Atom feed
From: Peter Eisentraut <peter_e@gmx.net>
To: pgsql-committers@postgresql.org
Subject: pgsql: Tweak publication fetching in psql
Date: Tue, 20 Jun 2017 16:36:20 +0000
Message-ID: <E1dNM8a-0001Dd-MB@gemulon.postgresql.org> (raw)
List-Unsubscribe:  <mailto:majordomo@postgresql.org?body=unsub%20pgsql-committers>

Tweak publication fetching in psql

Viewing a table with \d in psql also shows the publications at table is
in.  If a publication is concurrently dropped, this shows an error,
because the view pg_publication_tables internally uses
pg_get_publication_tables(), which uses a catalog snapshot.  This can be
particularly annoying if a for-all-tables publication is concurrently
dropped.

To avoid that, write the query in psql differently.  Expose the function
pg_relation_is_publishable() to SQL and write the query using that.
That still has a risk of being affected by concurrent catalog changes,
but in this case it would be a table drop that causes problems, and then
the psql \d command wouldn't be interesting anymore anyway.

Reported-by: Tom Lane <tgl@sss.pgh.pa.us>

Branch
------
master

Details
-------
https://git.postgresql.org/pg/commitdiff/a2141c42f9ebc51b4501a4fafea9dd3fb7eda23d

Modified Files
--------------
src/backend/catalog/pg_publication.c | 24 ++++++++++++++++++++++++
src/bin/psql/describe.c              | 14 +++++++++-----
src/include/catalog/catversion.h     |  2 +-
src/include/catalog/pg_proc.h        |  2 ++
4 files changed, 36 insertions(+), 6 deletions(-)


-- 
Sent via pgsql-committers mailing list (pgsql-committers@postgresql.org)
To make changes to your subscription:
http://www.postgresql.org/mailpref/pgsql-committers


Message-ID: <E1dNM8a-0001Dd-MB@gemulon.postgresql.org>
Permalink:  ../E1dNM8a-0001Dd-MB@gemulon.postgresql.org/
Also on:    postgresql.org/message-id/E1dNM8a-0001Dd-MB@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: peter_e@gmx.net
  Subject: Re: pgsql: Tweak publication fetching in psql
  In-Reply-To: <E1dNM8a-0001Dd-MB@gemulon.postgresql.org>
  References: <E1dNM8a-0001Dd-MB@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