running a query on a list of tables

From: Mark King <fires10(at)gmail(dot)com>
To: pgsql-novice(at)lists(dot)postgresql(dot)org
Subject: running a query on a list of tables
Date: 2018-10-29 03:48:41
Message-ID: CAP2CKMkzcwW-3MfSB0716DBnZUYQjMdBQhFidXNCapa7iXJ_Rg@mail.gmail.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-novice

I am trying to figure out how to run a query on a list of tables or views
in this case.
I can run :

I can run :

SELECT * FROM tablelist;

which returns a list of tables

names
----------------
mortgage
creditcard
auto
........continued

I want to run :

SELECT * FROM (SELECT * FROM tablelist);

all tables have the same columns and types.

any idea how to make this work? tablelist contains a large number of tables
that will change over time and I do not want to manually write a bunch of
unions.

any suggestions?

Thank you

Responses

Browse pgsql-novice by date

  From Date Subject
Next Message David Rowley 2018-10-29 04:29:43 Re: running a query on a list of tables
Previous Message Ozan Kahramanogullari 2018-10-24 13:39:30 Re: psql on Mac