Re: Transactional behaviour with trigger

From: Michael Fuhr <mike(at)fuhr(dot)org>
To: Joost Kraaijeveld <J(dot)Kraaijeveld(at)Askesis(dot)nl>
Cc: pgsql-sql(at)postgresql(dot)org
Subject: Re: Transactional behaviour with trigger
Date: 2006-09-17 14:36:46
Message-ID: 20060917143646.GA96792@winnie.fuhr.org
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-sql

On Sun, Sep 17, 2006 at 02:32:10PM +0200, Joost Kraaijeveld wrote:
> For the contactaddress I also have a trigger(function) that should
> update the record in the third table with the additional info of the
> contactaddress:
>
> ....
> SELECT INTO customer_record objectid FROM prototype.customers WHERE contactaddress = NEW.objectid;
> IF customer_record.objectid IS NOT NULL THEN
> UPDATE customeraddress set zipcode = NEW.zipcode, city = NEW.city, housenumber = NEW.housenumber , address = NEW.objectid
> WHERE customer = customer_record.objectid;
>
> This last trigger is executed but customer_record.objectid seems to be
> always NULL as if the the customer record is not visible. Is that
> correct or is there something wrong with the SQl above?

Where does prototype.customers fit in? Are you sure it has a row
that matches the WHERE clause? Where would that row have come from?

Is there a reason you're maintaining customeraddress as a materialized
view rather than as a "real" view?

--
Michael Fuhr

In response to

Responses

Browse pgsql-sql by date

  From Date Subject
Next Message Joost Kraaijeveld 2006-09-17 14:56:17 Re: Transactional behaviour with trigger
Previous Message Joost Kraaijeveld 2006-09-17 12:32:10 Transactional behaviour with trigger