Re: Transactional behaviour with trigger - Mailing list pgsql-sql

From Michael Fuhr
Subject Re: Transactional behaviour with trigger
Date
Msg-id 20060917143646.GA96792@winnie.fuhr.org
Whole thread Raw
In response to Transactional behaviour with trigger  (Joost Kraaijeveld <J.Kraaijeveld@Askesis.nl>)
Responses Re: Transactional behaviour with trigger
List 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


pgsql-sql by date:

Previous
From: Joost Kraaijeveld
Date:
Subject: Transactional behaviour with trigger
Next
From: Joost Kraaijeveld
Date:
Subject: Re: Transactional behaviour with trigger