Re: is there example of update skript?

Поиск
Список
Период
Сортировка
От Cédric Villemain
Тема Re: is there example of update skript?
Дата
Msg-id CAF6yO=3ff0eLafddUN84tHiN9pKOf8S38_TVjqGQj8sp+rrwTw@mail.gmail.com
обсуждение исходный текст
Ответ на is there example of update skript?  (Pavel Stehule <pavel.stehule@gmail.com>)
Список pgsql-general
Le 7 décembre 2011 14:26, Pavel Stehule <pavel.stehule@gmail.com> a écrit :
> Hello
>
> I am playing with extensions implemented in plpgsql. I am checking update.
>
> I have a simple extension
>
> file gdlib--1.1.sql
> CREATE OR REPLACE FUNCTION gdlib_version()
> RETURNS numeric AS $$
>  SELECT 1.1;
> $$ LANGUAGE sql;
>
> CREATE OR REPLACE FUNCTION hello(text)
> RETURNS text AS $$
>  SELECT 'Hello, ' || $1 || ' from gdlib ' || gdlib_version();
> $$ LANGUAGE sql;
>
> file gdlib--1.0.sql
> CREATE OR REPLACE FUNCTION gdlib_version()
> RETURNS numeric AS $$
>  SELECT 1.0;
> $$ LANGUAGE sql;
>
> CREATE OR REPLACE FUNCTION hello(text)
> RETURNS text AS $$
>  SELECT 'Hello, ' || $1 || ' from gdlib ' || gdlib_version();
> $$ LANGUAGE sql;
>
> I created a empty update files (it's probably wrong)
>
> postgres=# SELECT * FROM pg_extension_update_paths('gdlib');
>  source | target |   path
> --------+--------+----------
>  1.0    | 1.1    | 1.0--1.1
>  1.1    | 1.0    | 1.1--1.0
> (2 rows)
>
> Issue
>
> After ALTER EXTENSION gdlib UPDATE TO '1.1'
>
> I have 1.0 function still?

in the path, so you can run 1.1->1.0 if you provided a script for that.

>
> I expected a refresh 1.1 sql script, but it was newer loaded
>
> What are correct steps?

upgrade the schema/function from 1.0 to 1.1 in your
"extension--last--new.sql" file.
A blank file can be provided to just update the version number of the extension.

.so are *not* versionned so once you've install the new 1.1, the old
sql will access to it.
If you change sql API for your C extension, you need to run ALTER EXT
UPDATE, else it is not required. (expect to increase version number)


>
> Regards
>
> Pavel Stehule
>
> --
> Sent via pgsql-general mailing list (pgsql-general@postgresql.org)
> To make changes to your subscription:
> http://www.postgresql.org/mailpref/pgsql-general



--
Cédric Villemain +33 (0)6 20 30 22 52
http://2ndQuadrant.fr/
PostgreSQL: Support 24x7 - Développement, Expertise et Formation

В списке pgsql-general по дате отправления:

Предыдущее
От: "Gauthier, Dave"
Дата:
Сообщение: Re: making "\pset pager off" the default
Следующее
От: Scott Marlowe
Дата:
Сообщение: Re: making "\pset pager off" the default