Re: problem with creating/dropping tables and plpgsql ?

Поиск
Список
Период
Сортировка
От Tom Lane
Тема Re: problem with creating/dropping tables and plpgsql ?
Дата
Msg-id 3727.995644411@sss.pgh.pa.us
обсуждение исходный текст
Ответ на problem with creating/dropping tables and plpgsql ?  ("\(::\) Bob Ippolito" <bob@redivi.com>)
Список pgsql-hackers
"\(::\) Bob Ippolito" <bob@redivi.com> writes:
> semantic=# DROP table ttmptable;
> DROP
> semantic=# create temp table ttmptable(lookup_id int, rating int);
> CREATE
> semantic=# SELECT doEverythingTemp(20706,2507);
> ERROR:  Relation 4348389 does not exist

Yeah, temp tables and plpgsql functions don't coexist very well yet.
(plpgsql tries to cache query plans, and at the moment there's no
mechanism to let it flush obsolete plans when a table is deleted.)

What you'll need to do is create a temp table that lasts for the whole
session and is re-used by each successive call of the plpgsql function.
You don't need to worry about dropping the temp table at session exit;
that's what temp tables are for, after all, to go away automatically.
So, just delete all its contents at entry or exit of the function,
and you can re-use it each time through.
        regards, tom lane


В списке pgsql-hackers по дате отправления:

Предыдущее
От: Lamar Owen
Дата:
Сообщение: Re: Re: hub.org out of disk space
Следующее
От: jozzano
Дата:
Сообщение: BUG (fixed) in CREATE TABLE ADD CONSTRAINT...(v-7.0.2)