PostgreSQL - How to list all table names, excluding views?
How to list all table names, excluding views in PostgreSQL?
Using psql:
Using psql, you can simply run this command:
\dt
Using SQL query:
Using Query Editor, you can run the query below to show the table list from pg_catalog:
SELECT
tablename AS TABLE
FROM
pg_tables
WHERE
schemaname = 'public';
Or this query:
SELECT
table_name
FROM
information_schema.tables
WHERE
table_schema = 'public'
AND table_type = 'BASE TABLE';
Need a good GUI tool for PostgreSQL? Check out TablePlus. It’s native, beautiful, and available for free.
Not on Mac? Download TablePlus for Windows.
On Linux? Download TablePlus for Linux
Need a quick edit on the go? Download TablePlus for iOS