2019年6月19日 星期三

[ 常見問題 ] How do I list all schemas in PostgreSQL?

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: 
  1. select schema_name  
  2. from information_schema.schemata  
More details in the manual: http://www.postgresql.org/docs/current/static/information-schema.html 

alternatively: 
  1. select nspname  
  2. from pg_catalog.pg_namespace;  
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? 
  1. # SET search_path TO myschema;  
  2. # SET search_path TO myschema, public;  // want multiple schemas:  


沒有留言:

張貼留言

[Git 常見問題] error: The following untracked working tree files would be overwritten by merge

  Source From  Here 方案1: // x -----删除忽略文件已经对 git 来说不识别的文件 // d -----删除未被添加到 git 的路径中的文件 // f -----强制运行 #   git clean -d -fx 方案2: 今天在服务器上  gi...