Re: Triggering from a specific column update

Поиск
Список
Период
Сортировка
От Adrian Klaver
Тема Re: Triggering from a specific column update
Дата
Msg-id 200911151755.35183.aklaver@comcast.net
обсуждение исходный текст
Ответ на Re: Triggering from a specific column update  (Tom Lane <tgl@sss.pgh.pa.us>)
Список pgsql-general
On Sunday 15 November 2009 5:18:20 pm Tom Lane wrote:
> "Bob Pawley" <rjpawley@shaw.ca> writes:
> > Hope this elucidates you?
>
> No, it's all handwaving.  In particular, showing only a fragment from
> a case that does work as you expect doesn't illuminate what's not
> working.   Please show the whole table definition, the whole trigger,
> and the specific case that's not doing what you expect.
>
>             regards, tom lane

The above would help greatly with coming to a correct answer. In the mean time
the problem seems to be that the trigger fires and inserts a row everytime it
sees a NEW.pump* value = 'True'. Since an update in Postgres is basically an
insert/delete operation everytime you update you will get back the existing
values as well as any changed values in the current update. This means if you
do sequential updates changing the pump1 to 'True',pump2 to 'True' and serial
values the trigger will keep inserting rows because the new.pump1 value will
meet the the IF condition. The way I have dealt with this is to do NEW.*/OLD.*
comparisons to determine if I am truly looking at a changed value or a recycled
one.

--
Adrian Klaver
aklaver@comcast.net

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

Предыдущее
От: John Mitchell
Дата:
Сообщение: When running pgsql2shp it truncates fields that are over 10 characters. How can I prevent this from occurring?
Следующее
От: Greg Smith
Дата:
Сообщение: Re: Voting: "pg_ctl init" versus "initdb"