Automatic protection against high-risk SQL statements
Updated at:
To prevent data loss caused by accidental operations, PolarDB-X 1.0 disables the execution of high-risk SQL statements by default, such as full-table deletions (that is, statements without a WHERE or LIMIT condition, for example a DELETE statement) and full-table updates (that is, statements without a WHERE or LIMIT condition, for example an UPDATE statement). However, you can also use a HINT statement to bypass the automatic protection and force a full-table delete or update operation.
Syntax
You can add the following HINT statement to an UPDATE or DELETE statement to perform a full-table delete or update:
/!TDDL:FORBID_EXECUTE_DML_ALL=false*/Examples
- If a
DELETEstatement does not contain aWHEREorLIMITcondition, the statement is intercepted and the following error message is returned:DELETE FROM tt; ERR-CODE: [TDDL-4620][ERR_FORBID_EXECUTE_DML_ALL] Forbid execute DELETE ALL or UPDATE ALL sql. More: [http:// example.aliyundoc.com/faq/faqByFaqCode.html?faqCode=TDDL-4620]Add the following HINT to the statement to execute it successfully:/!TDDL:FORBID_EXECUTE_DML_ALL=false*/DELETE FROM tt; Query OK, 10 row affected (0.21 sec) - If an
UPDATEstatement does not contain aWHEREorLIMITcondition, the statement is intercepted and the following error message is returned:UPDATE tt SET id = 1; ERR-CODE: [TDDL-4620][ERR_FORBID_EXECUTE_DML_ALL] Forbid execute DELETE ALL or UPDATE ALL sql. More: [http://example.aliyundoc.com/faq/faqByFaqCode.html?faqCode=TDDL-4620]Add the following HINT to the statement to execute it successfully:/!TDDL:FORBID_EXECUTE_DML_ALL=false*/UPDATE tt SET id = 1; Query OK, 10 row affected (0.21 sec)
Is this page helpful?