pg.ddx.io  pgsql-sql@postgresql.org mailing list archive  
help / color / mirror / Atom feed
From: Alvaro Herrera <alvherre@alvh.no-ip.org>
To: santiago <chetzacoalt@free.fr>
Cc: pgsql-sql@postgresql.org
Subject: Re: catch an 'update  where false' ?
Date: Fri, 12 Aug 2005 11:27:58 -0400
Message-ID: <20050812152758.GA13246@alvh.no-ip.org> (raw)
In-Reply-To: <42FCBC94.1060403@free.fr>
References: <42FCBC94.1060403@free.fr>

On Fri, Aug 12, 2005 at 05:13:24PM +0200, santiago wrote:
> hello
> 
> I' trying to catch un update that fails to update because no row matchs
> the where clause:
> 
> for instance:
> update t set c=1 where cc=2;
> --and no row with cc=2
> 
> I would like to perform a
> insert into t (c) values 1;
> before the update is resolved
> 
> I hoped a trigger before update could help me, but it seems
> that if where clause evals to false, triggers are not called..

Triggers FOR EACH ROW are called once for each updated row.  I think you
could try with a "FOR EACH STATEMENT" trigger.

-- 
Alvaro Herrera (<alvherre[a]alvh.no-ip.org>)
"There is evil in the world. There are dark, awful things. Occasionally, we get
a glimpse of them. But there are dark corners; horrors almost impossible to
imagine... even in our worst nightmares." (Van Helsing, Dracula A.D. 1972)



view thread (6+ messages)  latest in thread

Message-ID: <20050812152758.GA13246@alvh.no-ip.org>
Permalink:  ../20050812152758.GA13246@alvh.no-ip.org/
Also on:    postgresql.org/message-id/20050812152758.GA13246@alvh.no-ip.org

 · 

reply

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Reply to all the recipients using the --to and --cc options:
  reply via email

  To: pgsql-sql@postgresql.org
  Cc: alvherre@alvh.no-ip.org, chetzacoalt@free.fr
  Subject: Re: catch an 'update  where false' ?
  In-Reply-To: <20050812152758.GA13246@alvh.no-ip.org>

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

This inbox is served by DDX for PostgreSQL; see mirroring instructions
for how to clone and mirror all data and code used for this inbox