From: | Cédric Villemain <cedric(dot)villemain(dot)debian(at)gmail(dot)com> |
---|---|
To: | Pavel Stehule <pavel(dot)stehule(at)gmail(dot)com> |
Cc: | "pgsql-general(at)postgresql(dot)org >> PG-General Mailing List" <pgsql-general(at)postgresql(dot)org> |
Subject: | Re: is there example of update skript? |
Date: | 2011-12-07 15:19:10 |
Message-ID: | CAF6yO=3ff0eLafddUN84tHiN9pKOf8S38_TVjqGQj8sp+rrwTw@mail.gmail.com |
Views: | Raw Message | Whole Thread | Download mbox | Resend email |
Thread: | |
Lists: | pgsql-general |
Le 7 décembre 2011 14:26, Pavel Stehule <pavel(dot)stehule(at)gmail(dot)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(at)postgresql(dot)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
From | Date | Subject | |
---|---|---|---|
Next Message | Walter Hurry | 2011-12-07 15:43:22 | Re: Convert / Migrate From Oracle 11gR2 To PostgreSQL ? On CentOS 5.7 x86_64 |
Previous Message | Gauthier, Dave | 2011-12-07 15:18:27 | Re: making "\pset pager off" the default |