Skip site navigation (1) Skip section navigation (2)

Re: statement level triggers in PostgreSQL , anybody??

From: Martijn van Oosterhout <kleptog(at)svana(dot)org>
To: rama <nramakrishna7(at)yahoo(dot)com>
Cc: pgsql-general(at)postgresql(dot)org
Subject: Re: statement level triggers in PostgreSQL , anybody??
Date: 2004-05-31 22:10:03
Message-ID: (view raw, whole thread or download thread mbox)
Lists: pgsql-general
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;

The problem is that you're trying to update the primary key, which is a
bad idea is most situations.

On Thu, May 27, 2004 at 06:28:08AM -0700, rama wrote:
> Hi,
>      I am a bit troubled with the row-level triggers which PostgreSQL
> uses when using update table cpmmand.
>      For instance, if the primary key column has values 1,2,3,... and
> i want to update the whole column as column = colunm + 1 , then there
> is an error. This obviously works on databases such as mssql which has
> row level triggers.
>      Any suggestions so that i do not have to modify the query and
> still make it work in the postgresql database ??
> ---------------------------(end of broadcast)---------------------------
> TIP 3: if posting/reading through Usenet, please send an appropriate
>       subscribe-nomail command to majordomo(at)postgresql(dot)org so that your
>       message can get through to the mailing list cleanly

Martijn van Oosterhout   <kleptog(at)svana(dot)org>
> 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


pgsql-general by date

Next:From: Jim RosenbergDate: 2004-05-31 23:00:41
Subject: Re: Poatgresql database on more than one disk
Previous:From: Martijn van OosterhoutDate: 2004-05-31 22:04:59
Subject: Re: Does INSERT inserts always at the end ?

Privacy Policy | About PostgreSQL
Copyright © 1996-2017 The PostgreSQL Global Development Group