Question Regarding a Temporary Table

From: Terry Lee Tucker <terry(at)leetuckert(dot)net>
To: pgsql-general(at)postgresql(dot)org
Subject: Question Regarding a Temporary Table
Date: 2006-09-20 20:51:52
Message-ID: 200609201651.52231.terry@leetuckert.net
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-general

Greetings:

I have have a plpgsql function that creates a temporary table to facilitate
some processing. Here is the code:
CREATE TEMP TABLE tmp (code VARCHAR,
booked INTEGER,
avail INTEGER,
covered INTEGER,
profit NUMERIC (10,2),
billed NUMERIC (10,2))
WITHOUT OIDS ON COMMIT DROP;

Note the "ON COMMIT DROP". I would expect this table to disapear after the
function completes, but it does not. Also, if I execute the the function
twice in a row from the psql interface, on the second try, I get the
following error:
sev=# select * from custSprtRpt('04/01/06', current_date);
NOTICE: custSprtRpt ()
ERROR: relation with OID 123654 does not exist
CONTEXT: PL/pgSQL function "custsprtrpt" line 39 at SQL statement

If have to reload the function with \i sqlfunc/custSprtRpt.plsql so that it
will work again. Why is this?

Also, this function does not perform any updates to a permanent database
table.

Anyone have any insight into this issue?

sev=# select version();
version
--------------------------------------------------------------------------------------------------------------
PostgreSQL 7.4.6 on i686-redhat-linux-gnu, compiled by GCC gcc (GCC) 3.2.3
20030502 (Red Hat Linux 3.2.3-49)
(1 row)

Thanks...
--
Terry Tucker
Turbo's IT Manager
Turbo, division of Ozburn-Hessey Logistics
2251 Jesse Jewell Pkwy NE
Gainesville, GA 30501
Tel: (336) 372-6812 Fax: (336) 372-6812 Cell: (336) 363-4719
terry(at)esc1(dot)com
www.turbocorp.com

Responses

Browse pgsql-general by date

  From Date Subject
Next Message Jeff Davis 2006-09-20 21:09:40 Re: Question Regarding a Temporary Table
Previous Message Andrew Sullivan 2006-09-20 20:45:00 Re: postgresql rising