Note
This view is introduced since OceanBase Database V1.4.
Purpose
This view displays information about table constraints.
Columns
| Column | Type | Nullable? | Description |
|---|---|---|---|
| CONSTRAINT_CATALOG | varchar(64) | NO | The name of the catalog to which the constraint belongs. |
| CONSTRAINT_SCHEMA | varchar(128) | NO | The name of the database to which the constraint belongs. |
| CONSTRAINT_NAME | varchar(256) | NO | The name of the constraint. |
| TABLE_SCHEMA | varchar(128) | NO | The name of the database to which the table belongs. |
| TABLE_NAME | varchar(256) | NO | The name of the table. |
| CONSTRAINT_TYPE | varchar(11) | NO | The type of the constraint. |
| ENFORCED | varchar(3) | NO | Indicates whether the constraint is enabled. |
Sample query
Query the constraint information of table tbl6.
obclient [infotest]> SELECT * FROM information_schema.TABLE_CONSTRAINTS WHERE TABLE_NAME='tbl6';
The query result is as follows:
+--------------------+-------------------+-----------------+--------------+------------+-----------------+----------+
| CONSTRAINT_CATALOG | CONSTRAINT_SCHEMA | CONSTRAINT_NAME | TABLE_SCHEMA | TABLE_NAME | CONSTRAINT_TYPE | ENFORCED |
+--------------------+-------------------+-----------------+--------------+------------+-----------------+----------+
| def | infotest | col1 | infotest | tbl6 | UNIQUE | YES |
+--------------------+-------------------+-----------------+--------------+------------+-----------------+----------+
1 row in set