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 ---------------------------(end of broadcast)--------------------------- TIP 3: Have you checked our extensive FAQ? http://www.postgresql.org/docs/faq