From: | Bob Pawley <rjpawley(at)shaw(dot)ca> |
---|---|
To: | Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us> |
Cc: | Michael Fuhr <mike(at)fuhr(dot)org>, Postgresql <pgsql-general(at)postgresql(dot)org> |
Subject: | Re: Inserting Data |
Date: | 2006-08-23 22:51:45 |
Message-ID: | 009101c6c706$b9d62c30$8e904618@owner |
Views: | Raw Message | Whole Thread | Download mbox | Resend email |
Thread: | |
Lists: | pgsql-general |
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(at)sss(dot)pgh(dot)pa(dot)us>
To: "Bob Pawley" <rjpawley(at)shaw(dot)ca>
Cc: "Michael Fuhr" <mike(at)fuhr(dot)org>; "Postgresql"
<pgsql-general(at)postgresql(dot)org>
Sent: Wednesday, August 23, 2006 3:31 PM
Subject: Re: [GENERAL] Inserting Data
> Bob Pawley <rjpawley(at)shaw(dot)ca> 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
From | Date | Subject | |
---|---|---|---|
Next Message | Tom Lane | 2006-08-23 22:52:00 | Re: invalid byte sequence ? |
Previous Message | Bruce Momjian | 2006-08-23 22:47:54 | Re: invalid byte sequence ? |