Re: creating a temp table in a function

Поиск
Список
Период
Сортировка
От Andreas 'ads' Scherbaum
Тема Re: creating a temp table in a function
Дата
Msg-id 20080404214718.734025bf@iridium.wars-nicht.de
обсуждение исходный текст
Ответ на creating a temp table in a function  ("Shahaf Abileah" <shahaf@redfin.com>)
Ответы Re: creating a temp table in a function
Список 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 по дате отправления:

Предыдущее
От: Frank Miles
Дата:
Сообщение: Exception messages -> application?
Следующее
От: Ivan Sergio Borgonovo
Дата:
Сообщение: Re: creating a temp table in a function