Skip site navigation (1) Skip section navigation (2)

Re: help with version checking

From: Chris Dunworth <cdunworth(at)earthcomber(dot)com>
To: arnaulist(at)andromeiberica(dot)com
Cc: pgsql-sql(at)postgresql(dot)org
Subject: Re: help with version checking
Date: 2006-12-28 18:32:51
Message-ID: (view raw, whole thread or download thread mbox)
Lists: 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.


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

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

Hope this helps...


Arnau wrote:
> Tom Lane wrote:
>> Arnau <arnaulist(at)andromeiberica(dot)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(at)beowulf:~$ psql -d dermagier -f upgrade_agenda.sql
> psql:upgrade_agenda.sql:16: ERROR:  This script needs Agenda version 
>, detected version

In response to


pgsql-sql by date

Next:From: roopa perumalrajaDate: 2006-12-29 01:05:04
Subject: Help in altering the column lenght
Previous:From: ArnauDate: 2006-12-28 18:20:55
Subject: Re: help with version checking

Privacy Policy | About PostgreSQL
Copyright © 1996-2017 The PostgreSQL Global Development Group