Loading...
Loading...
Loading...
Loading...
Loading...
Loading...
Loading...
Loading...
Loading...
Loading...
Loading...
Loading...
Loading...
Loading...
Loading...
Loading...
Loading...
Loading...
Loading...
Loading...
Loading...
Loading...
Loading...
Loading...
Loading...
目錄 pg_authid 包含有關資料庫認證識別(角色)的資訊。角色包含「使用者」和「群組」的概念。使用者基本上只是設置了 rolcanlogin 識別的角色。任何角色(無論有或沒有 rolcanlogin)都可以擁有其他角色作為成員;詳見 pg_auth_members。
由於此目錄包含密碼,因此不得公開讀取。 pg_roles 是 pg_authid 上的一個公開可讀的檢視表,它隱藏了密碼字串。
第 21 章包含有關使用者和權限管理的詳細訊息。
由於使用者身份是叢集範圍的,因此 pg_authid 在叢集的所有資料庫之間共享:每個叢集只有一個 pg_authid 副本,而不是每個資料庫一個副本。
Table 51.8. pg_authid
Columns
對於 MD5 加密密碼,rolpassword 欄位將以字串 md5 開頭,之後跟 32 個字元的十六進位 MD5 hash。MD5 hash 將是使用者的密碼連接到他們的使用者名稱。例如,如果使用者 joe 的密碼為 xyzzy,則 PostgreSQL 將儲存 xyzzyjoe 的 md5 hash 值。
如果使用 SCRAM-SHA-256 加密密碼,則其格式為:
其中 salt,StoredKey 和 ServerKey 採用 Base64 編碼格式。此格式與 RFC 5803 指定的格式相同。
未遵循這些格式之一的密碼就會被認為是未加密的。
Name
Type
Description
oid
oid
資料列指標(隱藏屬性;必須明確選擇)
rolname
name
角色名稱
rolsuper
bool
角色具有超級使用者權限
rolinherit
bool
角色自動繼承其所屬角色的權限
rolcreaterole
bool
角色可以創造更多角色
rolcreatedb
bool
角色可以建立資料庫
rolcanlogin
bool
角色可以登入。也就是說,此角色可以作為初始連線認證識別
rolreplication
bool
角色是複寫角色。複寫角色可以啟動複寫連線並建立和移除複寫槽。
rolbypassrls
bool
角色繞過每個資料列級別的安全原則,有關詳細訊息,請參閱第 5.7 節。
rolconnlimit
int4
對於可以登入的角色,這將設定此角色可以進行的最大同時連線數。-1 表示沒有限制。
rolpassword
text
密碼(可能是加密的); 如果沒有則為 null。格式取決於使用的加密形式。
rolvaliduntil
timestamptz
密碼到期時間(僅用於密碼驗證);如果沒有過期,則回傳 null
系統目錄(system catalog)是記錄資料庫管理系統儲存結構原始資料的地方,例如關於資料表和欄位的訊息以及內部日誌記錄訊息。PostgreSQL 的系統目錄是一般的資料表。您可以刪除並重新建立資料表、增加欄位、插入和更新內容,並以這種方式嚴重混淆您的系統。當然,通常情況下,不應該手動更改系統目錄,通常有 SQL 命令來執行此操作。(例如,CREATE DATABASE 向 pg_database 系統目錄插入一行 - 實際上是在磁碟上建立數據庫)。對於特別深奧的操作有一些例外,但其中很多已經隨著時間的推移而變為 SQL 命令,因此需要系統目錄的直接操作正在不斷減少。
The catalog pg_constraint
stores check, primary key, unique, foreign key, and exclusion constraints on tables. (Column constraints are not treated specially. Every column constraint is equivalent to some table constraint.) Not-null constraints are represented in the pg_attribute
catalog, not here.
User-defined constraint triggers (created with CREATE CONSTRAINT TRIGGER
) also give rise to an entry in this table.
Check constraints on domains are stored here, too.
Table 51.13. pg_constraint
Columns
In the case of an exclusion constraint, conkey
is only useful for constraint elements that are simple column references. For other cases, a zero appears in conkey
and the associated index must be consulted to discover the expression that is constrained. (conkey
thus has the same contents as pg_index
.indkey
for the index.)
consrc
is not updated when referenced objects change; for example, it won't track renaming of columns. Rather than relying on this field, it's best to use pg_get_constraintdef()
to extract the definition of a check constraint.
pg_class.relchecks
needs to agree with the number of check-constraint entries found in this table for each relation.
Name
Type
References
Description
oid
oid
Row identifier (hidden attribute; must be explicitly selected)
conname
name
Constraint name (not necessarily unique!)
connamespace
oid
pg_namespace
.oid
The OID of the namespace that contains this constraint
contype
char
c
= check constraint, f
= foreign key constraint, p
= primary key constraint, u
= unique constraint, t
= constraint trigger, x
= exclusion constraint
condeferrable
bool
Is the constraint deferrable?
condeferred
bool
Is the constraint deferred by default?
convalidated
bool
Has the constraint been validated? Currently, can only be false for foreign keys and CHECK constraints
conrelid
oid
pg_class
.oid
The table this constraint is on; 0 if not a table constraint
contypid
oid
pg_type
.oid
The domain this constraint is on; 0 if not a domain constraint
conindid
oid
pg_class
.oid
The index supporting this constraint, if it's a unique, primary key, foreign key, or exclusion constraint; else 0
confrelid
oid
pg_class
.oid
If a foreign key, the referenced table; else 0
confupdtype
char
Foreign key update action code: a
= no action, r
= restrict, c
= cascade, n
= set null, d
= set default
confdeltype
char
Foreign key deletion action code: a
= no action, r
= restrict, c
= cascade, n
= set null, d
= set default
confmatchtype
char
Foreign key match type: f
= full, p
= partial, s
= simple
conislocal
bool
This constraint is defined locally for the relation. Note that a constraint can be locally defined and inherited simultaneously.
coninhcount
int4
The number of direct inheritance ancestors this constraint has. A constraint with a nonzero number of ancestors cannot be dropped nor renamed.
connoinherit
bool
This constraint is defined locally for the relation. It is a non-inheritable constraint.
conkey
int2[]
pg_attribute
.attnum
If a table constraint (including foreign keys, but not constraint triggers), list of the constrained columns
confkey
int2[]
pg_attribute
.attnum
If a foreign key, list of the referenced columns
conpfeqop
oid[]
pg_operator
.oid
If a foreign key, list of the equality operators for PK = FK comparisons
conppeqop
oid[]
pg_operator
.oid
If a foreign key, list of the equality operators for PK = PK comparisons
conffeqop
oid[]
pg_operator
.oid
If a foreign key, list of the equality operators for FK = FK comparisons
conexclop
oid[]
pg_operator
.oid
If an exclusion constraint, list of the per-column exclusion operators
conbin
pg_node_tree
If a check constraint, an internal representation of the expression
consrc
text
If a check constraint, a human-readable representation of the expression
The catalog pg_am
stores information about relation access methods. There is one row for each access method supported by the system. Currently, only indexes have access methods. The requirements for index access methods are discussed in detail in .
Table 51.3. pg_am
Columns
Before PostgreSQL 9.6, pg_am
contained many additional columns representing properties of index access methods. That data is now only directly visible at the C code level. However,pg_index_column_has_property()
and related functions have been added to allow SQL queries to inspect index access method properties; see .
The catalog pg_attribute
stores information about table columns. There will be exactly one pg_attribute
row for every column in every table in the database. (There will also be attribute entries for indexes, and indeed all objects that have pg_class
entries.)
The term attribute is equivalent to column and is used for historical reasons.
Table 51.7. pg_attribute
Columns
In a dropped column's pg_attribute
entry, atttypid
is reset to zero, but attlen
and the other fields copied from pg_type
are still valid. This arrangement is needed to cope with the situation where the dropped column's data type was later dropped, and so there is no pg_type
row anymore. attlen
and the other fields can be used to interpret the contents of a row of the table.
版本:11
目錄 pg_class 對資料表和大多數具有欄位或其他類似於資料表的內容進行彙整。 包括索引(但也參閱 pg_index)、序列(但請參閱 pg_sequence)、檢視表、具體化檢視表、複合型別和 TOAST 資料表;另請查看 relkind 欄位。以下,當我們指的是所有這些類型的物件時,我們都會說「關連(relation)」。 並非所有欄位對所有關連類型都有意義。
pg_class
Columnspg_class 中的幾個布林欄位的維護是鬆散的:如果這是正確的狀態,那它們保證為 true,但是當條件不再為真時,可能不會立即重置為 false。例如,relhasindex 由CREATE INDEX 設定,但它永遠不會被 DROP INDEX 清除。相反地,如果 VACUUM 發現資料表沒有索引,則清除 relhasindex。這種安排避免了競爭條件並改善了一致性。
目錄 pg_auth_members 顯示角色之間的成員資格關連。允許任何非循環的關連。
由於角色身份是叢集範圍的,因此 pg_auth_members 在叢集的所有資料庫之間共享:每個叢集只有一個 pg_auth_members 副本,而不是每個資料庫一個副本。
Table 51.9. pg_auth_members
Columns
The catalog pg_collation
describes the available collations, which are essentially mappings from an SQL name to operating system locale categories. See for more information.
Table 51.12. pg_collation
Columns
Note that the unique key on this catalog is (collname
, collencoding
, collnamespace
) not just (collname
, collnamespace
). PostgreSQL generally ignores all collations that do not have collencoding
equal to either the current database's encoding or -1, and creation of new entries with the same name as an entry with collencoding
= -1 is forbidden. Therefore it is sufficient to use a qualified SQL name (schema
.name
) to identify a collation, even though this is not unique according to the catalog definition. The reason for defining the catalog this way is that initdb fills it in at cluster initialization time with entries for all locales available on the system, so it must be able to hold entries for all encodings that might ever be used in the cluster.
In the template0
database, it could be useful to create collations whose encoding does not match the database encoding, since they could match the encodings of databases later cloned from template0
. This would currently have to be done manually.
Name | Type | References | Description |
|
| The table this column belongs to |
|
|
| The column name |
|
| The data type of this column |
|
|
|
|
|
| A copy of |
|
|
| The number of the column. Ordinary columns are numbered from 1 up. System columns, such as |
|
|
| Number of dimensions, if the column is an array type; otherwise 0. (Presently, the number of dimensions of an array is not enforced, so any nonzero value effectively means “it's an array”.) |
|
|
| Always -1 in storage, but when loaded into a row descriptor in memory this might be updated to cache the offset of the attribute within the row |
|
|
|
|
|
|
| A copy of |
|
|
| Normally a copy of |
|
|
| A copy of |
|
|
| This represents a not-null constraint. |
|
|
| This column has a default value, in which case there will be a corresponding entry in the |
|
|
| If a zero byte ( |
|
|
| This column has been dropped and is no longer valid. A dropped column is still physically present in the table, but is ignored by the parser and so cannot be accessed via SQL. |
|
|
| This column is defined locally in the relation. Note that a column can be locally defined and inherited simultaneously. |
|
|
| The number of direct ancestors this column has. A column with a nonzero number of ancestors cannot be dropped nor renamed. |
|
| The defined collation of the column, or zero if the column is not of a collatable data type. |
|
|
| Column-level access privileges, if any have been granted specifically on this column |
|
|
| Attribute-level options, as “keyword=value” strings |
|
|
| Attribute-level foreign data wrapper options, as “keyword=value” strings |
欄位 | 型別 | 參考 | 說明 |
|
|
| 資料列指標(隱藏屬性;必須明確選擇) |
|
|
| 資料表的名稱,索引,檢視表等 |
|
| 包含此關連命名空間的 OID |
|
| 與此資料表的資料列類型對應資料型別的OID(如果有)(索引為零,因為沒有 pg_type 項目) |
|
| 對於複合型別資料表,底層複合型別的 OID,對於所有其他關連的值為零 |
|
| 關連的所有者 |
|
| 如果這是索引,則為使用存取的方法(B-tree,hash 等) |
|
|
| 此關連的磁碟檔案的名稱;零表示這是一個「映射」關連,其磁碟檔案名稱由底層狀態決定 |
|
| 儲存此關連的資料表空間。如果為零,則隱含資料庫的預設資料表空間。(如果關連沒有磁碟檔案,則沒有意義。) |
|
|
| 頁面(大小為 BLCKSZ)的磁碟表示形式的大小。這只是計劃程序使用的估算值。它由 VACUUM,ANALYZE 和一些 DDL 指令(如 CREATE INDEX)更新。 |
|
|
| 資料表中的資料列數。這只是計劃程序使用的估算值。它由VACUUM,ANALYZE 和一些 DDL 指令(如 CREATE INDEX)更新。 |
|
|
| 在資料表的可見性映射中標記為全部可見的頁面數。這只是計劃程序使用的估算值。它由 VACUUM,ANALYZE 和一些 DDL 指令(如 CREATE INDEX)更新。 |
|
| 與此資料表關連的 TOAST 資料表的OID,如果沒有,則為0。TOAST 資料表在輔助資料表中儲存“out of line”的大型屬性。 |
|
|
| 如果這是一個資料表並且它有(或最近有)任何索引,則為 True |
|
|
| 如果此資料表在叢集中的所有資料庫之間共享,則為 True。只有某些系統目錄共享(例如 pg_database)。 |
|
|
| p = 永久資料表,u = 無日誌資料,t = 臨時資料表 |
|
|
| r = 普通資料表,i = 索引,S = 序列,t = TOAST 資料表,v = 檢視表,m = 具體化檢視表,c = 複合型別,f = 外部資料表,p = 分割資料表 |
|
|
| 關連中的用戶欄位數(系統欄位未計算)。pg_attribute 中必須有這麼多對應的項目。另請參閱 pg_attribute.attnum。 |
|
|
|
|
|
| 如果我們為關連的每一個資料列産生一個 OID,則為 True |
|
|
| 如果資料表具有(或曾經有)主鍵,則為 True |
|
|
|
|
|
|
|
|
| 如果資料表具有(或曾經有)任何繼承子項,則為 True |
|
|
|
|
|
|
|
|
| 如果關連充入了資料,則為 True(除了某些具體化檢視表之外的所有關連都是 True) |
|
|
| 用於為資料列形成“replica identity”的欄位:d = 預設(主鍵,如果有),n = 無,f = 所有列,i = 具有 indisreplident 設定的索引,或預設值 |
|
|
| True if table is a partition |
|
|
| 此資料表之前的所有事務 ID 都已替換為此資料表中的永久(“frozen”)事務 ID。這用於追踪資料表是否需要被清理以防止事務 ID 重覆或讓 pg_xact 縮小。如果關連不是資料表,則為零(InvalidTransactionId)。 |
|
|
| 此資料表之前的所有 multixact ID 都已被此資料表中的事務 ID 替換。這用於追踪表是否需要被清理以防止多重 ID 重覆或使 pg_multixact 縮小。如果關連不是資料表,則為零(InvalidMultiXactId)。 |
|
|
|
|
|
| 存取方法的特定選項,為「keyword = value」字串 |
|
|
| 如果資料表是一個分割區(請參閱 relispartition),則綁定分割區的內部表示 |
Name | Type | References | Description |
|
|
| Row identifier (hidden attribute; must be explicitly selected) |
|
|
| Name of the access method |
|
| .oid | OID of a handler function that is responsible for supplying information about the access method |
|
|
| Currently always |
Name | Type | References | Description |
|
|
| 具有成員的角色 ID |
|
| .oid | 作為 roleid 成員的角色 ID |
|
|
| 授予此成員資格的角色 ID |
|
|
| 如果成員可以將 roleid 的成員資格授予其他人,則為 True |
Name | Type | References | Description |
|
|
| Row identifier (hidden attribute; must be explicitly selected) |
|
|
| Collation name (unique per namespace and encoding) |
|
| .oid | The OID of the namespace that contains this collation |
|
| .oid | Owner of the collation |
|
|
| Provider of the collation: |
|
|
| Encoding in which the collation is applicable, or -1 if it works for any encoding |
|
|
|
|
|
|
|
|
|
|
| Provider-specific version of the collation. This is recorded when the collation is created and then checked when it is used, to detect changes in the collation definition that could lead to data corruption. |
版本:11
目錄 pg_language 註冊了可以撰寫函數或 stored procedure 的語言。有關語言處理程序的更多訊息,請參閱 CREATE LANGUAGE 和第 41 章。
pg_language
ColumnsThe catalog pg_statistic
stores statistical data about the contents of the database. Entries are created by and subsequently used by the query planner. Note that all the statistical data is inherently approximate, even assuming that it is up-to-date.
Normally there is one entry, with stainherit
= false
, for each table column that has been analyzed. If the table has inheritance children, a second entry with stainherit
= true
is also created. This row represents the column's statistics over the inheritance tree, i.e., statistics for the data you'd see with SELECT
column
FROM table
*, whereas the stainherit
= false
row represents the results of SELECT
column
FROM ONLY table
.
pg_statistic
also stores statistical data about the values of index expressions. These are described as if they were actual data columns; in particular, starelid
references the index. No entry is made for an ordinary non-expression index column, however, since it would be redundant with the entry for the underlying table column. Currently, entries for index expressions always have stainherit
= false
.
Since different kinds of statistics might be appropriate for different kinds of data, pg_statistic
is designed not to assume very much about what sort of statistics it stores. Only extremely general statistics (such as nullness) are given dedicated columns in pg_statistic
. Everything else is stored in “slots”, which are groups of associated columns whose content is identified by a code number in one of the slot's columns. For more information see src/include/catalog/pg_statistic.h
.
pg_statistic
should not be readable by the public, since even statistical information about a table's contents might be considered sensitive. (Example: minimum and maximum values of a salary column might be quite interesting.) is a publicly readable view on pg_statistic
that only exposes information about those tables that are readable by the current user.
Table 51.50. pg_statistic
Columns
The catalog pg_opclass
defines index access method operator classes. Each operator class defines semantics for index columns of a particular data type and a particular index access method. An operator class essentially specifies that a particular operator family is applicable to a particular indexable column data type. The set of operators from the family that are actually usable with the indexed column are whichever ones accept the column's data type as their left-hand input.
Operator classes are described at length in .
Table 51.33. pg_opclass
Columns
An operator class's opcmethod
must match the opfmethod
of its containing operator family. Also, there must be no more than one pg_opclass
row having opcdefault
true for any given combination of opcmethod
and opcintype
.
系統目錄 pg_tablespace 儲存有關可用資料表空間的訊息。可以將資料表放置在特定的資料表空間中以幫助管理磁碟規畫。
與大多數系統目錄不同,pg_tablespace 在叢集的所有資料庫之間共享:每個叢集只有一個 pg_tablespace 副本,而不是每個資料庫一個副本。
Table 51.54. pg_tablespace
欄位
The catalog pg_policy
stores row level security policies for tables. A policy includes the kind of command that it applies to (possibly all commands), the roles that it applies to, the expression to be added as a security-barrier qualification to queries that include the table, and the expression to be added as a WITH CHECK
option for queries that attempt to add new records to the table.
Table 51.38. pg_policy
Columns
Policies stored in pg_policy
are applied only when pg_class
.relrowsecurity
is set for their table.
目錄 pg_index 包含有關索引的部分信息。其餘的大多數是在 pg_class 中。
Table 51.26. pg_index
Columns
.oid
.oid
attstattarget
controls the level of detail of statistics accumulated for this column by . A zero value indicates that no statistics should be collected. A negative value says to use the system default statistics target. The exact meaning of positive values is data type-dependent. For scalar data types, attstattarget
is both the target number of “most common values” to collect, and the target number of histogram bins to create.
.oid
.oid
.oid
.oid
.oid
.oid
.oid
.oid
資料表上的 CHECK 限制條件數目;請參閱 目錄
如果資料表有(或曾經有)rule,則為 true;請參閱 目錄
如果資料表具有(或曾經有)觸發器,則為 True;請參閱 目錄
如果資料表啟用了資料列級安全性,則為 True;請參閱 目錄
如果資料列級別安全性(啟用時)也適用於資料表擁有者,則為 True;請參閱 目錄
存取權限;有關詳細信息,請參閱 和
Name
Type
References
Description
oid
oid
資料列識別指標(隱藏屬性;必須明確選擇)
lanname
name
語言名稱
lanowner
oid
pg_authid
.oid
語言的所有者
lanispl
bool
對於內部語言(例如 SQL)而言這是 false 的,對於使用者定義的語言則是 true。目前,pg_dump 仍然使用它來決定需要轉存哪些語言,但將來可能會被不同的機制所取代。
lanpltrusted
bool
如果這是一種受信任的語言,則為 True,這意味著它被認為不會授予對正常 SQL 執行環境之外任何內容的存取權限。只有超級使用者才能以不受信任的語言建立函數。
lanplcallfoid
oid
pg_proc
.oid
對於非內部語言,這引用了語言處理程序,它是一個特殊的函數,負責執行使用特定語言所編寫的所有函數。
laninline
oid
pg_proc
.oid
這引用了一個負責執行 “inline” 匿名程式區塊(DO 區塊)的函數。如果不支援 inline 區塊,則為零。
lanvalidator
oid
pg_proc
.oid
這引用了一個語言驗證器函數,該函數負責在建立新函數時檢查它們的語法和有效性。如果未提供驗證器,則為零。
lanacl
aclitem[]
Name | Type | References | Description |
|
| 此索引在 pg_class 中的 OID |
|
| 此索引對應資料表在 pg_class 中的 OID |
|
|
| 索引中的欄位數(複製自 pg_class.relnatts) |
|
|
| 如果為 true,則這是唯一性索引 |
|
|
| 如果為 true,則此索引表示資料表的主鍵(如果為 true,則 indisunique 應始終為true) |
|
|
| 如果為 true,則此索引支援排除限制條件 |
|
|
| 如果為 true,則在插入時立即強制執行唯一性檢查(如果 indisunique 不成立則無關緊要) |
|
|
| If true, the table was last clustered on this index |
|
|
| 如果為 true,則索引目前對查詢有效。False 意味著索引可能不完整:它仍然必須通過 INSERT / UPDATE 操作進行修改,但它不能安全地用於查詢。 如果它是唯一的,則唯一性屬性也不保證是真的。 |
|
|
| 如果為 true,則查詢必須不使用索引,直到此 pg_index 資料列的 xmin 低於其 TransactionXmin 事務範圍,因為可以看到該資料表可能包含具有不相容資料列的損壞 HOT 鏈 |
|
|
| 如果為 true,則索引目前已準備好進行插入。False 表示 INSERT / UPDATE 操作必須忽略索引。 |
|
|
| 如果為 false,則索引正在被移除,並且應該被忽略用於所有目的(包括 HOT-safety 決策) |
|
|
| If true this index 已使用 ALTER TABLE ... REPLICA IDENTITY 選擇“replica identity”... |
|
| 這是一個 indnatts 陣列,意指此索引所索引的資料表欄位。例如,值為 1 3 意味著第一個和第三個資料表欄位構成索引鍵。此陣列中的零表示相應的索引屬性是資料表欄位上的表示式,而不是簡單的欄位引用。 |
|
| 對於索引鍵中的每一個欄位,它包含用於索引的排序規則的 OID,如果該欄位不是可合併的資料型別,則為零。 |
|
|
|
|
| 這是一個 indnatts 陣列,用於儲存每個欄位的旗標位元。位元的意義由索引的存取方法定義。 |
|
|
| 表示式樹(以 nodeToString() 表示),用於不是簡單欄位引用的索引屬性。這是一個列表,其中包含 indkey 中每個零項目的一個元素。如果所有索引屬性都是簡單引用,則為空。 |
|
|
| 部分索引條件的表示式樹(以 nodeToString() 表示)。如果不是部分索引,則為空。 |
欄位 | 型別 | 參考 | 說明 |
|
|
| 資料列指標(隱藏屬性;必須明確選擇) |
|
|
| 命名空間的名稱 |
|
| .oid | 命名空間的所有者 |
|
|
| 存取權限;有關詳細信息,請參閱 和 |
Name | Type | References | Description |
|
| .oid | The table or index that the described column belongs to |
|
| .attnum | The number of the described column |
|
|
| If true, the stats include inheritance child columns, not just the values in the specified relation |
|
|
| The fraction of the column's entries that are null |
|
|
| The average stored width, in bytes, of nonnull entries |
|
|
| The number of distinct nonnull data values in the column. A value greater than zero is the actual number of distinct values. A value less than zero is the negative of a multiplier for the number of rows in the table; for example, a column in which about 80% of the values are nonnull and each nonnull value appears about twice on average could be represented by |
|
|
| A code number indicating the kind of statistics stored in the |
|
| .oid | An operator used to derive the statistics stored in the |
|
|
| Numerical statistics of the appropriate kind for the |
|
|
| Column data values of the appropriate kind for the |
Name | Type | References | Description |
|
|
| Row identifier (hidden attribute; must be explicitly selected) |
|
| .oid | Index access method operator class is for |
|
|
| Name of this operator class |
|
| .oid | Namespace of this operator class |
|
| .oid | Owner of the operator class |
|
| .oid | Operator family containing the operator class |
|
| .oid | Data type that the operator class indexes |
|
|
| True if this operator class is the default for |
|
| .oid | Type of data stored in index, or zero if same as |
名稱 | 型別 | 參考 | 說明 |
|
|
| 資料列識別指標(隱藏屬性;必須明確選擇) |
|
|
| 資料表空間名稱 |
|
| .oid | 資料表空間的所有者,通常是建立它的使用者 |
|
|
| 存取權限;詳情請參閱 和 |
|
|
| 資料表空間的選項,為“keyword = value”字串 |
Name | Type | References | Description |
|
|
| The name of the policy |
|
| .oid | The table to which the policy applies |
|
|
| The command type to which the policy is applied: |
|
|
| Is the policy permissive or restrictive? |
|
| .oid | The roles to which the policy is applied |
|
|
| The expression tree to be added to the security barrier qualifications for queries that use the table |
|
|
| The expression tree to be added to the WITH CHECK qualifications for queries that attempt to add rows to the table |
pg_roles 這個 view 提供對資料庫角色的資訊。 這只是 pg_authid 的一個公共可讀的 view,它將密碼部份予以屏蔽。
此 view 列出底層的 OID 欄位,因此可能需要執行與其他目錄的交叉查詢。
Table 51.82. pg_roles
欄位
檢視表 pg_settings 提供對伺服器的執行時參數的存取。它本質上是 SHOW 和 SET 指令的替代介面。它也提供 SHOW 無法直接獲得的一些資訊存取,例如最小值和最大值。
pg_settings
Columns設定內容有幾種可能的值,是為了降低變更組態的複雜度,它們是:
internal
這些設定無法直接更改;它們反映了內部所決定的值,其中一些可以透過使用不同的組態選項重建伺服器,或透過更改提供給 initdb 的選項來調整。
postmaster
這些設定只能在伺服器啟動時套用,因此任何變更都需要重新啟動伺服器。這些設定的值通常儲存在 postgresql.conf 檔案中,或在啟動伺服器時在命令列中給予。當然,也可以在伺服器啟動時設定任何層級較低的設定。
sighup
可以在 postgresql.conf 中對這些設定進行變更,而毌須重新啟動伺服器。只要向 postmaster 發送一個 SIGHUP 信號,使其重新讀取 postgresql.conf 並套用變更。postmaster 還會將 SIGHUP 信號轉發給其子程序,以便它們都獲取新值。
superuser-backend
可以在 postgresql.conf 中對這些設定進行變更,而毌須重新啟動伺服器。它們也可以在連線要求的封包中設定為特別連線(例如,透過 libpq 的 PGOPTIONS 環境變數),但前提是連線使用者是超級使用者。但是,這些設定在啟動後的連線中永遠不會變更。如果你在 postgresql.conf 中更改它們,請向 postmaster 發送一個 SIGHUP 信號,使其重新讀取 postgresql.conf。新值只會影響隨後啟動的連線。
backend
可以在 postgresql.conf 中對這些設定進行變更,而毌須重新啟動伺服器。它們也可以在連線請求封包中設定為特別連線(例如,透過 libpq 的 PGOPTIONS 環境變數);任何使用者都可以為他們的連線進行這樣的變更。但是,這些設定在啟動後的連線中永遠無法變更。如果你在 postgresql.conf 中更改它們,請向 postmaster 發送一個 SIGHUP 信號,使其重新讀取 postgresql.conf。新值只會影響隨後啟動的連線。
superuser
這些設定可以從 postgresql.conf 設定,也可以透過 SET 指令在連線中設定;但只有超級使用者可以透過 SET 來更改。僅當沒有使用 SET 建立連線專用的值時,postgresql.conf 中的變更才會影響現有連線。
user
這些設定可以從 postgresql.conf 設定,也可以透過 SET 指令在連線中設定。允許任何使用者變更其連線中所使用的值。僅當未使用 SET 未建立連線專用值時,postgresql.conf 中的變更才會影響現有連線。
有關變更這些參數的各種方法和更多資訊,請參閱第 19.1 節。
pg_settings 檢視表無法INSERT 或 DELETE,但可以 UPDATE。套用於一行 pg_settings 的 UPDATE 相當於對該參數執行 SET 指令。此變更僅影響目前連線所使用的值。如果在稍後中止的交易事務中發出 UPDATE,則在回溯事務時 UPDATE 指令的效果會消失。一旦提交了相關的事務,則效果將持續到連線結束,除非被另一個 UPDATE 或 SET 覆蓋。
The catalog pg_trigger
stores triggers on tables and views. See CREATE TRIGGER for more information.
Table 51.56. pg_trigger
Columns
Currently, column-specific triggering is supported only for UPDATE
events, and so tgattr
is relevant only for that event type. tgtype
might contain bits for other event types as well, but those are presumed to be table-wide regardless of what is in tgattr
.
When tgconstraint
is nonzero, tgconstrrelid
, tgconstrindid
, tgdeferrable
, and tginitdeferred
are largely redundant with the referenced pg_constraint
entry. However, it is possible for a non-deferrable trigger to be associated with a deferrable constraint: foreign key constraints can have some deferrable and some non-deferrable triggers.
pg_class.relhastriggers
must be true if a relation has any triggers in this catalog.
版本:11
目錄 pg_statistic_ext 包含了延伸的計劃程序統計資訊。此目錄中的每一個資料列相對應於使用 CREATE STATISTICS 所建立的統計資訊物件。
pg_statistic_ext
Columnsstxkind 欄位會在建立統計物件時填入,指示需要哪種統計類型。在它之後的欄位最初為 NULL,僅在 ANALYZE 計算出相對應的統計量時才填入內容。
版本:11
The catalog pg_proc
stores information about functions, procedures, aggregate functions, and window functions (collectively also known as routines). See CREATE FUNCTION, CREATE PROCEDURE, and Section 38.3 for more information.
If prokind
indicates that the entry is for an aggregate function, there should be a matching row in pg_aggregate
.
Table 52.39. pg_proc
Columns
For compiled functions, both built-in and dynamically loaded, prosrc
contains the function's C-language name (link symbol). For all other currently-known language types, prosrc
contains the function's source text. probin
is unused except for dynamically-loaded C functions, for which it gives the name of the shared library file containing the function.
The catalog pg_type
stores information about data types. Base types and enum types (scalar types) are created with , and domains with . A composite type is automatically created for each table in the database, to represent the row structure of the table. It is also possible to create composite types with CREATE TYPE AS
.
Table 51.62. pg_type
Columns
Table 51.63. typcategory
Codes
The view pg_stats
provides access to the information stored in the catalog. This view allows access only to rows of pg_statistic
that correspond to tables the user has permission to read, and therefore it is safe to allow public read access to this view.
pg_stats
is also designed to present the information in a more readable format than the underlying catalog — at the cost that its schema must be extended whenever new slot types are defined for pg_statistic
.
Table 51.88. pg_stats
Columns
The maximum number of entries in the array fields can be controlled on a column-by-column basis using the ALTER TABLE SET STATISTICS
command, or globally by setting the run-time parameter.
.oid
.oid
.attnum
.oid
.oid
對於索引鍵中的每一欄位,它包含要使用的運算子類的 OID。有關詳細訊息,請參閱 。
lists the system-defined values of typcategory
. Any future additions to this list will also be upper-case ASCII letters. All other ASCII characters are reserved for user-defined categories.
Name
Type
References
Description
rolname
name
角色名稱
rolsuper
bool
角色具有超級使用者權限
rolinherit
bool
角色自動繼承它所屬角色的權限
rolcreaterole
bool
角色可以建立更多角色
rolcreatedb
bool
角色可以建立資料庫
rolcanlogin
bool
角色可以登入。也就是說,可以將此角色作為初始連線認證使用
rolreplication
bool
角色是可以進行資料複寫的角色。複寫角色表示可以啟動資料複寫連線並建立和刪除複寫對象。
rolconnlimit
int4
對於可以登入的角色,這個設定此角色可以建立的最大同時連線數。 -1 意味著沒有限制。
rolpassword
text
不是密碼(讀出來都是********)
rolvaliduntil
timestamptz
密碼到期時間(僅用於密碼驗證); 如果沒有到期時間,則顯示 null
rolbypassrls
bool
角色繞過每一個資料列層級的安全原則,參閱第 5.7 節了解更多訊息。
rolconfig
text[]
執行環境時用於角色的組態預設值
oid
oid
pg_authid
.oid
角色的 ID
名稱
型別
說明
name
text
執行階段的組態參數名稱
setting
text
參數的現值
unit
text
參數隱含的單位
category
text
參數的邏輯分類
short_desc
text
參數的簡要說明
extra_desc
text
附加的,更詳細的參數說明
context
text
組態參數值的必要內容(詳見下文)
vartype
text
參數型別(bool、enum、integer、real 或 string)
source
text
目前參數值的來源
min_val
text
參數的最小允許值(非數字型別為 null)
max_val
text
參數的最大允許值(非數字型別為 null)
enumvals
text[]
列舉參數的允許值(非列舉型別為 null)
boot_val
text
如果未另行設定參數,則在伺服器啟動時預先給予參數值
reset_val
text
RESET 將參數重置為目前連線中的值
sourcefile
text
組態檔案目前設定為何(對於從組態檔案以外來源設定的值,或者由非超級使用者也不是 pg_read_all_settings 的成員所給予,為null);在組態檔案中使用 include 指令時會很有幫助
sourceline
integer
組態檔案中目前設定所在的行號(對於從組態檔案以外來源所設定的值,或者由非超級使用者,也不是 pg_read_all_settings 成員所給予的值,則為 null)。
pending_restart
boolean
如果組態檔案中的值已更改但需要重新啟動,則為 true;否則為 false。
Name
Type
References
Description
oid
oid
Row identifier (hidden attribute; must be explicitly selected)
tgrelid
oid
pg_class
.oid
The table this trigger is on
tgname
name
Trigger name (must be unique among triggers of same table)
tgfoid
oid
pg_proc
.oid
The function to be called
tgtype
int2
Bit mask identifying trigger firing conditions
tgenabled
char
Controls in which session_replication_role modes the trigger fires. O
= trigger fires in “origin” and “local” modes, D
= trigger is disabled, R
= trigger fires in “replica” mode, A
= trigger fires always.
tgisinternal
bool
True if trigger is internally generated (usually, to enforce the constraint identified by tgconstraint
)
tgconstrrelid
oid
pg_class
.oid
The table referenced by a referential integrity constraint
tgconstrindid
oid
pg_class
.oid
The index supporting a unique, primary key, referential integrity, or exclusion constraint
tgconstraint
oid
pg_constraint
.oid
The pg_constraint
entry associated with the trigger, if any
tgdeferrable
bool
True if constraint trigger is deferrable
tginitdeferred
bool
True if constraint trigger is initially deferred
tgnargs
int2
Number of argument strings passed to trigger function
tgattr
int2vector
pg_attribute
.attnum
Column numbers, if trigger is column-specific; otherwise an empty array
tgargs
bytea
Argument strings to pass to trigger, each NULL-terminated
tgqual
pg_node_tree
Expression tree (in nodeToString()
representation) for the trigger's WHEN
condition, or null if none
tgoldtable
name
REFERENCING
clause name for OLD TABLE
, or null if none
tgnewtable
name
REFERENCING
clause name for NEW TABLE
, or null if none
Name
Type
References
Description
oid
oid
Row identifier (hidden attribute; must be explicitly selected)
rulename
name
Rule name
ev_class
oid
pg_class
.oid
The table this rule is for
ev_type
char
Event type that the rule is for: 1 = SELECT
, 2 = UPDATE
, 3 = INSERT
, 4 = DELETE
ev_enabled
char
Controls in which session_replication_role modes the rule fires. O
= rule fires in “origin” and “local” modes, D
= rule is disabled, R
= rule fires in “replica” mode, A
= rule fires always.
is_instead
bool
True if the rule is an INSTEAD
rule
ev_qual
pg_node_tree
Expression tree (in the form of a nodeToString()
representation) for the rule's qualifying condition
ev_action
pg_node_tree
Query tree (in the form of a nodeToString()
representation) for the rule's action
欄位
型別
參考
說明
stxrelid
oid
pg_class
.oid
包含此物件包含欄位的所屬資料表
stxname
name
統計物件的名稱
stxnamespace
oid
pg_namespace
.oid
包含此統計資訊物件在命名空間裡的 OID
stxowner
oid
pg_authid
.oid
統計物件的所有者
stxkeys
int2vector
pg_attribute
.attnum
一組陣列表示的屬性數字,指示此統計物件覆蓋哪些資料表欄位;例如,值為 1 3 意味著覆蓋了第一個和第三個資料表欄位
stxkind
char[]
包含已啟用統計類型的代碼的陣列;有效值為:d 表示 n-distinct 統計資訊,f 表示功能相依統計資訊
stxndistinct
pg_ndistinct
N-distinct 計數,序列化為 pg_ndistinct 型別
stxdependencies
pg_dependencies
功能相依統計資訊,序列化為 pg_dependencies 型別
Name
Type
References
Description
oid
oid
Row identifier (hidden attribute; must be explicitly selected)
proname
name
Name of the function
pronamespace
oid
pg_namespace
.oid
The OID of the namespace that contains this function
proowner
oid
pg_authid
.oid
Owner of the function
prolang
oid
pg_language
.oid
Implementation language or call interface of this function
procost
float4
Estimated execution cost (in units of cpu_operator_cost); if proretset
, this is cost per row returned
prorows
float4
Estimated number of result rows (zero if not proretset
)
provariadic
oid
pg_type
.oid
Data type of the variadic array parameter's elements, or zero if the function does not have a variadic parameter
protransform
regproc
pg_proc
.oid
Calls to this function can be simplified by this other function (see Section 38.10.10)
prokind
char
f
for a normal function, p
for a procedure, a
for an aggregate function, or w
for a window function
prosecdef
bool
Function is a security definer (i.e., a “setuid” function)
proleakproof
bool
The function has no side effects. No information about the arguments is conveyed except via the return value. Any function that might throw an error depending on the values of its arguments is not leak-proof.
proisstrict
bool
Function returns null if any call argument is null. In that case the function won't actually be called at all. Functions that are not “strict” must be prepared to handle null inputs.
proretset
bool
Function returns a set (i.e., multiple values of the specified data type)
provolatile
char
provolatile
tells whether the function's result depends only on its input arguments, or is affected by outside factors. It is i
for “immutable” functions, which always deliver the same result for the same inputs. It is s
for “stable” functions, whose results (for fixed inputs) do not change within a scan. It is v
for “volatile” functions, whose results might change at any time. (Use v
also for functions with side-effects, so that calls to them cannot get optimized away.)
proparallel
char
proparallel
tells whether the function can be safely run in parallel mode. It is s
for functions which are safe to run in parallel mode without restriction. It is r
for functions which can be run in parallel mode, but their execution is restricted to the parallel group leader; parallel worker processes cannot invoke these functions. It is u
for functions which are unsafe in parallel mode; the presence of such a function forces a serial execution plan.
pronargs
int2
Number of input arguments
pronargdefaults
int2
Number of arguments that have defaults
prorettype
oid
pg_type
.oid
Data type of the return value
proargtypes
oidvector
pg_type
.oid
An array with the data types of the function arguments. This includes only input arguments (including INOUT
and VARIADIC
arguments), and thus represents the call signature of the function.
proallargtypes
oid[]
pg_type
.oid
An array with the data types of the function arguments. This includes all arguments (including OUT
and INOUT
arguments); however, if all the arguments are IN
arguments, this field will be null. Note that subscripting is 1-based, whereas for historical reasons proargtypes
is subscripted from 0.
proargmodes
char[]
An array with the modes of the function arguments, encoded as i
for IN
arguments, o
for OUT
arguments, b
for INOUT
arguments, v
for VARIADIC
arguments, t
for TABLE
arguments. If all the arguments are IN
arguments, this field will be null. Note that subscripts correspond to positions of proallargtypes
not proargtypes
.
proargnames
text[]
An array with the names of the function arguments. Arguments without a name are set to empty strings in the array. If none of the arguments have a name, this field will be null. Note that subscripts correspond to positions of proallargtypes
not proargtypes
.
proargdefaults
pg_node_tree
Expression trees (in nodeToString()
representation) for default values. This is a list with pronargdefaults
elements, corresponding to the last N
input arguments (i.e., the last N
proargtypes
positions). If none of the arguments have defaults, this field will be null.
protrftypes
oid[]
Data type OIDs for which to apply transforms.
prosrc
text
This tells the function handler how to invoke the function. It might be the actual source code of the function for interpreted languages, a link symbol, a file name, or just about anything else, depending on the implementation language/call convention.
probin
text
Additional information about how to invoke the function. Again, the interpretation is language-specific.
proconfig
text[]
Function's local settings for run-time configuration variables
proacl
aclitem[]
Code | Category |
| Array types |
| Boolean types |
| Composite types |
| Date/time types |
| Enum types |
| Geometric types |
| Network address types |
| Numeric types |
| Pseudo-types |
| Range types |
| String types |
| Timespan types |
| User-defined types |
| Bit-string types |
|
|
Name | Type | References | Description |
|
|
| Row identifier (hidden attribute; must be explicitly selected) |
|
|
| Data type name |
|
| The OID of the namespace that contains this type |
|
| Owner of the type |
|
|
| For a fixed-size type, |
|
|
|
|
|
|
|
|
|
|
|
|
|
| True if the type is a preferred cast target within its |
|
|
| True if the type is defined, false if this is a placeholder entry for a not-yet-defined type. When |
|
|
| Character that separates two values of this type when parsing array input. Note that the delimiter is associated with the array element data type, not the array data type. |
|
| If this is a composite type (see |
|
| If |
|
| If |
|
| Input conversion function (text format) |
|
| Output conversion function (text format) |
|
| Input conversion function (binary format), or 0 if none |
|
| Output conversion function (binary format), or 0 if none |
|
| Type modifier input function, or 0 if type does not support modifiers |
|
| Type modifier output function, or 0 to use the standard format |
|
| Custom |
|
|
|
|
|
|
|
|
|
|
|
|
|
| If this is a domain (see |
|
|
| Domains use |
|
|
|
|
|
|
|
|
|
| If |
|
|
|
|
|
|
|
Name | Type | References | Description |
|
| .nspname | Name of schema containing table |
|
| .relname | Name of table |
|
| .attname | Name of the column described by this row |
|
|
| If true, this row includes inheritance child columns, not just the values in the specified table |
|
|
| Fraction of column entries that are null |
|
|
| Average width in bytes of column's entries |
|
|
| If greater than zero, the estimated number of distinct values in the column. If less than zero, the negative of the number of distinct values divided by the number of rows. (The negated form is used when |
|
|
| A list of the most common values in the column. (Null if no values seem to be more common than any others.) |
|
|
| A list of the frequencies of the most common values, i.e., number of occurrences of each divided by total number of rows. (Null when |
|
|
| A list of values that divide the column's values into groups of approximately equal population. The values in |
|
|
| Statistical correlation between physical row ordering and logical ordering of the column values. This ranges from -1 to +1. When the value is near -1 or +1, an index scan on the column will be estimated to be cheaper than when it is near zero, due to reduction of random access to the disk. (This column is null if the column data type does not have a |
|
|
| A list of non-null element values most often appearing within values of the column. (Null for scalar types.) |
|
|
| A list of the frequencies of the most common element values, i.e., the fraction of rows containing at least one instance of the given value. Two or three additional values follow the per-element frequencies; these are the minimum and maximum of the preceding per-element frequencies, and optionally the frequency of null elements. (Null when |
|
|
| A histogram of the counts of distinct non-null element values within the values of the column, followed by the average number of distinct non-null elements. (Null for scalar types.) |
The pg_replication_origin_status
view contains information about how far replay for a certain origin has progressed. For more on replication origins see Chapter 49.
Table 51.80. pg_replication_origin_status
Columns
.oid
.oid
typcategory
is an arbitrary classification of data types that is used by the parser to determine which implicit casts should be “preferred”. See .
.oid
.oid
.oid
.oid
.oid
.oid
.oid
.oid
.oid
.oid
.oid
.oid
Access privileges; see and for details
Name
Type
References
Description
local_id
Oid
pg_replication_origin
.roident
internal node identifier
external_id
text
pg_replication_origin
.roname
external node identifier
remote_lsn
pg_lsn
The origin node's LSN up to which data has been replicated.
local_lsn
pg_lsn
This node's LSN at which remote_lsn
has been replicated. Used to flush commit records before persisting data to disk when using asynchronous commits.
目錄 pg_database 儲存有關資料庫一些可用的訊息。資料庫是使用 CREATE DATABASE 命令建立的。關於某些參數的含義的詳細訊息,請參閱第 22 章。
與大多數系統目錄不同,pg_database 在叢集的所有資料庫之間共享:每個叢集只有一個 pg_database 副本,而不是每個資料庫一個副本。
Table 51.15. pg_database
欄位
名稱
型別
參閱
說明
oid
oid
資料列識別指標(隱藏屬性;必須明確選擇)
datname
name
資料庫名稱
datdba
oid
pg_authid
.oid
資料庫的擁有者,通常是建立它的使用者
encoding
int4
此資料庫的字元編碼(pg_encoding_to_char()可將此數字轉換為編碼名稱)
datcollate
name
這個資料庫的 LC_COLLATE
datctype
name
這個資料庫的 LC_CTYPE
datistemplate
bool
如果為 true,則該資料庫可以由具有 CREATEDB 權限的任何使用者複製;如果為 false,則只有超級使用者或資料庫的擁有者才能複製它。
datallowconn
bool
如果為 false,則沒有人可以連線到該資料庫。這用於保護 template0 資料庫免遭更改。
datconnlimit
int4
設定可以對此資料庫執行的最大同時連線數。-1 意味著沒有限制。
datlastsysoid
oid
資料庫中的最後一個系統 OID;特別適用於 pg_dump
datfrozenxid
xid
在這個事務 ID 之前在此資料庫中的所有事務 ID,已被替換為永久(「 frozen」)。這用於追踪是否需要清理資料庫以防止事務 ID 重覆或允許縮減 pg_xact。它是每個資料表 pg_class.relfrozenxid 的最小值。
datminmxid
xid
此資料庫中的所有 multixact ID 已被替換為該資料庫中的事務 ID。這用於追踪資料庫是否需要清理,以防止 multixact ID 重覆或允許縮減 pg_multixact。它是每個資料表 pg_class.relminmxid 的最小值。
dattablespace
oid
pg_tablespace
.oid
資料庫預設的資料表空間。在此資料庫中,pg_class.reltablespace 為零的所有資料表都將儲存在此資料表空間中;特別是所有非共享系統目錄都將在那裡。
datacl
aclitem[]