Note
This view is introduced since OceanBase Database V3.2.3.
Purpose
This view displays information about constraints on tables and columns in a CREATE TABLE operation.
Columns
| Column | Type | Nullable? | Description |
|---|---|---|---|
| CONSTRAINT_CATALOG | varchar(64) | NO | The name of the catalog to which the constraint belongs. The value of this column is always def. |
| CONSTRAINT_SCHEMA | varchar(128) | NO | The name of the schema to which the constraint belongs. |
| CONSTRAINT_NAME | varchar(64) | NO | The name of the constraint. |
| CHECK_CLAUSE | text | NO | The expression of the constraint. |
Sample query
Query the constraint information related to tables and columns under the current tenant.
obclient [infotest]> SELECT * FROM information_schema.CHECK_CONSTRAINTS;
The query result is as follows:
+--------------------+-------------------+-------------------------------+--------------+
| CONSTRAINT_CATALOG | CONSTRAINT_SCHEMA | CONSTRAINT_NAME | CHECK_CLAUSE |
+--------------------+-------------------+-------------------------------+--------------+
| def | infotest | tbl8_OBCHECK_1736909793670468 | (`col1` > 0) |
+--------------------+-------------------+-------------------------------+--------------+
1 row in set