Re: creating a temp table in a function - Mailing list pgsql-general

From Andreas 'ads' Scherbaum
Subject Re: creating a temp table in a function
Date
Msg-id 20080404214718.734025bf@iridium.wars-nicht.de
Whole thread Raw
In response to creating a temp table in a function  ("Shahaf Abileah" <shahaf@redfin.com>)
Responses Re: creating a temp table in a function  (Raymond O'Donnell <rod@iol.ie>)
List pgsql-general
On Fri, 4 Apr 2008 09:13:18 -0700 Shahaf Abileah wrote:

> I have a function that creates a temp table and drops it on commit.  If
> I run the function twice in the same psql interactive session, I get an
> error.  If I run it twice in two different psql sessions (using the -c
> flag), I get no error.  Is this expected behavior?  If so, why?

Create a query in a text string and run the query with EXECUTE.

In your case the OIDs are determined during parsing, but in the next
function call the temp table is gone away. So you have to make sure the
table is dynamically created.


Kind regards

--
                Andreas 'ads' Scherbaum
German PostgreSQL User Group
European PostgreSQL User Group - Board of Directors

pgsql-general by date:

Previous
From: Frank Miles
Date:
Subject: Exception messages -> application?
Next
From: Ivan Sergio Borgonovo
Date:
Subject: Re: creating a temp table in a function