pgsql: Support ALTER THING .. DEPENDS ON EXTENSION

From: Alvaro Herrera <alvherre(at)alvh(dot)no-ip(dot)org>
To: pgsql-committers(at)postgresql(dot)org
Subject: pgsql: Support ALTER THING .. DEPENDS ON EXTENSION
Date: 2016-04-05 21:43:39
Message-ID: E1anYl9-0006P7-Gp@gemulon.postgresql.org
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-committers

Support ALTER THING .. DEPENDS ON EXTENSION

This introduces a new dependency type which marks an object as depending
on an extension, such that if the extension is dropped, the object
automatically goes away; and also, if the database is dumped, the object
is included in the dump output. Currently the grammar supports this for
indexes, triggers, materialized views and functions only, although the
utility code is generic so adding support for more object types is a
matter of touching the parser rules only.

Author: Abhijit Menon-Sen
Reviewed-by: Alexander Korotkov, Álvaro Herrera
Discussion: http://www.postgresql.org/message-id/20160115062649.GA5068@toroid.org

Branch
------
master

Details
-------
http://git.postgresql.org/pg/commitdiff/f2fcad27d59c8e5c48f8fa0a96c8355e40f24273

Modified Files
--------------
doc/src/sgml/catalogs.sgml | 13 ++
doc/src/sgml/ref/alter_function.sgml | 20 +++
doc/src/sgml/ref/alter_index.sgml | 20 +++
doc/src/sgml/ref/alter_materialized_view.sgml | 17 +++
doc/src/sgml/ref/alter_trigger.sgml | 20 ++-
src/backend/catalog/dependency.c | 2 +
src/backend/catalog/objectaddress.c | 25 ++++
src/backend/commands/alter.c | 37 +++++
src/backend/nodes/copyfuncs.c | 17 +++
src/backend/nodes/equalfuncs.c | 15 ++
src/backend/parser/gram.y | 56 +++++++-
src/backend/tcop/utility.c | 28 ++++
src/include/catalog/catversion.h | 2 +-
src/include/catalog/dependency.h | 7 +
src/include/catalog/objectaddress.h | 4 +
src/include/commands/alter.h | 2 +
src/include/nodes/nodes.h | 1 +
src/include/nodes/parsenodes.h | 14 ++
src/include/parser/kwlist.h | 1 +
src/test/modules/test_extensions/Makefile | 2 +-
.../test_extensions/expected/test_extdepend.out | 152 +++++++++++++++++++++
.../modules/test_extensions/sql/test_extdepend.sql | 73 ++++++++++
src/tools/pgindent/typedefs.list | 1 +
23 files changed, 524 insertions(+), 5 deletions(-)

Browse pgsql-committers by date

  From Date Subject
Next Message Alvaro Herrera 2016-04-05 22:05:51 pgsql: Fix broken ALTER INDEX documentation
Previous Message Robert Haas 2016-04-05 20:09:05 pgsql: Fix parallel-safety code for parallel aggregation.