Overview
foreign_key_checks specifies whether to check foreign key constraints during DML and DDL operations.
Privilege requirements
Query variables
Global level
The
systenant and all user tenants can use theSHOW VARIABLESstatement or theinformation_schema.GLOBAL_VARIABLESview to view the values of global system variables.Session level
Both the
systenant and all user tenants can use theSHOW VARIABLESstatement or theinformation_schema.SESSION_VARIABLESview to view the values of session system variables.
Modify variables
Global effective
The
systenant can directly modify the values of global system variables.The user tenant must have the
SUPERorALTER SYSTEMprivilege to modify the value of a global system variable.
Session expiration
The
systenant and all user tenants can directly modify the values of session system variables for their own tenants.
Attributes
Attribute |
Description |
|---|---|
| Parameter type | Bool |
| Default Value | 1 |
| Value range |
|
| Effective Scope |
|
| Modifiable | Yes, you can use theSETStatement modification. |
Usage instructions
Foreign key constraint checking is enabled by default in OceanBase AI Database. The foreign key constraint checking switch is controlled by the tenant variable foreign_key_checks. When creating a foreign key constraint, if you do not specify a foreign key name, the system automatically assigns a constraint name. The automatically assigned constraint name is the table name suffixed with _OBFK_ and a timestamp. For example, t1_OBFK_1627747200000000.
Configuration example
Specifies to check foreign constraints during DML and DDL operations.
Session expiration
obclient> SET foreign_key_checks = ON;or
obclient> SET foreign_key_checks = 1;Effective globally
obclient> SET GLOBAL foreign_key_checks = ON;or
obclient> SET GLOBAL foreign_key_checks = 1;
References
- Foreign key constraints
- Define column constraints
- Full Direct Load
- Data import overview