Re: Queries w/ "computed" table names? (eval in Pg?) - Mailing list pgsql-general

From Jeff Davis
Subject Re: Queries w/ "computed" table names? (eval in Pg?)
Date
Msg-id 1203724244.7878.44.camel@dogma.ljc.laika.com
Whole thread Raw
In response to Queries w/ "computed" table names? (eval in Pg?)  ("Kynn Jones" <kynnjo@gmail.com>)
List pgsql-general
On Fri, 2008-02-22 at 18:40 -0500, Kynn Jones wrote:
> Hi.  Suppose I have a database that contains a "meta table" that holds
> the names of other the tables in the database, keyed by human-readable
> but longish strings.  I would like to write queries that first
> "compute" the names of some tables (i.e. by looking them up in "meta
> table"), and after that they execute subqueries using these computed
> table names.  The following invalid SQL illustrates the kind of

You can create a PL/pgSQL function and use "EXECUTE".

Depending on how you want to use it, you may need to make it a set-
returning function (a.k.a. table function).

Regards,
    Jeff Davis


pgsql-general by date:

Previous
From: "Kynn Jones"
Date:
Subject: Queries w/ "computed" table names? (eval in Pg?)
Next
From: Steve Atkins
Date:
Subject: Re: Queries w/ "computed" table names? (eval in Pg?)