TABLE_CONSTRAINTS
TABLE_CONSTRAINTS
表描述了哪些表具有约束(constraint)以及相关信息。
DESC INFORMATION_SCHEMA.table_constraints;
+--------------------+--------+------+------+---------+---------------+
| Column | Type | Key | Null | Default | Semantic Type |
+--------------------+--------+------+------+---------+---------------+
| constraint_catalog | String | | NO | | FIELD |
| constraint_schema | String | | NO | | FIELD |
| constraint_name | String | | NO | | FIELD |
| table_schema | String | | NO | | FIELD |
| table_name | String | | NO | | FIELD |
| constraint_type | String | | NO | | FIELD |
| enforced | String | | NO | | FIELD |
+--------------------+--------+------+------+---------+---------------+
表中的列:
CONSTRAINT_CATALOG
: 约束所属 catalog 的名称。此值始终为def
。CONSTRAINT_SCHEMA
: 约束所属数据库的名称。CONSTRAINT_NAME
: 约束的名称,可以是TIME INDEX
或PRIMARY
。TABLE_NAME
: 表的名称。CONSTRAINT_TYPE
: 约束的类型。值可以是TIME INDEX
或PRIMARY KEY
。TIME INDEX
和PRIMARY KEY
信息类似于SHOW INDEX
语句的执行结果。enforced
: 不支持CHECK
约束,此值始终为YES
。
select * from INFORMATION_SCHEMA.table_constraints WHERE table_name = 'monitor'\G;
输出结果:
*************************** 1. row ***************************
constraint_catalog: def
constraint_schema: public
constraint_name: TIME INDEX
table_schema: public
table_name: monitor
constraint_type: TIME INDEX
enforced: YES
*************************** 2. row ***************************
constraint_catalog: def
constraint_schema: public
constraint_name: PRIMARY
table_schema: public
table_name: monitor
constraint_type: PRIMARY KEY
enforced: YES
当前内容版权归 GreptimeDB 或其关联方所有,如需对内容或内容相关联开源项目进行关注与资助,请访问 GreptimeDB .