Received: from jbarilla.student.princeton.edu (jbarilla.student.Princeton.EDU [140.180.137.120]) by postgresql.org (Postfix) with ESMTP id C9E30475872 for ; Mon, 29 Apr 2002 02:20:04 -0400 (EDT) Received: (from jbarilla@localhost) by jbarilla.student.princeton.edu (8.11.6/8.11.6) id g3T6K4E00632; Mon, 29 Apr 2002 02:20:04 -0400 To: pgsql-sql Subject: Temporary table weirdness From: Joseph Barillari X-Public-Key: finger -l jbarilla@phoenix.princeton.edu X-Public-Key-Fingerprint: 99C7 4F49 AF41 AD0F A4FC 529C 215E 1BD2 F6A1 FA37 X-URL: http://www.princeton.edu/~jbarilla Date: Mon, 29 Apr 2002 02:20:00 -0400 Message-ID: Lines: 35 User-Agent: Gnus/5.090006 (Oort Gnus v0.06) Emacs/21.2.50 (i686-pc-linux-gnu) MIME-Version: 1.0 Content-Type: multipart/signed; boundary="=-=-="; micalg=pgp-sha1; protocol="application/pgp-signature" X-Archive-Number: 200204/351 X-Sequence-Number: 7615 --=-=-= Content-Transfer-Encoding: quoted-printable Hi, I have a function that creates and destroys temporary tables in the course of its work, and have run into trouble if the function is executed more than once during a database session. A small proof-of-concept is attached below: cal=3D> create or replace function frob() returns integer as 'begin create = temporary table foo(bar INT); insert into foo (bar) values (1); drop table = foo; return 1; end;' language 'plpgsql'; CREATE (seems pretty standard) cal=3D> select frob(); frob=20 ------ 1 (1 row) (OK so far...) cal=3D> select frob(); NOTICE: Error occurred while executing PL/pgSQL function frob NOTICE: line 1 at SQL statement ERROR: Relation 68141 does not exist On the second call, PostgreSQL chokes. Any suggestions as to why would be appreciated. Oddly enough, redefining the function eliminates the error for the next function call. Thanks, Joe --=-=-= Content-Type: application/pgp-signature -----BEGIN PGP MESSAGE----- Version: GnuPG v1.0.6 (GNU/Linux) Comment: Processed by Mailcrypt 3.5.6 and Gnu Privacy Guard iD8DBQE8zOYRIV4b0vah+jcRAiv9AJ9mVmmvZdgFj39es40WvHG9cF+rfgCfb+8U 3okBX8N9DplLtFvfU3CnX6g= =U/fZ -----END PGP MESSAGE----- --=-=-=--