Обсуждение: pgsql: Avoid duplicates in ALTER ... DEPENDS ON EXTENSION

Поиск
Список
Период
Сортировка

pgsql: Avoid duplicates in ALTER ... DEPENDS ON EXTENSION

От
Alvaro Herrera
Дата:
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
------
master

Details
-------
https://git.postgresql.org/pg/commitdiff/899a04f5ed61c3db7a2bd84957ecf530c09fd05a

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


Re: pgsql: Avoid duplicates in ALTER ... DEPENDS ON EXTENSION

От
Alvaro Herrera
Дата:
On 2020-Mar-11, Alvaro Herrera wrote:

> Avoid duplicates in ALTER ... DEPENDS ON EXTENSION

> Reviewed-by: Ibrar Ahmed, Tom Lane (offlist)

I failed to credit Ahsan Hadi as a reviewer here.  Apologies.

-- 
Álvaro Herrera                https://www.2ndQuadrant.com/
PostgreSQL Development, 24x7 Support, Remote DBA, Training & Services