pg.ddx.io  pgsql-sql@postgresql.org mailing list archive  
help / color / mirror / Atom feed
From: solarsail <solarsail@gmail.com>
To: pgsql-sql@postgresql.org
Subject: query tables based on a query
Date: Fri, 30 Sep 2005 18:47:48 -0400
Message-ID: <aa44f4a30509301547g69dfffcayfe2e967925657822@mail.gmail.com> (raw)

I have a large number of tables with a common naming convention

basically:

table001, table002, table003 ... table00n


I would like to do a query across all of the tables, however I do not know
all of the tables before hand, and I do not want to manually generate a
query like

select * from table001, table002, table003


I have a query that returns the names of the tables I want to query, it is
basically like this:

select tablename from pg_tables where tablename like 'table%'


How do I do this? I've tried creating a Table Function that returns the
above set and tried to use that in a select clause, but I cant get it to
work either.


Thanks for the help

view thread (2+ messages)  latest in thread

Message-ID: <aa44f4a30509301547g69dfffcayfe2e967925657822@mail.gmail.com>
Permalink:  ../aa44f4a30509301547g69dfffcayfe2e967925657822@mail.gmail.com/
Also on:    postgresql.org/message-id/aa44f4a30509301547g69dfffcayfe2e967925657822@mail.gmail.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: solarsail@gmail.com
  Subject: Re: query tables based on a query
  In-Reply-To: <aa44f4a30509301547g69dfffcayfe2e967925657822@mail.gmail.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