Database Administrators Stack Exchange is a question and answer site for database professionals who wish to improve their database skills and learn from others in the community. Join them; it only takes a minute:

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

Using the psql command line tool, how do I list all postgres tables in one particular schema

share|improve this question

migrated from serverfault.com Jul 23 '11 at 2:11

This question came from our site for system and network administrators.

up vote 10 down vote accepted

\dt schemaname.* will do what you want.

share|improve this answer

In addition to the \dt match, you can also look into the database catalog:

SELECT nspname||'.'||relname AS full_rel_name
  FROM pg_class, pg_namespace
 WHERE relnamespace = pg_namespace.oid
   AND nspname = 'yourschemaname'
   AND relkind = 'r';

You can also do it with the more standard information schema, but it tends to be slower:

SELECT table_schema||'.'||table_name AS full_rel_name
  FROM information_schema.tables
 WHERE table_schema = 'yourschemaname';
share|improve this answer

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.