Unlike MySQL, Apache Hive, and Apache Impala, we can’t acquire a list of tables in PostgreSQL using the SHOW TABLES command.
Use the below command instead. This will avoid system tables as well.
SELECT * FROM pg_catalog.pg_tables
WHERE schemaname != ‘pg_catalog’
AND schemaname != ‘information_schema’;
Or you can use the below if
SELECT table_schema || ‘.’ || table_name
FROM information_schema.tables
WHERE table_type = ‘BASE TABLE’
AND table_schema NOT IN (‘pg_catalog’, ‘information_schema’);
Hope you find this article helpful.
Please subscribe for more interesting updates.