Greenplum數據庫中系統表pg_attribute詳解


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;


免責聲明!

本站轉載的文章為個人學習借鑒使用,本站對版權不負任何法律責任。如果侵犯了您的隱私權益,請聯系本站郵箱yoyou2525@163.com刪除。



 
粵ICP備18138465號   © 2018-2025 CODEPRJ.COM