From: Richard Huxton <dev@archonet.com>
To: Ray Madigan <ray@madigans.org>
Cc: Pgsql-Sql <pgsql-sql@postgresql.org>
Subject: Re: Computed table name in function
Date: Wed, 10 Oct 2007 19:52:04 +0100
Message-ID: <470D1F54.6090200@archonet.com> (raw)
In-Reply-To: <IIEPJABILGOCODDLDNJFAEEHCCAA.ray@madigans.org>
References: <IIEPJABILGOCODDLDNJFAEEHCCAA.ray@madigans.org>
Ray Madigan wrote:
> I thought that the documentation said I couldn't use EXECUTE on a SELECT
> INTO?
"37.6.5. Executing Dynamic Commands
Oftentimes you will want to generate dynamic commands inside your
PL/pgSQL functions, that is, commands that will involve different tables
or different data types each time they are executed. PL/pgSQL's normal
attempts to cache plans for commands will not work in such scenarios. To
handle this sort of problem, the EXECUTE statement is provided:
EXECUTE command-string [ INTO [STRICT] target ];
where command-string is an expression yielding a string (of type text)
containing the command to be executed and target is a record variable,
row variable, or a comma-separated list of simple variables and
record/row fields.
"
There's also a FOR..IN EXECUTE loop too
--
Richard Huxton
Archonet Ltd
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Reply to all the recipients using the --to and --cc options:
reply via email
To: pgsql-sql@postgresql.org
Cc: dev@archonet.com, ray@madigans.org
Subject: Re: Computed table name in function
In-Reply-To: <470D1F54.6090200@archonet.com>
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
This inbox is served by DDX for PostgreSQL; see mirroring instructions
for how to clone and mirror all data and code used for this inbox