Source From Here
Question
When using PostgreSQL v9.1, how do I list all of the schemas using SQL?
How-To
To lists all schemas, use the (ANSI) standard INFORMATION_SCHEMA:
More details in the manual:
http://www.postgresql.org/docs/current/static/information-schema.html
alternatively:
More details about pg_catalog in the manual:
http://www.postgresql.org/docs/current/static/catalogs.html
Supplement
* PostgreSQL Doc - Schemas
* FAQ - How to select a schema in postgres when using psql?
Question
When using PostgreSQL v9.1, how do I list all of the schemas using SQL?
How-To
To lists all schemas, use the (ANSI) standard INFORMATION_SCHEMA:
- select schema_name
- from information_schema.schemata
alternatively:
- select nspname
- from pg_catalog.pg_namespace;
Supplement
* PostgreSQL Doc - Schemas
* FAQ - How to select a schema in postgres when using psql?
- # SET search_path TO myschema;
- # SET search_path TO myschema, public; // want multiple schemas:
沒有留言:
張貼留言