关于的information_schema.tables和information_schema.columns详解
blog.csdn.net/gaowei_132/…
根据字段名查询表名
SELECT a.attnum,
a.attname ,
c.relname
FROM pg_class c,
pg_attribute a
WHERE a.attnum > 1
and c.oid = a.attrelid
and a.attname='title_id'
ORDER BY a.attnum;
复制代码
根据表名查询列名
SELECT a.attnum,
a.attname
FROM pg_class c,
pg_attribute a
WHERE c.relname = 'employee_info'
-- and a.attnum > 1
and c.oid = a.attrelid
ORDER BY a.attnum;
复制代码
SELECT * FROM pg_description;
SELECT * FROM pg_class cl WHERE cl.relname='dl_car_info' ; -- oid 行标识符(隐藏属性; 必须明确选择)
SELECT dc.* FROM pg_class cl JOIN pg_description dc ON cl.oid=dc.objoid WHERE cl.relname='dl_car_info' ;
select relname as tabname,
cast(obj_description(relfilenode,'pg_class') as varchar) as comment from pg_class c
where relkind = 'r' and relname = 'dl_car_info' order by relname;
复制代码