Re: how to tell if column set on update

Поиск
Список
Период
Сортировка
От chester c young
Тема Re: how to tell if column set on update
Дата
Msg-id 137458.25689.qm@web54304.mail.re2.yahoo.com
обсуждение исходный текст
Ответ на how to tell if column set on update  (chester c young <chestercyoung@yahoo.com>)
Ответы Re: how to tell if column set on update  (Frank Bax <fbax@sympatico.ca>)
Список pgsql-sql
> 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?





В списке pgsql-sql по дате отправления:

Предыдущее
От: Tom Lane
Дата:
Сообщение: Re: Order of operations in ascii vs archive format (moderately urgent)
Следующее
От: Frank Bax
Дата:
Сообщение: Re: how to tell if column set on update