Re: help with version checking

Поиск
Список
Период
Сортировка
От Chris Dunworth
Тема Re: help with version checking
Дата
Msg-id 45940DD3.3040509@earthcomber.com
обсуждение исходный текст
Ответ на Re: help with version checking  (Arnau <arnaulist@andromeiberica.com>)
Ответы Re: help with version checking  (Arnau <arnaulist@andromeiberica.com>)
Список pgsql-sql
Can you do the whole thing inside a transaction context (both the 
version check and the updates)? The exception should cause the 
transaction to bail out, and the updates won't proceed.

Thus:

BEGIN;
SELECT check_version();
UPDATE agenda_version set version = '1.0.0.1' where id = 1;
COMMIT;

I tried it with your script and it seemed to work for me.

Hope this helps...

-chris


Arnau wrote:
> Tom Lane wrote:
>> Arnau <arnaulist@andromeiberica.com> writes:
>>>    I don't want, if it's possible, to create a function.
>>
>> Unlike Oracle, PG makes a strong distinction between SQL and
>> programmable languages (including plpgsql).  You can't write
>> plpgsql code without putting it into a function.
>>
>>             regards, tom lane
>>
>
> I've tried Daniel's suggestion but the Raise doesn't terminate the 
> script execution, so if doesn't do what I need. Notice the Update 1
>
> arebassa@beowulf:~$ psql -d dermagier -f upgrade_agenda.sql
> CREATE FUNCTION
> psql:upgrade_agenda.sql:16: ERROR:  This script needs Agenda version 
> 1.0.0.0, detected version 1.0.0.1
> UPDATE 1
>
>


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

Предыдущее
От: Arnau
Дата:
Сообщение: Re: help with version checking
Следующее
От: Daniel CAUNE
Дата:
Сообщение: Re: help with version checking