Re: "CREATE TEMPORARY TABLE" does not work in SQL language function?

Поиск
Список
Период
Сортировка
От Tom Lane
Тема Re: "CREATE TEMPORARY TABLE" does not work in SQL language function?
Дата
Msg-id 18705.1359661936@sss.pgh.pa.us
обсуждение исходный текст
Ответ на "CREATE TEMPORARY TABLE" does not work in SQL language function?  ("David Johnston" <polobo@yahoo.com>)
Список pgsql-general
"David Johnston" <polobo@yahoo.com> writes:
> The only difference between the following two "CREATE FUNCTION" command is
> the language in which they are written.

The reason the SQL function doesn't work is that SQL functions parse and
analyze their whole bodies before beginning execution --- so "temptbl"
doesn't exist yet when the SELECT is analyzed.  It's not about temp
tables as such, but rather that any DDL that affects the meaning of
later statements is problematic.

IIRC, there have been a few discussions about changing this behavior,
but nothing's been done, partly out of fear of breaking existing
applications.

            regards, tom lane


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

Предыдущее
От: Vincent Veyron
Дата:
Сообщение: Re: SQL sentence to insert where updated rows is zero...
Следующее
От: Kevin Grittner
Дата:
Сообщение: Re: Pg & Tcl - is it dying out?