Search Postgresql Archives

Re: Old/New

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

 



"Bob Pawley" <rjpawley@xxxxxxx> writes:
> I am getting a strange result when using the following -

>  Select fluid_id into fluidid
>  from p_id.processes
>  where new.pump1 = 'True'
>  and old.pump1 = 'False'
>   or old.pump1 is null;

> The fluid_id return is fine when there is a single row. However with two rows, and updating only one of the rows, I quite often get the fluid_id for the other row.

That WHERE condition isn't constraining the SELECT at all; you're
getting the result from the first row in the table.  I think you have
some fundamental confusion about how to work with OLD and NEW in
triggers.  They're just rowtype variables, you do not need to select
from the table to examine them.

			regards, tom lane

-- 
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