Re: statement level triggers in PostgreSQL , anybody??

From: Martijn van Oosterhout <kleptog(at)svana(dot)org>
To: Vikas Rana <vikasrana(at)techie(dot)com>
Cc: pgsql-general(at)postgresql(dot)org
Subject: Re: statement level triggers in PostgreSQL , anybody??
Date: 2004-06-06 21:35:42
Message-ID: 20040606213539.GA15018@svana.org
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: 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(at)svana(dot)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.

In response to

Browse pgsql-general by date

  From Date Subject
Next Message Marc G. Fournier 2004-06-06 22:33:56 Re: News outage?
Previous Message Jerry 2004-06-06 20:44:26 Turn off "money" formatting?