• 周四. 8月 11th, 2022

5G编程聚合网

5G时代下一个聚合的编程学习网

热门标签

study PostgreSQL【3-get数据库中all表以及表的字段信息】

admin

11月 28, 2021

get一表的字段相关信息:

SELECT  col_description(a.attrelid,a.attnum) as comment,pg_type.typname as typename,a.attname as name, a.attnotnull as notnull
FROM pg_class as c,pg_attribute as a inner join pg_type on pg_type.oid = a.atttypid
where c.relname = '表名' and a.attrelid = c.oid and a.attnum>0-----------------------------
SELECT * 
FROM pg_class as c,pg_attribute as a inner join pg_type on pg_type.oid = a.atttypid
where c.relname = '表名' and a.attrelid = c.oid and a.attnum>0

get表名:

select * from  pg_tables where schemaname='public'

发表评论

您的电子邮箱地址不会被公开。