pg.ddx.io  pgsql-sql@postgresql.org mailing list archive  
help / color / mirror / Atom feed
From: Michael Fuhr <mike@fuhr.org>
To: Joost Kraaijeveld <J.Kraaijeveld@Askesis.nl>
Cc: pgsql-sql@postgresql.org
Subject: Re: Transactional behaviour with trigger
Date: Sun, 17 Sep 2006 08:36:46 -0600
Message-ID: <20060917143646.GA96792@winnie.fuhr.org> (raw)
In-Reply-To: <1158496330.6107.17.camel@panoramix>
References: <1158496330.6107.17.camel@panoramix>

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



view thread (3+ messages)  latest in thread

Message-ID: <20060917143646.GA96792@winnie.fuhr.org>
Permalink:  ../20060917143646.GA96792@winnie.fuhr.org/
Also on:    postgresql.org/message-id/20060917143646.GA96792@winnie.fuhr.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: mike@fuhr.org, J.Kraaijeveld@Askesis.nl
  Subject: Re: Transactional behaviour with trigger
  In-Reply-To: <20060917143646.GA96792@winnie.fuhr.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