Received: from lh00.opsion.fr (lh00.opsion.fr [212.73.208.226]) by postgresql.org (8.11.3/8.11.4) with SMTP id fAS0YIm25162 for ; Tue, 27 Nov 2001 19:34:19 -0500 (EST) (envelope-from cnliou@eurosport.com) Received: from 10.1.1.8 [10.1.1.8] by lh00.opsion.fr; Wed, 28 Nov 2001 00:34:09 GMT Send-By: 203.66.130.107 with Mozilla/4.78 [en] (Win95; U) To: Subject: Re: PL/pgSQL examples NOT involving functions From: MIME-Version: 1.0 Content-Type: text/plain; charset="iso-8859-1" Date: Wed, 28 Nov 2001 00:34:09 GMT Message-id: <200111280034.09d3@lh00.opsion.fr> Content-Transfer-Encoding: 8bit X-MIME-Autoconverted: from quoted-printable to 8bit by postgresql.org id fAS0YWL25173 X-Archive-Number: 200111/375 X-Sequence-Number: 5757 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