Re: [GENERAL] PL/PGSQL

From: Herouth Maoz <herouth(at)oumail(dot)openu(dot)ac(dot)il>
To: Jens Felber <jfe(at)gek-online(dot)de>, pgsql-general(at)postgreSQL(dot)org
Subject: Re: [GENERAL] PL/PGSQL
Date: 1999-08-23 09:17:48
Message-ID: l03130300b3e6c1277135@[147.233.159.109]
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-general

At 10:17 +0300 on 23/08/1999, Jens Felber wrote:

> 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();

I'm not sure the above is a legal plpgsql procedure. Looks more like sql
than anything procedural. One thing I'm sure is that it isn't what you
wanted to do. SELECT INTO creates a new table, so if the table exists, it
won't work. The way to populate an existing table with values from another
table is

INSERT INTO history
SELECT x
FROM test1
WHERE free;

(Note that you don't have to compare booleans... It's redundant. You can
just use them directly. But that's just a side comment. Saves you on those
escaped quotes).

Herouth

--
Herouth Maoz, Internet developer.
Open University of Israel - Telem project
http://telem.openu.ac.il/~herutma

In response to

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

Browse pgsql-general by date

  From Date Subject
Next Message Yury Don 1999-08-23 10:15:59 Re: [GENERAL] PL/PGSQL
Previous Message Stéphane FILLON 1999-08-23 08:42:40 Re: [GENERAL] PL/PGSQL