How to determine which tables are created from inheritance.

Started by Chris Barnesover 15 years ago2 messagesgeneral
Jump to latest
#1Chris Barnes
compuguruchrisbarnes@hotmail.com

I am using londiste and would like to add tables for partitioned tables only. I.E. exclude the parent.

I am currently using the select below.
What postgres catalog table would I query to see this information?

psql database -t -c "select schemaname||'.'||relname from pg_stat_user_tables where relname like 'tablename%'"|xargs londiste.py londiste.ini provider add

Thanks,

Chris

#2Chris Barnes
compuguruchrisbarnes@hotmail.com
In reply to: Chris Barnes (#1)
Re: How to determine which tables are created from inheritance.

I have answered my own question.

After some poking around I was able to find what I was looking for. I have posted for future reference.

select relname,relid from pg_stat_user_tables where relid in (select inhrelid from pg_inherits) and relname like 'table%' order by relname;

Thanks,

Chris

From: compuguruchrisbarnes@hotmail.com
To: pgsql-general@postgresql.org
Subject: [GENERAL] How to determine which tables are created from inheritance.
Date: Fri, 13 Aug 2010 09:16:01 -0400

I am using londiste and would like to add tables for partitioned tables only. I.E. exclude the parent.

I am currently using the select below.
What postgres catalog table would I query to see this information?

psql database -t -c "select schemaname||'.'||relname from pg_stat_user_tables where relname like 'tablename%'"|xargs londiste.py londiste.ini provider add

Thanks,

Chris