Note
This view is available starting with V4.1.0.
Overview
Records the rules for custom rewriting SQL statements under the current tenant.
Columns
field |
Type |
Whether can be NULL |
Description |
|---|---|---|---|
| DB_NAME | varchar(128) | NO | DB_NAME Specified During Rule Definition |
| RULE_NAME | varchar(256) | NO | Rule Name |
| RULE_ID | bigint(20) | NO | Rule ID |
| PATTERN | longtext | NO | Template of statements for rule matching |
| REPLACEMENT | longtext | NO | Indicates how to rewrite the statement template that matches the pattern. |
| NORMALIZED_PATTERN | longtext | NO | Pattern after Parameterization |
| STATUS | varchar(10) | NO |
|
| VERSION | bigint(20) | NO | Rule version number |
| PATTERN_DIGEST | bigint(20) unsigned | NO | Hash value of NORMALIZED_PATTERN |
Sample query
View the custom SQL rewrite rules for this tenant.
obclient [oceanbase]> SELECT * FROM oceanbase.DBA_OB_USER_DEFINED_RULES;
The query result is as follows:
+---------+-----------+---------+--------------------+------------------------+--------------------+--------+---------+---------------------+
| DB_NAME | RULE_NAME | RULE_ID | PATTERN | REPLACEMENT | NORMALIZED_PATTERN | STATUS | VERSION | PATTERN_DIGEST |
+---------+-----------+---------+--------------------+------------------------+--------------------+--------+---------+---------------------+
| test | rule1 | 500019 | select ? from dual | select ? + 1 from dual | select ? from dual | ENABLE | 3 | 2647993221679348756 |
+---------+-----------+---------+--------------------+------------------------+--------------------+--------+---------+---------------------+
2 rows in set
