Re: Dumping an Extension's Script - Mailing list pgsql-hackers

From Alvaro Herrera
Subject Re: Dumping an Extension's Script
Date
Msg-id 20121205195457.GE4673@alvh.no-ip.org
Whole thread Raw
In response to Re: Dumping an Extension's Script  (Robert Haas <robertmhaas@gmail.com>)
Responses Re: Dumping an Extension's Script  (Robert Haas <robertmhaas@gmail.com>)
List pgsql-hackers
Robert Haas escribió:

> I have no objection whatsoever to the concept of storing the SQL and
> control files somewhere that doesn't need access to the server
> filesystem - in fact, I think I previously proposed allowing those to
> be stored in a database table.  You could do that with something like:
>
> CREATE TEMPLATE yadda;
> ALTER TEMPLATE yadda ADD FILE 'yadda--1.0.sql' CONTENT $$...$$;
>
> ...or whatever.

This seems unnecessary to me.  What the patch at hand does is take the
file (actually, the contents of the file) and execute it directly,
without installing anything on disk.  The precise contents of the
extension is still tracked through pg_depend, so you can drop it without
having previously saved neither the control file or the SQL script.  (In
fact, that's how DROP EXTENSION works currently.)

There's also the pg_dump side of things; with your proposal we would be
forced to move over the yadda--1.0.sql file from the old server to the
new one; or, equivalently, put the whole ALTER TEMPLATE .. CONTENT
command in the dump, which is equivalent to what Dimitri's patch does;
so there doesn't seem to be a point.

--
Álvaro Herrera                http://www.2ndQuadrant.com/
PostgreSQL Development, 24x7 Support, Training & Services



pgsql-hackers by date:

Previous
From: "David E. Wheeler"
Date:
Subject: Re: json accessors
Next
From: Dimitri Fontaine
Date:
Subject: Re: Dumping an Extension's Script