Thread: pgsql: Add CASCADE support for CREATE EXTENSION.

pgsql: Add CASCADE support for CREATE EXTENSION.

From
Andres Freund
Date:
Add CASCADE support for CREATE EXTENSION.

Without CASCADE, if an extension has an unfullfilled dependency on
another extension, CREATE EXTENSION ERRORs out with "required extension
... is not installed". That is annoying, especially when that dependency
is an implementation detail of the extension, rather than something the
extension's user can make sense of.

In addition to CASCADE this also includes a small set of regression
tests around CREATE EXTENSION.

Author: Petr Jelinek, editorialized by Michael Paquier, Andres Freund
Reviewed-By: Michael Paquier, Andres Freund, Jeff Janes
Discussion: 557E0520.3040800@2ndquadrant.com

Branch
------
master

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

Modified Files
--------------
contrib/hstore_plperl/expected/hstore_plperl.out   |    6 +-
contrib/hstore_plperl/expected/hstore_plperlu.out  |    6 +-
contrib/hstore_plperl/sql/hstore_plperl.sql        |    4 +-
contrib/hstore_plperl/sql/hstore_plperlu.sql       |    4 +-
.../hstore_plpython/expected/hstore_plpython.out   |    4 +-
contrib/hstore_plpython/sql/hstore_plpython.sql    |    3 +-
contrib/ltree_plpython/expected/ltree_plpython.out |    4 +-
contrib/ltree_plpython/sql/ltree_plpython.sql      |    3 +-
doc/src/sgml/ref/create_extension.sgml             |   42 ++++
src/backend/commands/extension.c                   |  217 ++++++++++++++------
src/backend/parser/gram.y                          |    4 +
src/bin/psql/tab-complete.c                        |    7 +-
src/test/modules/Makefile                          |    1 +
src/test/modules/test_extensions/.gitignore        |    4 +
src/test/modules/test_extensions/Makefile          |   23 +++
.../test_extensions/expected/test_extensions.out   |   37 ++++
.../test_extensions/sql/test_extensions.sql        |   15 ++
.../modules/test_extensions/test_ext1--1.0.sql     |    3 +
src/test/modules/test_extensions/test_ext1.control |    5 +
.../modules/test_extensions/test_ext2--1.0.sql     |    3 +
src/test/modules/test_extensions/test_ext2.control |    4 +
.../modules/test_extensions/test_ext3--1.0.sql     |    3 +
src/test/modules/test_extensions/test_ext3.control |    3 +
.../modules/test_extensions/test_ext4--1.0.sql     |    3 +
src/test/modules/test_extensions/test_ext4.control |    4 +
.../modules/test_extensions/test_ext5--1.0.sql     |    3 +
src/test/modules/test_extensions/test_ext5.control |    3 +
.../test_extensions/test_ext_cyclic1--1.0.sql      |    3 +
.../test_extensions/test_ext_cyclic1.control       |    4 +
.../test_extensions/test_ext_cyclic2--1.0.sql      |    3 +
.../test_extensions/test_ext_cyclic2.control       |    4 +
src/tools/msvc/Mkvcbuild.pm                        |    3 +-
32 files changed, 346 insertions(+), 89 deletions(-)


Re: pgsql: Add CASCADE support for CREATE EXTENSION.

From
Peter Geoghegan
Date:
On Sat, Oct 3, 2015 at 9:48 AM, Andres Freund <andres@anarazel.de> wrote:
> Add CASCADE support for CREATE EXTENSION.

As you may have noticed already, this patch fails to account for this
change in earthdistance regression test output:

+ HINT:  Use CREATE EXTENSION CASCADE to install required extensions too.


--
Peter Geoghegan


Re: pgsql: Add CASCADE support for CREATE EXTENSION.

From
Andres Freund
Date:
On 2015-10-03 12:24:57 -0700, Peter Geoghegan wrote:
> On Sat, Oct 3, 2015 at 9:48 AM, Andres Freund <andres@anarazel.de> wrote:
> > Add CASCADE support for CREATE EXTENSION.
>
> As you may have noticed already, this patch fails to account for this
> change in earthdistance regression test output:
>
> + HINT:  Use CREATE EXTENSION CASCADE to install required extensions too.

Dang, yea. I'd already complained to Petr about it when I noticed. And
then just staged the hunk.

Greetings,

Andres Freund


Re: pgsql: Add CASCADE support for CREATE EXTENSION.

From
Tom Lane
Date:
Andres Freund <andres@anarazel.de> writes:
> Add CASCADE support for CREATE EXTENSION.

Buildfarm results suggest this was not tested with python 3.

            regards, tom lane


Re: pgsql: Add CASCADE support for CREATE EXTENSION.

From
Petr Jelinek
Date:
On 2015-10-04 05:47, Tom Lane wrote:
> Andres Freund <andres@anarazel.de> writes:
>> Add CASCADE support for CREATE EXTENSION.
>
> Buildfarm results suggest this was not tested with python 3.
>

Attached patch fixes it on my machine.

--
  Petr Jelinek                  http://www.2ndQuadrant.com/
  PostgreSQL Development, 24x7 Support, Training & Services

Attachment

Re: pgsql: Add CASCADE support for CREATE EXTENSION.

From
Andres Freund
Date:
On October 4, 2015 12:55:46 PM GMT+02:00, Petr Jelinek <petr@2ndquadrant.com> wrote:
>On 2015-10-04 05:47, Tom Lane wrote:
>> Andres Freund <andres@anarazel.de> writes:
>>> Add CASCADE support for CREATE EXTENSION.
>>
>> Buildfarm results suggest this was not tested with python 3.
>>
>
>Attached patch fixes it on my machine.

Thanks. Will take a look when I'm home (2h).

Andres

---
Please excuse brevity and formatting - I am writing this on my mobile phone.