Re: statement level triggers in PostgreSQL , anybody?? - Mailing list pgsql-general

From Martijn van Oosterhout
Subject Re: statement level triggers in PostgreSQL , anybody??
Date
Msg-id 20040606213539.GA15018@svana.org
Whole thread Raw
In response to Re: statement level triggers in PostgreSQL , anybody??  (vikasrana@techie.com (Vikas Rana))
List pgsql-general
It's true, PostgreSQL can only check a unique contraint at the time the
row is inserted and can't defer it to the end of the statement due to
the way they are implemented (using the indexes). Sure, there has been
talk about it but I don't think anyone has done it yet.

The thing is that for the vast majority of applications the primary key
is an opaque handle with no intrinsic meaning so it never needs to be
updated hence the issue never comes up. So I'm afraid that the demand
just isn't that high.

If you want to post a patch though, it'd probably be accepted.

Hope this helps,

On Thu, Jun 03, 2004 at 06:13:17AM -0700, Vikas Rana wrote:
> > This has nothing to do with triggers, it has to do with not being able
> > to defer UNIQUE constraints. The classic solution is:
> >
> > update SET column = -column;
> > update SET column = -column+1;
>
> Thanks for the reply.
>
> Is changing query the only way to do this in postgres?
>
--
Martijn van Oosterhout   <kleptog@svana.org>   http://svana.org/kleptog/
> Patent. n. Genius is 5% inspiration and 95% perspiration. A patent is a
> tool for doing 5% of the work and then sitting around waiting for someone
> else to do the other 95% so you can sue them.

Attachment

pgsql-general by date:

Previous
From: jerry.levan@eku.edu (Jerry)
Date:
Subject: Turn off "money" formatting?
Next
From: "Peter Rahm-Coffey"
Date:
Subject: Updating a unique constrant