Search Postgresql Archives

Re: Inserting Data

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

 



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" <tgl@xxxxxxxxxxxxx>
To: "Bob Pawley" <rjpawley@xxxxxxx>
Cc: "Michael Fuhr" <mike@xxxxxxxx>; "Postgresql" <pgsql-general@xxxxxxxxxxxxxx>
Sent: Wednesday, August 23, 2006 3:31 PM
Subject: Re: [GENERAL] Inserting Data


Bob Pawley <rjpawley@xxxxxxx> 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



[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