Re: Queries w/ "computed" table names? (eval in Pg?)

From: Jeff Davis <pgsql(at)j-davis(dot)com>
To: Kynn Jones <kynnjo(at)gmail(dot)com>
Cc: pgsql-general(at)postgresql(dot)org
Subject: Re: Queries w/ "computed" table names? (eval in Pg?)
Date: 2008-02-22 23:50:44
Message-ID: 1203724244.7878.44.camel@dogma.ljc.laika.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: 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

In response to

Browse pgsql-general by date

  From Date Subject
Next Message Steve Atkins 2008-02-22 23:51:08 Re: Queries w/ "computed" table names? (eval in Pg?)
Previous Message Kynn Jones 2008-02-22 23:40:28 Queries w/ "computed" table names? (eval in Pg?)