Re: ALTER EXTENSION UPGRADE, v3

Поиск
Список
Период
Сортировка
От Žiga Kranjec
Тема Re: ALTER EXTENSION UPGRADE, v3
Дата
Msg-id FDEA41D4-4A3A-4EE4-8EC6-C231C1BB6FC6@ljudmila.org
обсуждение исходный текст
Ответ на Re: ALTER EXTENSION UPGRADE, v3  (Anssi Kääriäinen <anssi.kaariainen@thl.fi>)
Ответы Re: ALTER EXTENSION UPGRADE, v3  (Tom Lane <tgl@sss.pgh.pa.us>)
Список pgsql-hackers
This might be a silly idea, but I'm not sure if it was really
discussed with respect to extensions here before...

Why not use PL/pgSQL as install/upgrade script language,
specially now when it's included in the core by default?

This would allow for relatively straightforward inclusion
of conditional logic, etc in install/upgrade scripts.

All current contrib stuff runs great as PL/pgSQL, for example.

The @ placeholder syntax just seems outright hideous and doesn't
feel quite right either.

Also worth considering might be, how the proposed extension
system relates to SQL standard modules (ie. CREATE MODULE, etc),
which might be implemented in the future.
There are are some obvious overlaps (relocatable/fixed extensions vs.
modules with/without schemas, for example).

Also, consider the following case:
I have two different users, u1 and u2 with corresponding schemas, u1 and u2,
both using hstore, for example. Right now, I can load hstore.sql contrib
into both, u1 and u2  it all works great.
If I understand correctly, such an arrangement would not really be supported
with extensions as they stand now.


Ziga Kranjec,
developer, ljudmila.org




On Feb 3, 2011, at 9:28 AM, Anssi Kääriäinen wrote:

> On 02/03/2011 12:23 AM, Robert Haas wrote:
>> [..]
>> -- unconditional stuff
>>
>> [..6]
>> -- stuff to do if coming from pre-7
>>
>> [..]
>> -- some more unconditional stuff
>>
>> [6..12]
>> -- stuff to do if coming from between 6 and 12
>>
>> [..]
>> -- a few more unconditional things
> This might be a stupid idea, but how about introducing another placeholder variable in addition to @extschema@ when
upgrading,named maybe @fromversion@. Combined with do blocks and pg_execute_extension_file this would allow doing the
abovestuff: 
>
> upgrade.sql contents:
> [..]
> -- uncoditional stuff
> [..6]
> DO $$
> begin
>    if @fromversion@ matches [..6] then
>        pg_execute_extension_file('stuff to do if coming from pre-7-file');
>    end if;
> end;
> $$
> language 'plpgsql';
> ...
>
> - Anssi
>
> --
> Sent via pgsql-hackers mailing list (pgsql-hackers@postgresql.org)
> To make changes to your subscription:
> http://www.postgresql.org/mailpref/pgsql-hackers



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

Предыдущее
От: Dimitri Fontaine
Дата:
Сообщение: Re: ALTER EXTENSION UPGRADE, v3
Следующее
От: Thom Brown
Дата:
Сообщение: Typo in create user mapping docs page