Re: ALTER EXTENSION UPGRADE, v3
От | David E. Wheeler |
---|---|
Тема | Re: ALTER EXTENSION UPGRADE, v3 |
Дата | |
Msg-id | 77E7D45E-B12E-4911-994F-E3CDF305BB3F@kineticode.com обсуждение исходный текст |
Ответ на | Re: ALTER EXTENSION UPGRADE, v3 (Dimitri Fontaine <dimitri@2ndQuadrant.fr>) |
Ответы |
Re: ALTER EXTENSION UPGRADE, v3
|
Список | pgsql-hackers |
On Feb 2, 2011, at 6:45 AM, Dimitri Fontaine wrote: > Well, you write 3 scripts. > > Let's consider an example, the lo contrib, with its 3 objects: > > CREATE DOMAIN lo AS pg_catalog.oid; > CREATE OR REPLACE FUNCTION lo_oid(lo) … > CREATE OR REPLACE FUNCTION lo_manage() … > > Now, the upgrade script from version NULL to 1.0 is > > alter domain @extschema@.lo set extension lo; > alter function @extschema@.lo_oid(lo) set extension lo; > alter function @extschema@.lo_manage() set extension lo; > > The upgrade script from version 1.0 to 2.0 is, let's say: > > CREATE OR REPLACE FUNCTION @extschema@.lo_newfunc() … > > So the upgrade script from version NULL to 2.0 is: > > alter domain @extschema@.lo set extension lo; > alter function @extschema@.lo_oid(lo) set extension lo; > alter function @extschema@.lo_manage() set extension lo; > CREATE OR REPLACE FUNCTION @extschema@.lo_newfunc() … > > If as an extension author you're kind enough to provide all those 3 > scripts and the upgrade setup in the control file, then the user can > issue ALTER EXTENSION lo UPGRADE; and have all your cases covered > automatically. As an extension author, I can't emphasize enough how much I hate the redundancy of this approach. Best, David
В списке pgsql-hackers по дате отправления: