Re: Support for idempotent schema changes? - Mailing list pgsql-general

From Joshua D. Drake
Subject Re: Support for idempotent schema changes?
Date
Msg-id 45EB11BA.9070002@commandprompt.com
Whole thread Raw
In response to Re: Support for idempotent schema changes?  ("David Lowe" <dlowe@airplay.com>)
Responses Re: Support for idempotent schema changes?
List pgsql-general
David Lowe wrote:
> Within the context of a script, executing:
>
> Begin
> Statement1
> Statement2
> Statement3
> Commit
>
> Where I only wish to commit if the error is specific to the object
> already existing, and rollback for all other errors, what's the best way
> to accomplish that?
>
You would have to put each statement into a savepoint, and catch each
error that occured and commit or rollback to a savepoint
based on that result.

Joshua D. Drake



>
> -----Original Message-----
> From: Peter Eisentraut [mailto:peter_e@gmx.net]
> Sent: Saturday, March 03, 2007 11:45 PM
> To: pgsql-general@postgresql.org
> Cc: David Lowe
> Subject: Re: [GENERAL] Support for idempotent schema changes?
>
> David Lowe wrote:
>
>> So how can I make statements of the form:
>>
>
>
>> *      alter table only customers add constraint
>> a_previously_missed_constraint unique (a, b, c);
>>
>> *      add column points int4 not null default 0;
>>
>
>
>> idempotent?
>>
>
> You just ignore the error if the object already exists.
>
>


pgsql-general by date:

Previous
From: Tom Lane
Date:
Subject: Re: Configure can't find com_err on OpenBSD for --with-krb5
Next
From: Garry Saddington
Date:
Subject: Re: date format