From: | Alvaro Herrera <alvherre(at)alvh(dot)no-ip(dot)org> |
---|---|
To: | santiago <chetzacoalt(at)free(dot)fr> |
Cc: | pgsql-sql(at)postgresql(dot)org |
Subject: | Re: catch an 'update where false' ? |
Date: | 2005-08-12 15:27:58 |
Message-ID: | 20050812152758.GA13246@alvh.no-ip.org |
Views: | Raw Message | Whole Thread | Download mbox | Resend email |
Thread: | |
Lists: | pgsql-sql |
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)
From | Date | Subject | |
---|---|---|---|
Next Message | The One | 2005-08-12 15:42:38 | Encrypting in Postgresql-8.0 |
Previous Message | santiago | 2005-08-12 15:13:24 | catch an 'update where false' ? |