From: | "Gregory Wood" <gregw(at)com-stock(dot)com> |
---|---|
To: | "Ben-Nes Michael" <miki(at)canaan(dot)co(dot)il> |
Cc: | "PostgreSQL-General" <pgsql-general(at)postgresql(dot)org> |
Subject: | Re: unique & update |
Date: | 2002-01-31 19:26:53 |
Message-ID: | 02a001c1aa8d$3ec45750$7889ffcc@comstock.com |
Views: | Raw Message | Whole Thread | Download mbox | Resend email |
Thread: | |
Lists: | pgsql-general |
> 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 ?
Just do:
RAISE EXCEPTION ''I did some checking, and decided to quit and rollback'';
> 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 ?
By default, it checks after the row was updated, but you can make it
INITIALLY DEFERRED which will wait until after the transaction to check. To
be honest, I'm not sure if you have to declare it DEFERRABLE as well, or if
the INITIALLY DEFERRED will handle both.
Greg
From | Date | Subject | |
---|---|---|---|
Next Message | Doug McNaught | 2002-01-31 19:28:24 | Re: unique & update |
Previous Message | Milos Prudek | 2002-01-31 19:25:11 | index does not improve performance |