Re: dynamic table names

From: John Smith <jayzee(dot)smith(at)gmail(dot)com>
To: PostgreSQL General <pgsql-general(at)postgresql(dot)org>
Cc: David Johnston <polobo(at)yahoo(dot)com>, Thomas Kellerer <spam_eater(at)gmx(dot)net>
Subject: Re: dynamic table names
Date: 2013-07-17 22:44:00
Message-ID: CAMZ8qd_0G54+4BFM4SZmCFnapGUW4ePaScCc9upPVQ+=OAYeGA@mail.gmail.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-general

david, you're right. i didn't realize it had to be executed inside a
function so now i'm trying this:

-- create function
create or replace function get_tables(sname varchar) returns record as $$
select tablename from pg_tables where schemaname = $1;
$$ language 'plpgsql';

-- query tables where column 'fname' = 'john'
select * from get_tables('myschema') where fname = 'john';

any help? wishing for a "select * from *..." :)

thanks, jzs

In response to

Responses

Browse pgsql-general by date

  From Date Subject
Next Message David Johnston 2013-07-17 22:56:02 Re: dynamic table names
Previous Message David Kerr 2013-07-17 21:45:39 Re: About postgres scale out