agora inbox for pgsql-sql@postgresql.org
help / color / mirror / Atom feedFrom: Craig Ringer <craig@2ndquadrant.com>
To: Roy Blum <blumroy@gmail.com>
To: pgsql-sql@postgresql.org
Subject: Re: Use a TEXT string which is an output from a function for executing a new query in postgres
Date: Thu, 08 Jan 2015 08:08:00 +0800
Message-ID: <54ADCA60.1050904@2ndquadrant.com> (raw)
In-Reply-To: <CAH4KVCCsbXffLQaznYnEKD9WTenhZtwhaE+D9YPTFNZnVDsxTA@mail.gmail.com>
References: <CAH4KVCCsbXffLQaznYnEKD9WTenhZtwhaE+D9YPTFNZnVDsxTA@mail.gmail.com>
List-Unsubscribe: <mailto:majordomo@postgresql.org?body=unsub%20pgsql-sql>
On 01/08/2015 02:12 AM, Roy Blum wrote:
> I have created a function *myresult()* that receives as input Table
> name, and a Prefix, it then creates an SQL one liner command to SELECT
> from the specified table only the columns that share the designated
> prefix. It output a string which is basically the desired SQL command.
> My function is as follows and I show how I call it as well:
This is reposted from Stack Overflow, where it has already been pretty
comprehensively answered.
http://stackoverflow.com/q/27808534/398670
http://stackoverflow.com/q/27824725/398670
As suggested earlier - return a refcursor.
--
Craig Ringer http://www.2ndQuadrant.com/
PostgreSQL Development, 24x7 Support, Training & Services
--
Sent via pgsql-sql mailing list (pgsql-sql@postgresql.org)
To make changes to your subscription:
http://www.postgresql.org/mailpref/pgsql-sql
view thread (3+ messages)
Message-ID: <54ADCA60.1050904@2ndquadrant.com>
Permalink: ../54ADCA60.1050904@2ndquadrant.com/
Also on: postgresql.org/message-id/54ADCA60.1050904@2ndquadrant.com
reply
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: craig@2ndquadrant.com, blumroy@gmail.com
Subject: Re: Use a TEXT string which is an output from a function for executing a new query in postgres
In-Reply-To: <54ADCA60.1050904@2ndquadrant.com>
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
This inbox is served by agora; see mirroring instructions
for how to clone and mirror all data and code used for this inbox