Re: ALTER EXTENSION UPGRADE, v3

From: Anssi Kääriäinen <anssi(dot)kaariainen(at)thl(dot)fi>
To: Robert Haas <robertmhaas(at)gmail(dot)com>
Cc: "David E(dot) Wheeler" <david(at)kineticode(dot)com>, Dimitri Fontaine <dimitri(at)2ndquadrant(dot)fr>, Itagaki Takahiro <itagaki(dot)takahiro(at)gmail(dot)com>, PostgreSQL Hackers <pgsql-hackers(at)postgresql(dot)org>
Subject: Re: ALTER EXTENSION UPGRADE, v3
Date: 2011-02-03 08:28:51
Message-ID: 4D4A6743.3000701@thl.fi
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-hackers

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(at)(dot) Combined with do blocks and
pg_execute_extension_file this would allow doing the above stuff:

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

In response to

Responses

Browse pgsql-hackers by date

  From Date Subject
Next Message Dimitri Fontaine 2011-02-03 08:46:18 Re: ALTER EXTENSION UPGRADE, v3
Previous Message Magnus Hagander 2011-02-03 08:22:13 Re: compiler warning