SELECT
base.“column_name”,
col_description ( t1.oid, t2.attnum ),
base.udt_name,
COALESCE(character_maximum_length, numeric_precision, datetime_precision),
(CASE
WHEN ( SELECT t2.attnum = ANY ( conkey ) FROM pg_constraint WHERE conrelid = t1.oid AND contype = ‘p’ ) = ‘t’
THEN 1 ELSE 0
END )
FROM
information_schema.COLUMNS base,
pg_class t1,
pg_attribute t2
WHERE
base.“table_name” = ‘sys_org’
AND t1.relname = base.“table_name”
AND t2.attname = base.“column_name”
AND t1.oid = t2.attrelid
AND t2.attnum > 0;
以上查询的是’sys_org’表的字段信息,下面对各个属性进行解释。文章来源地址https://www.toymoban.com/news/detail-808188.html
文章来源:https://www.toymoban.com/news/detail-808188.html
到了这里,关于postgresql 查询字段 信息的文章就介绍完了。如果您还想了解更多内容,请在右上角搜索TOY模板网以前的文章或继续浏览下面的相关文章,希望大家以后多多支持TOY模板网!