From: | Robert Haas <robertmhaas(at)gmail(dot)com> |
---|---|
To: | Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us> |
Cc: | Dimitri Fontaine <dimitri(at)2ndquadrant(dot)fr>, "David E(dot) Wheeler" <david(at)kineticode(dot)com>, Josh Berkus <josh(at)agliodbs(dot)com>, pgsql-hackers(at)postgresql(dot)org |
Subject: | Re: ALTER EXTENSION UPGRADE, v3 |
Date: | 2011-02-11 00:38:43 |
Message-ID: | AANLkTin5DmzpAp67xBjXSTKk013NzQKiUd7o7tBKXBYf@mail.gmail.com |
Views: | Raw Message | Whole Thread | Download mbox | Resend email |
Thread: | |
Lists: | pgsql-hackers |
On Thu, Feb 10, 2011 at 6:50 PM, Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us> wrote:
> Since we've agreed that there should be a version-to-install option
> in CREATE EXTENSION, it seems to me that a workable solution is to
> have a special convention for an "empty extension" version name.
> Let's suppose that we choose the empty string as this reserved version
> name. Then you would write
>
> CREATE EXTENSION foo VERSION '' [ SCHEMA whatever ];
>
> as the equivalent of CREATE WRAPPER EXTENSION. This would create the
> extension's entry in pg_extension, but not run any script, and the
> extension would initially have no members. After that you could do
>
> ALTER EXTENSION foo UPGRADE TO '1.0';
>
> and this would run the upgrade script "foo--1.0.sql", which would most
> likely consist of just "ALTER EXTENSION foo ADD object" commands to
> absorb the objects from the old-style contrib module into the extension.
You don't really need any core support for this at all. People could
simply ship an empty file called foo-.sql, and then foo--1.0.sql to
upgrade to version 1.0. (Or if you want to pick 0 or bootstrap or
null to represent the loose object situation, that works too.)
> Third, I'm also not thrilled with the syntax "ALTER EXTENSION foo
> UPGRADE". UPGRADE isn't an existing keyword (note that VERSION is).
> And I don't see any strong reason to assume that the version change
> is an "upgrade". Authors might well choose to support sidegrades or
> downgrades, especially with experimental modules. I suggest either
>
> ALTER EXTENSION foo UPDATE [ TO 'version' ]
>
> ALTER EXTENSION foo VERSION [ 'version' ]
>
> the main excuse for the latter being that it's closer to the comparable
> syntax in CREATE EXTENSION.
>
> OK, that's enough bikeshedding for today ...
>
> Comments?
Generally, +1. Like David, I prefer the UPDATE syntax.
--
Robert Haas
EnterpriseDB: http://www.enterprisedb.com
The Enterprise PostgreSQL Company
From | Date | Subject | |
---|---|---|---|
Next Message | Robert Haas | 2011-02-11 01:17:43 | Re: Sorting. When? |
Previous Message | David E. Wheeler | 2011-02-11 00:13:54 | Re: ALTER EXTENSION UPGRADE, v3 |