新建表
create table t11 (id int);
select pg_relation_filepath('t1');
输出到指定文件
\o /tmp/a.txt
两行pg_type表
https://www.yiibai.com/manual/postgresql/catalog-pg-type.html
SELECT pg_relation_filepath(oid), relname FROM pg_class WHERE relname = 't11';
base/13287/41022
postgres=# select * from pg_type where typrelid=41022;
-[ RECORD 1 ]--+------------
typname | t11
typnamespace | 2200
typowner | 10
typlen | -1
typbyval | f
typtype | c
typcategory | C
typispreferred | f
typisdefined | t
typdelim | ,
typrelid | 41022
typelem | 0
typarray | 41023
typinput | record_in
typoutput | record_out
typreceive | record_recv
typsend | record_send
typmodin | -
typmodout | -
typanalyze | -
typalign | d
typstorage | x
typnotnull | f
typbasetype | 0
typtypmod | -1
typndims | 0
typcollation | 0
typdefaultbin |
typdefault |
typacl |
typname | _t11
typnamespace | 2200
typowner | 10
typlen | -1
typbyval | f
typtype | b
typcategory | A
typispreferred | f
typisdefined | t
typdelim | ,
typrelid | 0
typelem | 41024
typarray | 0
typinput | array_in
typoutput | array_out
typreceive | array_recv
typsend | array_send
typmodin | -
typmodout | -
typanalyze | array_typanalyze
typalign | d
typstorage | x
typnotnull | f
typbasetype | 0
typtypmod | -1
typndims | 0
typcollation | 0
typdefaultbin |
typdefault |
typacl |
三行pg_depend表
数据库对象之间的依赖关系
41024引用41022
41023引用41024
41022引用2200
select * from pg_depend;
-[ RECORD 7559 ]---
classid | 1247
objid | 41024
objsubid | 0
refclassid | 1259
refobjid | 41022
refobjsubid | 0
deptype | i
-[ RECORD 7560 ]---
classid | 1247
objid | 41023
objsubid | 0
refclassid | 1247
refobjid | 41024
refobjsubid | 0
deptype | i
-[ RECORD 7561 ]---
classid | 1259
objid | 41022
objsubid | 0
refclassid | 2615
refobjid | 2200
refobjsubid | 0
deptype | n
1行pg_class表
-[ RECORD 14 ]------+----------------------------------------------
relname | t11
relnamespace | 2200
reltype | 41024 #这个表的行类型的数据类型的OID(索引为零,它们没有pg_type记录)
reloftype | 0
relowner | 10
relam | 0
relfilenode | 41022 #这个关系在磁盘上的文件的名字,0表示这是一个"映射的"关系, 它的文件名取决于行级别的状态
reltablespace | 0
relpages | 0
reltuples | 0
relallvisible | 0
reltoastrelid | 0
relhasindex | f
relisshared | f
relpersistence | p
relkind | r
relnatts | 1
relchecks | 0
relhasoids | f
relhasrules | f
relhastriggers | f
relhassubclass | f
relrowsecurity | f
relforcerowsecurity | f
relispopulated | t
relreplident | d
relispartition | f
relrewrite | 0
relfrozenxid | 730
relminmxid | 1
relacl |
reloptions |
relpartbound
7行pg_attribute
表的每个字段在pg_attribute表中都有一行记录
select * from pg_attribute where attrelid='41022';
【一些截图】