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


\dt schemaname.* will do what you want.

| 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';
| improve this answer | |

you can run

SELECT * FROM pg_catalog.pg_tables where schemaname="yourschemaname";
| improve this answer | |

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy