| From: | Richard Huxton <dev(at)archonet(dot)com> |
|---|---|
| To: | Dany De Bontridder <dany(at)alchimerys(dot)be> |
| Cc: | pgsql-general(at)postgresql(dot)org |
| Subject: | Re: Postgreql 8.0.3 temporary Table Strange behaviour |
| Date: | 2006-04-24 08:43:49 |
| Message-ID: | 444C8FC5.4040503@archonet.com |
| Views: | Whole Thread | Raw Message | Download mbox | Resend email |
| Thread: | |
| Lists: | 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
| From | Date | Subject | |
|---|---|---|---|
| Next Message | Richard Huxton | 2006-04-24 08:48:16 | Re: to know |
| Previous Message | Jo De Haes | 2006-04-24 08:03:56 | Re: invalid page header |