From: | "Bob Pawley" <rjpawley(at)shaw(dot)ca> |
---|---|
To: | <adrian(dot)klaver(at)gmail(dot)com>, "Tom Lane" <tgl(at)sss(dot)pgh(dot)pa(dot)us> |
Cc: | "Postgresql" <pgsql-general(at)postgresql(dot)org> |
Subject: | Re: Old/New |
Date: | 2010-01-22 23:05:54 |
Message-ID: | 31C509E705324D7A9D2B9928C92E53AD@desktop |
Views: | Raw Message | Whole Thread | Download mbox | Resend email |
Thread: | |
Lists: | pgsql-general |
This is the whole trigger
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;
If new.pump2 = '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 #2', '11',
'Pump');
End if ;
RETURN NULL;
END;
Bob
----- Original Message -----
From: "Adrian Klaver" <adrian(dot)klaver(at)gmail(dot)com>
To: "Tom Lane" <tgl(at)sss(dot)pgh(dot)pa(dot)us>
Cc: "Bob Pawley" <rjpawley(at)shaw(dot)ca>; "Postgresql"
<pgsql-general(at)postgresql(dot)org>
Sent: Friday, January 22, 2010 3:01 PM
Subject: Re: [GENERAL] Old/New
> On Friday 22 January 2010 2:05:02 pm Tom Lane wrote:
>> "Bob Pawley" <rjpawley(at)shaw(dot)ca> writes:
>> > Instead I get two identical rows inserted containing the fluid_id =
>> > '3501' and 'Pump #1'.
>>
>> Seems like the only way that's possible with the INSERT .. VALUES
>> formulation is if the trigger function gets executed twice. Maybe you
>> accidentally created two instances of the trigger? psql's \d on the
>> table should list the triggers for you.
>>
>> regards, tom lane
>
> In addition to the above, is there more to the trigger function then what
> you
> have shown so far?
>
> --
> 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 | Adrian Klaver | 2010-01-22 23:19:15 | Re: Old/New |
Previous Message | Adrian Klaver | 2010-01-22 23:01:34 | Re: Old/New |