Re: unique & update

From: Doug McNaught <doug(at)wireboard(dot)com>
To: "Ben-Nes Michael" <miki(at)canaan(dot)co(dot)il>
Cc: "Stephan Szabo" <sszabo(at)megazone23(dot)bigpanda(dot)com>, <pgsql-general(at)postgresql(dot)org>
Subject: Re: unique & update
Date: 2002-01-31 19:28:24
Message-ID: m3aduuuxpj.fsf@varsoon.denali.to
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-general

"Ben-Nes Michael" <miki(at)canaan(dot)co(dot)il> writes:

> How can I rollback in a function ?
> I mean after update has been done, I do some checking in the Function and
> then decide that I want to quit and rollback all what inserted/updated in
> the start of the function ?

A function is always executed inside a transaction. You can roll back
the whole transaction by throwing an error, but you can't roll back
just what you did in the function.

There is talk of adding savepoints to PG (possibly in 7.3) which would
allow this, but right now there is no mechanism for it.

> Also if I attach trigger that check column uniqueness to an update will it
> check it per updated row or at the end of the action after all the table got
> updated ?

Why not just create a unique index rather than using a trigger?

-Doug
--
Let us cross over the river, and rest under the shade of the trees.
--T. J. Jackson, 1863

In response to

Responses

Browse pgsql-general by date

  From Date Subject
Next Message Gregory Wood 2002-01-31 19:35:19 Re: unique & update
Previous Message Gregory Wood 2002-01-31 19:26:53 Re: unique & update