Question Regarding a Temporary Table - Mailing list pgsql-general

From Terry Lee Tucker
Subject Question Regarding a Temporary Table
Date
Msg-id 200609201651.52231.terry@leetuckert.net
Whole thread Raw
Responses Re: Question Regarding a Temporary Table  (Jeff Davis <pgsql@j-davis.com>)
List 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@esc1.com
www.turbocorp.com

pgsql-general by date:

Previous
From: Andrew Sullivan
Date:
Subject: Re: postgresql rising
Next
From: Jeff Davis
Date:
Subject: Re: Question Regarding a Temporary Table