From: | "Bob Pawley" <rjpawley(at)shaw(dot)ca> |
---|---|
To: | "Adrian Klaver" <adrian(dot)klaver(at)gmail(dot)com> |
Cc: | "Tom Lane" <tgl(at)sss(dot)pgh(dot)pa(dot)us>, "Postgresql" <pgsql-general(at)postgresql(dot)org> |
Subject: | Re: Old/New |
Date: | 2010-01-22 21:47:37 |
Message-ID: | 592E4536C2304C80B4B9DDC72D551D60@desktop |
Views: | Raw Message | Whole Thread | Download mbox | Resend email |
Thread: | |
Lists: | pgsql-general |
I have a table labeled p_id.processes. One row is inserted into it by
another source containing fluid_id 3501 and other fields.
The update statement -
update p_id.processes
set pump1 = 'True'
where p_id.processes.fluid_id = '3501' ;
updates the field pump1 to 'True'.
The After Update trigger has an insert statement that inserts the
p_id.processes row into the table p_id.devices. For pump1 I want only one
row inserted into p_id.devices containing fluid_id = '3501 and 'Pump #1'.
Insert statement -
Begin
If new.pump1 = 'True'
then
Insert into p_id.devices (p_id_id, process_id, fluid_id, status,
process_graphics_id, device_description)
values (new.p_id_id, new.process_id, new.fluid_id, 'Pump #1', '11',
'Pump');
End if;
Instead I get two identical rows inserted containing the fluid_id = '3501'
and 'Pump #1'.
Bob
----- Original Message -----
From: "Adrian Klaver" <adrian(dot)klaver(at)gmail(dot)com>
To: "Bob Pawley" <rjpawley(at)shaw(dot)ca>
Cc: "Tom Lane" <tgl(at)sss(dot)pgh(dot)pa(dot)us>; "Postgresql"
<pgsql-general(at)postgresql(dot)org>
Sent: Friday, January 22, 2010 1:24 PM
Subject: Re: [GENERAL] Old/New
> On 01/22/2010 01:16 PM, Bob Pawley wrote:
>> I have a single row that is being duplicated on insert.
>>
>> Update statement -
>> update p_id.processes
>> set pump1 = 'True'
>> where p_id.processes.fluid_id = '3501' ;
>>
>> The proper field is updated.
>>
>> Bob
>>
>
>
> This is insufficient detail. What is the row? What are the two versions?
> Is the insert you are talking about being done on the table with the
> trigger or the table referred to in the trigger?
>
>
> --
> Adrian Klaver
> adrian(dot)klaver(at)gmail(dot)com
>
> --
> Sent via pgsql-general mailing list (pgsql-general(at)postgresql(dot)org)
> To make changes to your subscription:
> http://www.postgresql.org/mailpref/pgsql-general
From | Date | Subject | |
---|---|---|---|
Next Message | Tom Lane | 2010-01-22 22:05:02 | Re: Old/New |
Previous Message | Serge Fonville | 2010-01-22 21:45:21 | Re: MySQL -> Postgres migration tools? |