2025年9月25日: PostgreSQL 18 发布!
支持的版本: 当前 (18) / 17 / 16 / 15 / 14 / 13
开发版本: devel
不支持的版本: 12 / 11 / 10 / 9.6 / 9.5 / 9.4 / 9.3 / 9.2 / 9.1 / 9.0 / 8.4 / 8.3 / 8.2 / 8.1 / 8.0 / 7.4

35.52. table_constraints #

视图 table_constraints 包含当前用户拥有或对其具有除 SELECT 之外任何权限的所有表的约束。

表 35.50. table_constraints

列 类型

描述

constraint_catalog sql_identifier

包含约束的数据库名称(始终是当前数据库)

constraint_schema sql_identifier

包含约束的模式名称

constraint_name sql_identifier

约束的名称

table_catalog sql_identifier

包含该表的数据库名称(始终是当前数据库)

table_schema sql_identifier

包含该表的模式名称

table_name sql_identifier

表的名称

constraint_type character_data

约束的类型:CHECK(包括非空约束)、FOREIGN KEYPRIMARY KEYUNIQUE

is_deferrable yes_or_no

如果约束是可延迟的,则为 YES,否则为 NO

initially_deferred yes_or_no

如果约束是可延迟的且初始状态为延迟,则为 YES,否则为 NO

enforced yes_or_no

如果约束已强制执行,则为 YES,否则为 NO

nulls_distinct yes_or_no

如果约束是唯一约束,则当约束将 NULL 值视为不同时为 YES,否则为 NO;对于其他类型的约束,则为 NULL。


提交更正

如果您在文档中发现任何不正确、与您在使用特定功能时的体验不符或需要进一步澄清的内容,请使用 此表单 报告文档问题。