Search Postgresql Archives

Re: Postgreql 8.0.3 temporary Table Strange behaviour

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



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


[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Index of Archives]     [Postgresql Jobs]     [Postgresql Admin]     [Postgresql Performance]     [Linux Clusters]     [PHP Home]     [PHP on Windows]     [Kernel Newbies]     [PHP Classes]     [PHP Books]     [PHP Databases]     [Postgresql & PHP]     [Yosemite]
  Powered by Linux