Greenplum数据库中系统表pg_attribute详解

时间:2019-12-26 18:08:57   收藏:0   阅读:367

Greenplum数据库中系统表pg_attribute详解

该系统表存储所有表(包括系统表,如pg_class)的字段信息。数据库中的每个表的每个字段在pg_attribute表中都有一行记录。

技术分享图片

 

 技术分享图片

 

 举例:

1,查看指定表中包含的字段名和字段编号。

SELECT relname, attname,attnum FROM pg_class c,pg_attribute attr WHERE relname  = tablename AND c.oid = attr.attrelid;

2,只查看用户自定义字段的类型.

SELECT relname,attname,typname FROM pg_class c,pg_attribute a,pg_type t WHERE c.relname = testtable AND c.oid = attrelid AND atttypid = t.oid AND attnum > 0;

原文:https://www.cnblogs.com/lizm166/p/12102389.html

评论(0
© 2014 bubuko.com 版权所有 - 联系我们:wmxa8@hotmail.com
打开技术之扣,分享程序人生!