Re: Postgreql 8.0.3 temporary Table Strange behaviour

Поиск
Список
Период
Сортировка
От Richard Huxton
Тема Re: Postgreql 8.0.3 temporary Table Strange behaviour
Дата
Msg-id 444C8FC5.4040503@archonet.com
обсуждение исходный текст
Ответ на Postgreql 8.0.3 temporary Table Strange behaviour  (Dany De Bontridder <dany@alchimerys.be>)
Ответы Re: Postgreql 8.0.3 temporary Table Strange behaviour  (Dany De Bontridder <dany@alchimerys.be>)
Список pgsql-general
Dany De Bontridder wrote:
> If you have a look to the following code, I'm trying to work around
> the limitation about execute, which doesn't accept "select into".



http://www.postgresql.org/docs/8.0/static/plpgsql-statements.html#PLPGSQL-STATEMENTS-EXECUTING-DYN

The results from SELECT commands are discarded by EXECUTE, and SELECT
INTO is not currently supported within EXECUTE. So there is no way to
extract a result from a dynamically-created SELECT using the plain
EXECUTE command. There are two other ways to do it, however: one is to
use the FOR-IN-EXECUTE loop form described in Section 35.7.4, and the
other is to use a cursor with OPEN-FOR-EXECUTE, as described in Section
35.8.2.

Do these two not solve your problem?

> So
> I call the function with a table name as parameter, the function
> insert a record in a temporary table, retrieve it and return it.
>
> The strange thing, is that the table is created if it doesn't exist,
> and is dropped after a commit.  Just like the sql is already parsed
> and cannot be re-parsed.

The final "select ... from tt ..." is just that.

--
   Richard Huxton
   Archonet Ltd

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

Предыдущее
От: "A. Kretschmer"
Дата:
Сообщение: Re: to know
Следующее
От: vladimir
Дата:
Сообщение: Re: Transactions, PostgreSQL and MS Access front end.