Re: Dumping an Extension's Script

Tom Lane <tgl@sss.pgh.pa.us>

From: Tom Lane <tgl@sss.pgh.pa.us>
To: Robert Haas <robertmhaas@gmail.com>
Cc: Dimitri Fontaine <dimitri@2ndquadrant.fr>, Andres Freund <andres@2ndquadrant.com>, Alvaro Herrera <alvherre@2ndquadrant.com>, Heikki Linnakangas <hlinnakangas@vmware.com>, Simon Riggs <simon@2ndquadrant.com>, PostgreSQL Hackers <pgsql-hackers@postgresql.org>
Date: 2012-12-05T23:49:17Z
Lists: pgsql-hackers
Robert Haas <robertmhaas@gmail.com> writes:
> In other words, the first paragraph is arguing for something like the
> notion of an extension template - the ability to store the extension
> files inside the server, in cases where you don't want them to appear
> in the file system.  But perhaps implemented using functions rather
> than dedicated SQL syntax.  But regardless of the concrete syntax, the
> first paragraph is proposing that we have something conceptually
> similar to:

> CREATE TEMPLATE yadda;
> ALTER TEMPLATE yadda ADD FILE 'yadda--1.0.sql' CONTENT $$...$$;

> Given that context, the second paragraph is intended as a suggestion
> that we should have something like pg_dump --no-templates -- which
> would still emit any CREATE EXTENSION commands, but not any
> CREATE/ALTER TEMPLATE commands - so if you relied on any templates in
> setting up the old cluster, the new cluster would need to have the
> files installed in the usual place.  It was not a suggestion that we
> shoehorn the file management into CREATE / ALTER EXTENSION as you are
> proposing here; the first paragraph expresses my opinion, which hasn't
> changed between then and now, that that's a bad design.

FWIW, the more I think about it the more I like the notion of treating
"extension templates" as a separate kind of object.  I do see value in
storing them inside the database system: transactional safety, the
ability to identify an owner, etc etc.  But conflating this
functionality with installed extensions is just going to create
headaches.

			regards, tom lane