Re: [GENERAL] PL/PGSQL

From: Yury Don <yura(at)vpcit(dot)ru>
To: Jens Felber <jfe(at)gek-online(dot)de>, pgsql-general(at)postgreSQL(dot)org
Subject: Re: [GENERAL] PL/PGSQL
Date: 1999-08-23 10:15:59
Message-ID: 37C11F5F.FB5E2A9F@vpcit.ru
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-general

Hi Jens.

First of all "select ... into ..." creates a new table and you can't use
existing table after "into".
And second - syntax errors in your function.
So, you must do something like:

create function insert_history () returns opaque as '
declare
rec record;
begin
for select x into rec from test1 where free=\'t\' loop
insert into history (field1, field2, ... )
values (rec.field1, rec.field2, ...);
end loop;
end;
' language 'plpgsql';

Or consider a rule for soving this task.

Sincerely yours, Yury.
don.web-page.net, ICQ 11831432

Jens Felber wrote:
>
> Hi pgsql list-members
>
> I'm new at this list an want some answers for the following problem:
>
> On every time, when my trigger is called I get
> the Message:
>
> ERROR: fmgr_info: function 87776 : cache lookup failure
>
> What means this - or where are described ERROR-Messages at the Documentation.
>
> What I've done:
>
> create table test1 (x int2, free bool);
> create table history (x
> int2);
>
> create function insert_history () returns opaque as
> 'select x into history from test1 where free=\'t\';'
> language 'plpgsql';
>
> create trigger ins1 after update on test1 for each row execute procedure
> insert_history();
>
> by and thanks
> Jens
>
> GEK CONSULTING GmbH
> An den Teichen 5
> 09224 Mittelbach
>
> Tel.: (0371) 80 88 260
> Fax.: (0371) 80 88 266
> EMail: J(dot)Felber(at)gek-consulting(dot)de
> jfe(at)gek-online(dot)de
>
> ************

In response to

  • PL/PGSQL at 1999-08-23 07:17:06 from Jens Felber

Responses

Browse pgsql-general by date

  From Date Subject
Next Message Jens Felber 1999-08-23 11:13:34 Re: [GENERAL] PL/PGSQL
Previous Message Herouth Maoz 1999-08-23 09:17:48 Re: [GENERAL] PL/PGSQL