How to fetch a list of schema from the current database. The result which we get using \dn. This query fetches all schema
SELECT table_schema,table_name
FROM information_schema.tables
ORDER BY table_schema,table_name;
But I want only the schema which is defined in the current database. And then how to fetch all tables corresponding to that particular schema?
These list all schemas including system's in the current database:
\dnS
\dn *
These list all schemas including system's in the current database in detail:
\dnS+
\dn+ *
This lists all schemas excluding system's in the current database:
\dn
This lists all schemas excluding system's in the current database in detail:
\dn+
These also list all schemas including system's in the current database:
SELECT * FROM pg_namespace;
SELECT * FROM information_schema.schemata;
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With