Re: Support for idempotent schema changes?

From: "David Lowe" <dlowe(at)airplay(dot)com>
To: <pgsql-general(at)postgresql(dot)org>
Cc: "Peter Eisentraut" <peter_e(at)gmx(dot)net>
Subject: Re: Support for idempotent schema changes?
Date: 2007-03-04 16:02:05
Message-ID: A59E91A937445645A59CEFAAA15D642646DB05@exch.apnwi.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-general

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?

-----Original Message-----
From: Peter Eisentraut [mailto:peter_e(at)gmx(dot)net]
Sent: Saturday, March 03, 2007 11:45 PM
To: pgsql-general(at)postgresql(dot)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.

--
Peter Eisentraut
http://developer.postgresql.org/~petere/

In response to

Responses

Browse pgsql-general by date

  From Date Subject
Next Message Shane Ambler 2007-03-04 16:15:26 Re: issue with select currval
Previous Message Raymond O'Donnell 2007-03-04 15:28:33 Re: date format