从 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 ]