Search Postgresql Archives

Re: is there example of update skript?

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



Le 7 décembre 2011 14:26, Pavel Stehule <pavel.stehule@xxxxxxxxx> 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@xxxxxxxxxxxxxx)
> 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

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



[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Index of Archives]     [Postgresql Jobs]     [Postgresql Admin]     [Postgresql Performance]     [Linux Clusters]     [PHP Home]     [PHP on Windows]     [Kernel Newbies]     [PHP Classes]     [PHP Books]     [PHP Databases]     [Postgresql & PHP]     [Yosemite]
  Powered by Linux