Search Postgresql Archives

Re: Old/New

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

 



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.klaver@xxxxxxxxx>
To: "Tom Lane" <tgl@xxxxxxxxxxxxx>
Cc: "Bob Pawley" <rjpawley@xxxxxxx>; "Postgresql" <pgsql-general@xxxxxxxxxxxxxx>
Sent: Friday, January 22, 2010 3:01 PM
Subject: Re:  Old/New


On Friday 22 January 2010 2:05:02 pm Tom Lane wrote:
"Bob Pawley" <rjpawley@xxxxxxx> 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.klaver@xxxxxxxxx

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


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