On 3rd of October, Andres Freund committed patch:
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: <a class="text" href="/gitweb/?p=postgresql.git;a=object;h=557E0520">557E0520</a>.firstname.lastname@example.org
This is pretty cool thing. Currently, in contrib, we don't have all that many extensions with dependencies, but hopefully we'll get more and more of them thanks to PGXN.
One of examples, available in contrib of every Pg, is “earthdistance".
Previously, when I tried to install it, I got error:
$ create extension earthdistance; ERROR: required extension "cube" is not installed
Not very problematic, but still – needs manual intervention, or writing installation scripts by manually typing all dependencies, like:
create extension if not exists cube; create extension if not exists earthdistance;
Now, on 9.6, I can simply:
$ create extension earthdistance cascade; NOTICE: installing required extension "cube" CREATE EXTENSION
And I'm all set.
Let's see if it will work out with modules from PGXN…
=$ pgxnclient install pg_jobmon ...
And now, in my test db:
$ create extension pg_jobmon cascade; NOTICE: installing required extension "dblink" CREATE EXTENSION
Works as advertised. Thanks guys 🙂