Re: Review: extension template

From: Dimitri Fontaine <dimitri(at)2ndQuadrant(dot)fr>
To: Markus Wanner <markus(at)bluegap(dot)ch>
Cc: PostgreSQL-development Hackers <pgsql-hackers(at)postgresql(dot)org>
Subject: Re: Review: extension template
Date: 2013-07-13 10:10:13
Message-ID: m2vc4ezs6y.fsf@2ndQuadrant.fr
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-hackers

Hi,

Please find attached a new version (v10) of the patch that fixes the
reported dependencies problems and add some new regression tests to
cover them.

The patch implements the solution we discuted privately with Markus
while at the CHAR(13) conference:

- create template for extension is now possible even if an extension
is already installed, so that you can install a template for a new
version of the extension;

- all the scripts used to install an extension are now set as
dependencies so that you can't drop parts of what you need at
restore time;

- you can create extension for template x version 'y' when you already
had an upgrade path leading to that same version 'y', but only if
your set of parameters for the version 'y' remains the same as
what's already installed in the auxilliary control entry;

- fix a pg_dump bug by using special dollar quoting $extname$.

Markus Wanner <markus(at)bluegap(dot)ch> writes:
>> db1=# CREATE TEMPLATE FOR EXTENSION foo VERSION '0.1' AS $foo$ SELECT 2; $foo$;
>> ERROR: extension "foo" already exists

Fixed in the attached.

>> db1=# DROP TEMPLATE FOR EXTENSION foo FROM '0.0' TO '0.1';
>> DROP TEMPLATE FOR EXTENSION
>
> In this state, extension foo as of version '0.1' is installed, but
> running this through dump & restore, you'll only get back '0.0'.

Fixed in the attached.

> This certainly creates a bad state that leads to an error, when run
> through dump & restore.

Fixed in the attached.

>> db1=# DROP TEMPLATE FOR EXTENSION foo VERSION '0.0';
>> DROP TEMPLATE FOR EXTENSION
>
> ... should already err out here ...

Fixed in the attached.

> Another thing that surprised me is the inability to have an upgrade
> script *and* a full version (for the same extension target version).
> Even if that's intended behavior, the error message could be improved:

Fixed in the attached by allowing both to co-exist.

Regards,
--
Dimitri Fontaine
http://2ndQuadrant.fr PostgreSQL : Expertise, Formation et Support

Attachment Content-Type Size
templates.v10.patch.gz application/octet-stream 37.8 KB

In response to

Browse pgsql-hackers by date

  From Date Subject
Next Message Abhijit Menon-Sen 2013-07-13 10:21:14 Re: Patch to add support of "IF NOT EXISTS" to others "CREATE" statements
Previous Message Abhijit Menon-Sen 2013-07-13 09:11:57 Re: [PERFORM] In progress INSERT wrecks plans on table