读取PostgreSQL 数据库中 Database 名称等的信息

从 oid2name的代码里扒出来的:

postgres=# SELECT d.oid AS Oid,datname AS DatabaseName,spcname AS Tablespace
postgres-#  FROM pg_catalog.pg_database d JOIN pg_catalog.pg_tablespace t 
postgres-#  ON  (dattablespace = t.oid) order by 2;
  oid  | databasename | tablespace 
-------+--------------+------------
 12788 | postgres     | pg_default
 12783 | template0    | pg_default
     1 | template1    | pg_default
(3 rows)

postgres=# 

[作者:技术者高健@博客园  mail: luckyjackgao@gmail.com ]

原文地址:https://www.cnblogs.com/gaojian/p/2741237.html