Re: unique & update

From: Darren Ferguson <darren(at)crystalballinc(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 20:14:41
Message-ID: Pine.LNX.4.10.10201311513360.1158-100000@thread.crystalballinc.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-general

Use a trigger and if the trigger fails then it should rollback everything
that you had done.

Triggers can be fired per row instead of the whole table once the update
is completed

Darren Ferguson

On Thu, 31 Jan 2002, Ben-Nes Michael wrote:

> > > Is there a way to do UNIQUE check after the whole table got updated ?
> > > If not, any ideas to walk around the problem ?
> > The closest thing I could think of would be a constraint trigger that did
> > a uniqueness check but that'll probably be somewhat slower (a trigger that
> > looks for something like: select lft from areas group by lft having
> > count(*)>1;)
>
> 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 ?
>
> 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 ?
>
> Cheer
>
> --------------------------
> Canaan Surfing Ltd.
> Internet Service Providers
> Ben-Nes Michael - Manager
> Tel: 972-4-6991122
> http://sites.canaan.co.il
> --------------------------
>
>
>
> ---------------------------(end of broadcast)---------------------------
> TIP 6: Have you searched our list archives?
>
> http://archives.postgresql.org
>

In response to

Browse pgsql-general by date

  From Date Subject
Next Message Jason Earl 2002-01-31 20:17:00 Re: index does not improve performance
Previous Message Cindy 2002-01-31 20:11:01 Re: going crazy with serial type