Re: dynamic table names - Mailing list pgsql-general

From John Smith
Subject Re: dynamic table names
Date
Msg-id CAMZ8qd_0G54+4BFM4SZmCFnapGUW4ePaScCc9upPVQ+=OAYeGA@mail.gmail.com
Whole thread Raw
In response to Re: dynamic table names  (Thomas Kellerer <spam_eater@gmx.net>)
Responses Re: dynamic table names  (David Johnston <polobo@yahoo.com>)
List 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

pgsql-general by date:

Previous
From: David Kerr
Date:
Subject: Re: About postgres scale out
Next
From: David Johnston
Date:
Subject: Re: dynamic table names