Thanks Tom

But my problem with this solution comes whan I try to qualify with a 'where' clause.
For instance -
----
create or replace function loop_association() returns trigger as $$
begin

insert into p_id.loops (monitor) values (new.devices_id)
where new.device_number = library.devices.device_number
and library.devices.type_ = 'mon' ;

return null ;
end ;
$$ language plpgsql ;

create trigger loop after insert on p_id.devices
for each row execute procedure loop_association();
----
Gives me an error.

What am I doing wrong?

Bob
----- Original Message ----- From: "Tom Lane" <[EMAIL PROTECTED]>
To: "Bob Pawley" <[EMAIL PROTECTED]>
Cc: "Michael Fuhr" <[EMAIL PROTECTED]>; "Postgresql" <pgsql-general@postgresql.org>
Sent: Wednesday, August 23, 2006 3:31 PM
Subject: Re: [GENERAL] Inserting Data


Bob Pawley <[EMAIL PROTECTED]> writes:
I thought the NEW qualified the select.

Not at all; that would rather cripple the ability to write interesting
triggers.  I think what you are really wanting to do here is just

insert into p_id.loops (monitor) values (new.devices_id);

regards, tom lane

---------------------------(end of broadcast)---------------------------
TIP 3: Have you checked our extensive FAQ?

http://www.postgresql.org/docs/faq


---------------------------(end of broadcast)---------------------------
TIP 2: Don't 'kill -9' the postmaster

Reply via email to