On Thu, Feb 10, 2011 at 6:50 PM, Tom Lane <t...@sss.pgh.pa.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 -- Sent via pgsql-hackers mailing list (pgsql-hackers@postgresql.org) To make changes to your subscription: http://www.postgresql.org/mailpref/pgsql-hackers