Search Postgresql Archives

Re: Triggering from a specific column update

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



On Sunday 15 November 2009 5:18:20 pm Tom Lane wrote:
> "Bob Pawley" <rjpawley@xxxxxxx> 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@xxxxxxxxxxx

-- 
Sent via pgsql-general mailing list (pgsql-general@xxxxxxxxxxxxxx)
To make changes to your subscription:
http://www.postgresql.org/mailpref/pgsql-general

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Index of Archives]     [Postgresql Jobs]     [Postgresql Admin]     [Postgresql Performance]     [Linux Clusters]     [PHP Home]     [PHP on Windows]     [Kernel Newbies]     [PHP Classes]     [PHP Books]     [PHP Databases]     [Postgresql & PHP]     [Yosemite]
  Powered by Linux