Re: Old/New

Поиск
Список
Период
Сортировка
От Tom Lane
Тема Re: Old/New
Дата
Msg-id 16075.1264115760@sss.pgh.pa.us
обсуждение исходный текст
Ответ на Old/New  ("Bob Pawley" <rjpawley@shaw.ca>)
Список pgsql-general
"Bob Pawley" <rjpawley@shaw.ca> 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
quiteoften 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

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

Предыдущее
От: "Bob Pawley"
Дата:
Сообщение: Old/New
Следующее
От: "Gauthier, Dave"
Дата:
Сообщение: array element replace ?