pg.ddx.io  pgsql-committers@postgresql.org mailing list archive  
help / color / mirror / Atom feed
From: Alvaro Herrera <alvherre@alvh.no-ip.org>
To: pgsql-committers@lists.postgresql.org
Subject: pgsql: Avoid duplicates in ALTER ... DEPENDS ON EXTENSION
Date: Wed, 11 Mar 2020 14:06:42 +0000
Message-ID: <E1jC20Q-00085A-5r@gemulon.postgresql.org> (raw)

Avoid duplicates in ALTER ... DEPENDS ON EXTENSION

If the command is attempted for an extension that the object already
depends on, silently do nothing.

In particular, this means that if a database containing multiple such
entries is dumped, the restore will silently do the right thing and
record just the first one.  (At least, in a world where pg_dump does
dump such entries -- which it doesn't currently, but it will.)

Backpatch to 9.6, where this kind of dependency was introduced.

Reviewed-by: Ibrar Ahmed, Tom Lane (offlist)
Discussion: https://postgr.es/m/20200217225333.GA30974@alvherre.pgsql

Branch
------
REL9_6_STABLE

Details
-------
https://git.postgresql.org/pg/commitdiff/73b31e784d64a4f24644de11d02fa632fe97bfab

Modified Files
--------------
src/backend/catalog/pg_depend.c                    | 43 ++++++++++++++++++++++
src/backend/commands/alter.c                       |  7 +++-
src/include/catalog/dependency.h                   |  2 +
.../test_extensions/expected/test_extdepend.out    |  2 +
.../modules/test_extensions/sql/test_extdepend.sql |  2 +
5 files changed, 55 insertions(+), 1 deletion(-)



view thread (6+ messages)  latest in thread

Message-ID: <E1jC20Q-00085A-5r@gemulon.postgresql.org>
Permalink:  ../E1jC20Q-00085A-5r@gemulon.postgresql.org/
Also on:    postgresql.org/message-id/E1jC20Q-00085A-5r@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: alvherre@alvh.no-ip.org
  Subject: Re: pgsql: Avoid duplicates in ALTER ... DEPENDS ON EXTENSION
  In-Reply-To: <E1jC20Q-00085A-5r@gemulon.postgresql.org>
  References: <E1jC20Q-00085A-5r@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