Re: PL/pgSQL examples NOT involving functions

From: <cnliou(at)eurosport(dot)com>
To: <pgsql-sql(at)postgresql(dot)org>
Subject: Re: PL/pgSQL examples NOT involving functions
Date: 2001-11-28 00:34:09
Message-ID: 200111280034.09d3@lh00.opsion.fr
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-sql

Hello!

> envisity=# create table temp (tempid integer);
> CREATE
> envisity=# INSERT INTO temp VALUES(1);
>
> CREATE FUNCTION test3() RETURNS INTEGER AS 'DECLARE
id INTEGER; BEGIN SELECT INTO id tempid FROM temp
LIMIT 1; RETURN id; END;' LANGUAGE 'plpgsql';
> DROP
> CREATE
> envisity=# select test3();
> test3
> -------
> 1
> (1 row)
>
> envisity=# DROP TABLE temp ;
> DROP
> envisity=# create table temp (tempid integer);
> CREATE
> envisity=# INSERT INTO temp VALUES(3);
> INSERT 150371 1
> envisity=# select test3();
> ERROR: Relation 150348 does not exist

If I exit plpgsql and reenter, then "select test3()"
works again. So I guess "the first time" in

"The PL/pgSQL call handler parses the function's
source text and produces an internal binary
instruction tree the first time the function is
called."

might be referring to "for each client connection".

CN

--------------------------------------------------------
You too can have your own email address from Eurosport.
http://www.eurosport.com

Responses

Browse pgsql-sql by date

  From Date Subject
Next Message Roberto Mello 2001-11-28 01:10:18 Re: hu.po
Previous Message Stephan Szabo 2001-11-28 00:32:03 Re: PL/pgSQL examples NOT involving functions