How to show tables in PostgreSQL is a common question for beginners. In this article we will discuss showing tables in PostgreSQL.
In PostgreSQL all information about DB objects stored under information_schema.
You can use information_schema.tables table to list and show tables. A simple query to list all tables and schemas:
select table_schema, table_name from information_schema.tables;
If you want to list all tables under a schema (testschema in this case) you can use the following query:
select table_schema, table_name from information_schema.tables where table_schema='testschema';
information_schema is a very informative schema for PostgreSQL. You can find tables, schemas, triggers, role and all kind of object definitions under information_schema.
There isn’t any shortcuts to list tables in PostgreSQL, but you can use queries above to list tables.
If you a comment, or something to add please leave comment below.



Leave a Reply