Re: Review: extension template - Mailing list pgsql-hackers

From Dimitri Fontaine
Subject Re: Review: extension template
Date
Msg-id m2vc4ezs6y.fsf@2ndQuadrant.fr
Whole thread Raw
In response to Re: Review: extension template  (Markus Wanner <markus@bluegap.ch>)
List 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@bluegap.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

pgsql-hackers by date:

Previous
From: Abhijit Menon-Sen
Date:
Subject: Re: [PERFORM] In progress INSERT wrecks plans on table
Next
From: Abhijit Menon-Sen
Date:
Subject: Re: Patch to add support of "IF NOT EXISTS" to others "CREATE" statements