pg.ddx.io  pgsql-sql@postgresql.org mailing list archive  
help / color / mirror / Atom feed
From: chester c young <chestercyoung@yahoo.com>
To: nha <lyondif02@free.fr>
Cc: sql pgsql <pgsql-sql@postgresql.org>
Subject: Re: how to tell if column set on update
Date: Tue, 21 Jul 2009 20:51:11 -0700 (PDT)
Message-ID: <137458.25689.qm@web54304.mail.re2.yahoo.com> (raw)


> Le 20/07/09 15:19, chester c young a écrit :
> > within a trigger need to know if the UPDATE statement
> set a column.  the column might be set to the old value
> or a different value.
> > 
> > (want to make sure the app is sending all necessary
> values)
> > 
> > thanks
> > 
> 
> If the column to test is known -- e.g. column MyCol --,
> NEW.MyCol and
> OLD.MyCol -- respectively value of MyCol after UPDATE and
> value of MyCol
> before UPDATE -- can be compared.

for example,
create table t1( c1 int, c2 int );
insert into t1 values( 1, 2 );

1) update t1 set c1=4 where c1=1;
2) update t1 set c1=4, c2=2 where c1=1;

each update results in the same row, but in the second update c2 was actually set.

a trigger on the update - how do we know if c2 has been actually set or not?


      



view thread (5+ messages)  latest in thread

Message-ID: <137458.25689.qm@web54304.mail.re2.yahoo.com>
Permalink:  ../137458.25689.qm@web54304.mail.re2.yahoo.com/
Also on:    postgresql.org/message-id/137458.25689.qm@web54304.mail.re2.yahoo.com

 · 

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: chestercyoung@yahoo.com, lyondif02@free.fr
  Subject: Re: how to tell if column set on update
  In-Reply-To: <137458.25689.qm@web54304.mail.re2.yahoo.com>

* 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