Avoid duplicates in ALTER ... DEPENDS ON EXTENSION
authorAlvaro Herrera <[email protected]>
Wed, 11 Mar 2020 14:04:59 +0000 (11:04 -0300)
committerAlvaro Herrera <[email protected]>
Wed, 11 Mar 2020 14:04:59 +0000 (11:04 -0300)
commit3dfd2d6cd28a125edc4761eaefaa1193f111459d
treefe862692d64574fb2ae7ed1466e55c68b1ebf4ad
parent475b061c867557499559227d743b332c257033a3
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[email protected]
src/backend/catalog/pg_depend.c
src/backend/commands/alter.c
src/include/catalog/dependency.h
src/test/modules/test_extensions/expected/test_extdepend.out
src/test/modules/test_extensions/sql/test_extdepend.sql