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

---------------------------(end of broadcast)---------------------------
TIP 6: explain analyze is your friend

Reply via email to