This is an automated email from the ASF dual-hosted git repository.
jianglongtao pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/shardingsphere.git
The following commit(s) were added to refs/heads/master by this push:
new c50d22855ec Add `ifExist` for `drop rule` DistSQL documents (#23368)
c50d22855ec is described below
commit c50d22855ecace986159effaab0d11225065a083
Author: Zichao <[email protected]>
AuthorDate: Fri Jan 6 19:38:51 2023 +1300
Add `ifExist` for `drop rule` DistSQL documents (#23368)
---
.../db-discovery/drop-db-discovery-heartbeat.cn.md | 14 +++++++++++--
.../db-discovery/drop-db-discovery-heartbeat.en.md | 14 +++++++++++--
.../db-discovery/drop-db-discovery-rule.cn.md | 14 +++++++++++--
.../db-discovery/drop-db-discovery-rule.en.md | 14 +++++++++++--
.../db-discovery/drop-db-discovery-type.cn.md | 19 ++++++++++++-----
.../db-discovery/drop-db-discovery-type.en.md | 19 ++++++++++++-----
.../encrypt/drop-encrypt-rule.cn.md | 19 ++++++++++++++---
.../encrypt/drop-encrypt-rule.en.md | 19 ++++++++++++++---
.../rdl/rule-definition/mask/drop-mask-rule.cn.md | 19 ++++++++++++++---
.../rdl/rule-definition/mask/drop-mask-rule.en.md | 19 ++++++++++++++---
.../drop-readwrite-splitting-rule.cn.md | 17 +++++++++++++--
.../drop-readwrite-splitting-rule.en.md | 17 +++++++++++++--
.../shadow/drop-default-shadow-algorithm.cn.md | 14 +++++++++++--
.../shadow/drop-default-shadow-algorithm.en.md | 14 +++++++++++--
.../shadow/drop-shadow-algorithm.cn.md | 14 +++++++++++--
.../shadow/drop-shadow-algorithm.en.md | 14 +++++++++++--
.../rule-definition/shadow/drop-shadow-rule.cn.md | 14 +++++++++++--
.../rule-definition/shadow/drop-shadow-rule.en.md | 14 +++++++++++--
.../sharding/drop-broadcast-table-rule.cn.md | 14 +++++++++++--
.../sharding/drop-broadcast-table-rule.en.md | 14 +++++++++++--
.../sharding/drop-default-sharding-strategy.cn.md | 20 ++++++++++++++++--
.../sharding/drop-default-sharding-strategy.en.md | 24 ++++++++++++++++++----
.../sharding/drop-sharding-algorithm.cn.md | 14 +++++++++++--
.../sharding/drop-sharding-algorithm.en.md | 18 ++++++++++++----
.../sharding/drop-sharding-key-generator.cn.md | 14 +++++++++++--
.../sharding/drop-sharding-key-generator.en.md | 20 +++++++++++++-----
.../drop-sharding-table-reference-rule.cn.md | 17 +++++++++++++--
.../drop-sharding-table-reference-rule.en.md | 16 +++++++++++++--
.../sharding/drop-sharding-table-rule.cn.md | 14 +++++++++++--
.../sharding/drop-sharding-table-rule.en.md | 18 ++++++++++++----
.../unregister-storage-unit.cn.md | 10 ++++++---
.../unregister-storage-unit.en.md | 10 ++++++---
32 files changed, 426 insertions(+), 85 deletions(-)
diff --git
a/docs/document/content/user-manual/shardingsphere-proxy/distsql/syntax/rdl/rule-definition/db-discovery/drop-db-discovery-heartbeat.cn.md
b/docs/document/content/user-manual/shardingsphere-proxy/distsql/syntax/rdl/rule-definition/db-discovery/drop-db-discovery-heartbeat.cn.md
index 4116fdc7ed0..e19fedaaa99 100644
---
a/docs/document/content/user-manual/shardingsphere-proxy/distsql/syntax/rdl/rule-definition/db-discovery/drop-db-discovery-heartbeat.cn.md
+++
b/docs/document/content/user-manual/shardingsphere-proxy/distsql/syntax/rdl/rule-definition/db-discovery/drop-db-discovery-heartbeat.cn.md
@@ -13,7 +13,10 @@ weight = 5
{{% tab name="语法" %}}
```sql
DropDatabaseDiscoveryHeartbeat ::=
- 'DROP' 'DB_DISCOVERY' 'HEARTBEAT' dbDiscoveryHeartbeatName (','
dbDiscoveryHeartbeatName)* ('FROM' databaseName)?
+ 'DROP' 'DB_DISCOVERY' 'HEARTBEAT' ifExists? dbDiscoveryHeartbeatName (','
dbDiscoveryHeartbeatName)* ('FROM' databaseName)?
+
+ifExists ::=
+ 'IF' 'EXISTS'
dbDiscoveryHeartbeatName ::=
identifier
@@ -29,7 +32,8 @@ databaseName ::=
### 补充说明
-- 未指定 `databaseName` 时,默认是当前使用的 `DATABASE`。 如果也未使用 `DATABASE` 则会提示 `No
database selected`。
+- 未指定 `databaseName` 时,默认是当前使用的 `DATABASE`。 如果也未使用 `DATABASE` 则会提示 `No
database selected`;
+- `ifExists` 子句用于避免 `Database discovery heartbeat not exists` 错误。
### 示例
@@ -45,6 +49,12 @@ DROP DB_DISCOVERY HEARTBEAT group_0_heartbeat,
group_1_heartbeat FROM discovery_
DROP DB_DISCOVERY HEARTBEAT group_0_heartbeat;
```
+- 使用 `ifExists` 子句删除数据库发现心跳
+
+```sql
+DROP DB_DISCOVERY HEARTBEAT IF EXISTS group_0_heartbeat;
+```
+
### 保留字
`DROP`、`DB_DISCOVERY`、`HEARTBEAT`、`FROM`
diff --git
a/docs/document/content/user-manual/shardingsphere-proxy/distsql/syntax/rdl/rule-definition/db-discovery/drop-db-discovery-heartbeat.en.md
b/docs/document/content/user-manual/shardingsphere-proxy/distsql/syntax/rdl/rule-definition/db-discovery/drop-db-discovery-heartbeat.en.md
index 926606f9894..ba52fbc004e 100644
---
a/docs/document/content/user-manual/shardingsphere-proxy/distsql/syntax/rdl/rule-definition/db-discovery/drop-db-discovery-heartbeat.en.md
+++
b/docs/document/content/user-manual/shardingsphere-proxy/distsql/syntax/rdl/rule-definition/db-discovery/drop-db-discovery-heartbeat.en.md
@@ -13,7 +13,10 @@ The `DROP DB_DISCOVERY HEARTBEAT` syntax is used to drop
database discovery hear
{{% tab name="Grammar" %}}
```sql
DropDatabaseDiscoveryHeartbeat ::=
- 'DROP' 'DB_DISCOVERY' 'HEARTBEAT' dbDiscoveryHeartbeatName (','
dbDiscoveryHeartbeatName)* ('FROM' databaseName)?
+ 'DROP' 'DB_DISCOVERY' 'HEARTBEAT' ifExists? dbDiscoveryHeartbeatName (','
dbDiscoveryHeartbeatName)* ('FROM' databaseName)?
+
+ifExists ::=
+ 'IF' 'EXISTS'
dbDiscoveryHeartbeatName ::=
identifier
@@ -29,7 +32,8 @@ databaseName ::=
### Supplement
-- When databaseName is not specified, the default is the currently used
DATABASE. If DATABASE is not used, No database selected will be prompted.
+- When databaseName is not specified, the default is the currently used
DATABASE. If DATABASE is not used, No database selected will be prompted;
+- `ifExists` clause is used for avoid `Database discovery heartbeat not
exists` error.
### Example
@@ -45,6 +49,12 @@ DROP DB_DISCOVERY HEARTBEAT group_0_heartbeat,
group_1_heartbeat FROM discovery_
DROP DB_DISCOVERY HEARTBEAT group_0_heartbeat;
```
+- Drop database discovery heartbeat with `ifExists` clause
+
+```sql
+DROP DB_DISCOVERY HEARTBEAT IF EXISTS group_0_heartbeat;
+```
+
### Reserved word
`DROP`, `DB_DISCOVERY`, `HEARTBEAT`, `FROM`
diff --git
a/docs/document/content/user-manual/shardingsphere-proxy/distsql/syntax/rdl/rule-definition/db-discovery/drop-db-discovery-rule.cn.md
b/docs/document/content/user-manual/shardingsphere-proxy/distsql/syntax/rdl/rule-definition/db-discovery/drop-db-discovery-rule.cn.md
index 58515bd0b08..8af55c311bd 100644
---
a/docs/document/content/user-manual/shardingsphere-proxy/distsql/syntax/rdl/rule-definition/db-discovery/drop-db-discovery-rule.cn.md
+++
b/docs/document/content/user-manual/shardingsphere-proxy/distsql/syntax/rdl/rule-definition/db-discovery/drop-db-discovery-rule.cn.md
@@ -13,7 +13,10 @@ weight = 4
{{% tab name="语法" %}}
```sql
DropDatabaseDiscoveryRule ::=
- 'DROP' 'DB_DISCOVERY' 'RULE' dbDiscoveryRuleName (',' dbDiscoveryRuleName)*
('FROM' databaseName)?
+ 'DROP' 'DB_DISCOVERY' 'RULE' ifExists? dbDiscoveryRuleName (','
dbDiscoveryRuleName)* ('FROM' databaseName)?
+
+ifExists ::=
+ 'IF' 'EXISTS'
dbDiscoveryRuleName ::=
identifier
@@ -30,7 +33,8 @@ databaseName ::=
### 补充说明
-- 未指定 `databaseName` 时,默认是当前使用的 `DATABASE`。 如果也未使用 `DATABASE` 则会提示 `No
database selected`。
+- 未指定 `databaseName` 时,默认是当前使用的 `DATABASE`。 如果也未使用 `DATABASE` 则会提示 `No
database selected`;
+- `ifExists` 子句用于避免 `Database discovery rule not exists` 错误。
### 示例
@@ -46,6 +50,12 @@ DROP DB_DISCOVERY RULE group_0, group_1 FROM discovery_db;
DROP DB_DISCOVERY RULE group_0;
```
+- 使用 `ifExists` 子句删除数据库发现规则
+
+```sql
+DROP DB_DISCOVERY RULE IF EXISTS group_0;
+```
+
### 保留字
`DROP`、`DB_DISCOVERY`、`RULE`、`FROM`
diff --git
a/docs/document/content/user-manual/shardingsphere-proxy/distsql/syntax/rdl/rule-definition/db-discovery/drop-db-discovery-rule.en.md
b/docs/document/content/user-manual/shardingsphere-proxy/distsql/syntax/rdl/rule-definition/db-discovery/drop-db-discovery-rule.en.md
index a85e5717226..1c84a199111 100644
---
a/docs/document/content/user-manual/shardingsphere-proxy/distsql/syntax/rdl/rule-definition/db-discovery/drop-db-discovery-rule.en.md
+++
b/docs/document/content/user-manual/shardingsphere-proxy/distsql/syntax/rdl/rule-definition/db-discovery/drop-db-discovery-rule.en.md
@@ -13,7 +13,10 @@ The `DROP DB_DISCOVERY RULE` syntax is used to drop database
discovery rule for
{{% tab name="Grammar" %}}
```sql
DropDatabaseDiscoveryRule ::=
- 'DROP' 'DB_DISCOVERY' 'RULE' dbDiscoveryRuleName (',' dbDiscoveryRuleName)*
('FROM' databaseName)?
+ 'DROP' 'DB_DISCOVERY' 'RULE' ifExists? dbDiscoveryRuleName (','
dbDiscoveryRuleName)* ('FROM' databaseName)?
+
+ifExists ::=
+ 'IF' 'EXISTS'
dbDiscoveryRuleName ::=
identifier
@@ -29,7 +32,8 @@ databaseName ::=
### Supplement
-- When databaseName is not specified, the default is the currently used
DATABASE. If DATABASE is not used, No database selected will be prompted.
+- When databaseName is not specified, the default is the currently used
DATABASE. If DATABASE is not used, No database selected will be prompted;
+- `ifExists` clause is used for avoid `Database discovery rule not exists`
error.
### Example
@@ -45,6 +49,12 @@ DROP DB_DISCOVERY RULE group_0, group_1 FROM discovery_db;
DROP DB_DISCOVERY RULE group_0;
```
+- Drop database discovery rule with `ifExists` clause
+
+```sql
+DROP DB_DISCOVERY RULE IF EXISTS group_0;
+```
+
### Reserved word
`DROP`, `DB_DISCOVERY`, `RULE`, `FROM`
diff --git
a/docs/document/content/user-manual/shardingsphere-proxy/distsql/syntax/rdl/rule-definition/db-discovery/drop-db-discovery-type.cn.md
b/docs/document/content/user-manual/shardingsphere-proxy/distsql/syntax/rdl/rule-definition/db-discovery/drop-db-discovery-type.cn.md
index 0620bf0039c..8533e6a2d24 100644
---
a/docs/document/content/user-manual/shardingsphere-proxy/distsql/syntax/rdl/rule-definition/db-discovery/drop-db-discovery-type.cn.md
+++
b/docs/document/content/user-manual/shardingsphere-proxy/distsql/syntax/rdl/rule-definition/db-discovery/drop-db-discovery-type.cn.md
@@ -13,7 +13,10 @@ weight = 6
{{% tab name="语法" %}}
```sql
DropDatabaseDiscoveryType ::=
- 'DROP' 'DB_DISCOVERY' 'TYPE' dbDiscoveryTypeName (',' dbDiscoveryTypeName)*
('FROM' databaseName)?
+ 'DROP' 'DB_DISCOVERY' 'TYPE' ifExists? dbDiscoveryTypeName (','
dbDiscoveryTypeName)* ('FROM' databaseName)?
+
+ifExists ::=
+ 'IF' 'EXISTS'
dbDiscoveryTypeName ::=
identifier
@@ -29,9 +32,9 @@ databaseName ::=
### 补充说明
-- 未指定 `databaseName` 时,默认是当前使用的 `DATABASE`。 如果也未使用 `DATABASE` 则会提示 `No
database selected`
-
-- `dbDiscoveryTypeName` 需要通过 [SHOW DB_DISCOVERY
TYPE](/cn/user-manual/shardingsphere-proxy/distsql/syntax/rql/rule-query/db-discovery/show-db-discovery-type/)
语法查询获得
+- 未指定 `databaseName` 时,默认是当前使用的 `DATABASE`。 如果也未使用 `DATABASE` 则会提示 `No
database selected`;
+- `dbDiscoveryTypeName` 需要通过 [SHOW DB_DISCOVERY
TYPE](/cn/user-manual/shardingsphere-proxy/distsql/syntax/rql/rule-query/db-discovery/show-db-discovery-type/)
语法查询获得;
+- `ifExists` 子句用于避免 `Database discovery type not exists` 错误。
### 示例
@@ -44,7 +47,13 @@ DROP DB_DISCOVERY TYPE group_0_mysql_mgr, group_1_mysql_mgr
FROM discovery_db;
- 为当前数据库删除单个数据库发现类型
```sql
-DROP DB_DISCOVERY TYPE group_0_mysql_mgr, group_1_mysql_mgr;
+DROP DB_DISCOVERY TYPE group_0_mysql_mgr;
+```
+
+- 使用 `ifExists` 子句删除数据库发现类型
+
+```sql
+DROP DB_DISCOVERY TYPE IF EXISTS group_0_mysql_mgr;
```
### 保留字
diff --git
a/docs/document/content/user-manual/shardingsphere-proxy/distsql/syntax/rdl/rule-definition/db-discovery/drop-db-discovery-type.en.md
b/docs/document/content/user-manual/shardingsphere-proxy/distsql/syntax/rdl/rule-definition/db-discovery/drop-db-discovery-type.en.md
index 2d2c88f4d2b..b67b53df4b3 100644
---
a/docs/document/content/user-manual/shardingsphere-proxy/distsql/syntax/rdl/rule-definition/db-discovery/drop-db-discovery-type.en.md
+++
b/docs/document/content/user-manual/shardingsphere-proxy/distsql/syntax/rdl/rule-definition/db-discovery/drop-db-discovery-type.en.md
@@ -13,7 +13,10 @@ The `DROP DB_DISCOVERY TYPE` syntax is used to drop database
discovery type for
{{% tab name="Grammar" %}}
```sql
DropDatabaseDiscoveryType ::=
- 'DROP' 'DB_DISCOVERY' 'TYPE' dbDiscoveryTypeName (',' dbDiscoveryTypeName)*
('FROM' databaseName)?
+ 'DROP' 'DB_DISCOVERY' 'TYPE' ifExists? dbDiscoveryTypeName (','
dbDiscoveryTypeName)* ('FROM' databaseName)?
+
+ifExists ::=
+ 'IF' 'EXISTS'
dbDiscoveryTypeName ::=
identifier
@@ -29,9 +32,9 @@ databaseName ::=
### Supplement
-- When `databaseName` is not specified, the default is the currently used
`DATABASE`. If `DATABASE` is not used, No database selected will be prompted.
-
-- `dbDiscoveryTypeName` obtain through [SHOW DB_DISCOVERY
TYPE](/en/user-manual/shardingsphere-proxy/distsql/syntax/rql/rule-query/db-discovery/show-db-discovery-type/)
syntax query.
+- When `databaseName` is not specified, the default is the currently used
`DATABASE`. If `DATABASE` is not used, No database selected will be prompted;
+- `dbDiscoveryTypeName` obtain through [SHOW DB_DISCOVERY
TYPE](/en/user-manual/shardingsphere-proxy/distsql/syntax/rql/rule-query/db-discovery/show-db-discovery-type/)
syntax query;
+- `ifExists` clause is used for avoid `Database discovery type not exists`
error.
### Example
@@ -44,7 +47,13 @@ DROP DB_DISCOVERY TYPE group_0_mysql_mgr, group_1_mysql_mgr
FROM discovery_db;
- Drop single database discovery type for current database
```sql
-DROP DB_DISCOVERY TYPE group_0_mysql_mgr, group_1_mysql_mgr;
+DROP DB_DISCOVERY TYPE group_0_mysql_mgr;
+```
+
+- Drop database discovery type with `ifExists` clause
+
+```sql
+DROP DB_DISCOVERY TYPE IF EXISTS group_0_mysql_mgr;
```
### Reserved word
diff --git
a/docs/document/content/user-manual/shardingsphere-proxy/distsql/syntax/rdl/rule-definition/encrypt/drop-encrypt-rule.cn.md
b/docs/document/content/user-manual/shardingsphere-proxy/distsql/syntax/rdl/rule-definition/encrypt/drop-encrypt-rule.cn.md
index c3750c67112..3b2b25603cd 100644
---
a/docs/document/content/user-manual/shardingsphere-proxy/distsql/syntax/rdl/rule-definition/encrypt/drop-encrypt-rule.cn.md
+++
b/docs/document/content/user-manual/shardingsphere-proxy/distsql/syntax/rdl/rule-definition/encrypt/drop-encrypt-rule.cn.md
@@ -13,9 +13,12 @@ weight = 4
{{% tab name="语法" %}}
```sql
DropEncryptRule ::=
- 'DROP' 'ENCRYPT' 'RULE' tableName (',' tableName)*
-
-tableName ::=
+ 'DROP' 'ENCRYPT' 'RULE' ifExists? encryptRuleName (',' encryptRuleName)*
+
+ifExists ::=
+ 'IF' 'EXISTS'
+
+encryptRuleName ::=
identifier
```
{{% /tab %}}
@@ -24,6 +27,10 @@ tableName ::=
{{% /tab %}}
{{< /tabs >}}
+### 补充说明
+
+- `ifExists` 子句用于避免 `Encrypt rule not exists` 错误。
+
### 示例
- 删除加密规则
@@ -32,6 +39,12 @@ tableName ::=
DROP ENCRYPT RULE t_encrypt, t_encrypt_2;
```
+- 使用 `ifExists` 删除加密规则
+
+```sql
+DROP ENCRYPT RULE IF EXISTS t_encrypt, t_encrypt_2;
+```
+
### 保留字
`DROP`, `ENCRYPT`, `RULE`
diff --git
a/docs/document/content/user-manual/shardingsphere-proxy/distsql/syntax/rdl/rule-definition/encrypt/drop-encrypt-rule.en.md
b/docs/document/content/user-manual/shardingsphere-proxy/distsql/syntax/rdl/rule-definition/encrypt/drop-encrypt-rule.en.md
index 20c816fd6e3..6ed7ad8525e 100644
---
a/docs/document/content/user-manual/shardingsphere-proxy/distsql/syntax/rdl/rule-definition/encrypt/drop-encrypt-rule.en.md
+++
b/docs/document/content/user-manual/shardingsphere-proxy/distsql/syntax/rdl/rule-definition/encrypt/drop-encrypt-rule.en.md
@@ -13,9 +13,12 @@ The `DROP ENCRYPT RULE` syntax is used to drop an existing
encryption rule.
{{% tab name="Grammar" %}}
```sql
DropEncryptRule ::=
- 'DROP' 'ENCRYPT' 'RULE' tableName (',' tableName)*
-
-tableName ::=
+ 'DROP' 'ENCRYPT' 'RULE' ifExists? encryptRuleName (',' encryptRuleName)*
+
+ifExists ::=
+ 'IF' 'EXISTS'
+
+encryptRuleName ::=
identifier
```
{{% /tab %}}
@@ -24,6 +27,10 @@ tableName ::=
{{% /tab %}}
{{< /tabs >}}
+### Supplement
+
+- `ifExists` clause is used for avoid `Encrypt rule not exists` error.
+
### Example
- Drop an encrypt rule
@@ -32,6 +39,12 @@ tableName ::=
DROP ENCRYPT RULE t_encrypt, t_encrypt_2;
```
+- Drop encrypt with `ifExists` clause
+
+```sql
+DROP ENCRYPT RULE IF EXISTS t_encrypt, t_encrypt_2;
+```
+
### Reserved words
`DROP`, `ENCRYPT`, `RULE`
diff --git
a/docs/document/content/user-manual/shardingsphere-proxy/distsql/syntax/rdl/rule-definition/mask/drop-mask-rule.cn.md
b/docs/document/content/user-manual/shardingsphere-proxy/distsql/syntax/rdl/rule-definition/mask/drop-mask-rule.cn.md
index 27915b5ac02..944579a779a 100644
---
a/docs/document/content/user-manual/shardingsphere-proxy/distsql/syntax/rdl/rule-definition/mask/drop-mask-rule.cn.md
+++
b/docs/document/content/user-manual/shardingsphere-proxy/distsql/syntax/rdl/rule-definition/mask/drop-mask-rule.cn.md
@@ -13,9 +13,12 @@ weight = 4
{{% tab name="语法" %}}
```sql
DropEncryptRule ::=
- 'DROP' 'MASK' 'RULE' ruleName (',' ruleName)*
-
-ruleName ::=
+ 'DROP' 'MASK' 'RULE' ifExists? maskRuleName (',' maskRuleName)*
+
+ifExists ::=
+ 'IF' 'EXISTS'
+
+maskRuleName ::=
identifier
```
{{% /tab %}}
@@ -24,6 +27,10 @@ ruleName ::=
{{% /tab %}}
{{< /tabs >}}
+### 补充说明
+
+- `ifExists` 子句用于避免 `Mask rule not exists` 错误。
+
### 示例
- 删除数据脱敏规则
@@ -32,6 +39,12 @@ ruleName ::=
DROP MASK RULE t_mask, t_mask_1;
```
+- 使用 `ifExists` 子句删除数据脱敏规则
+
+```sql
+DROP MASK RULE IF EXISTS t_mask, t_mask_1;
+```
+
### 保留字
`DROP`, `MASK`, `RULE`
diff --git
a/docs/document/content/user-manual/shardingsphere-proxy/distsql/syntax/rdl/rule-definition/mask/drop-mask-rule.en.md
b/docs/document/content/user-manual/shardingsphere-proxy/distsql/syntax/rdl/rule-definition/mask/drop-mask-rule.en.md
index ce7ae72858c..23147a4d7ca 100644
---
a/docs/document/content/user-manual/shardingsphere-proxy/distsql/syntax/rdl/rule-definition/mask/drop-mask-rule.en.md
+++
b/docs/document/content/user-manual/shardingsphere-proxy/distsql/syntax/rdl/rule-definition/mask/drop-mask-rule.en.md
@@ -13,9 +13,12 @@ The `DROP MASK RULE` syntax is used to drop existing mask
rule.
{{% tab name="Grammar" %}}
```sql
DropEncryptRule ::=
- 'DROP' 'MASK' 'RULE' ruleName (',' ruleName)*
-
-ruleName ::=
+ 'DROP' 'MASK' 'RULE' ifExists? maskRuleName (',' maskRuleName)*
+
+ifExists ::=
+ 'IF' 'EXISTS'
+
+maskRuleName ::=
identifier
```
{{% /tab %}}
@@ -24,6 +27,10 @@ ruleName ::=
{{% /tab %}}
{{< /tabs >}}
+### Supplement
+
+- `ifExists` clause used for avoid `Mask rule not exists` error.
+
### Example
- Drop mask rule
@@ -32,6 +39,12 @@ ruleName ::=
DROP MASK RULE t_mask, t_mask_1;
```
+- Drop mask rule with `ifExists` clause
+
+```sql
+DROP MASK RULE IF EXISTS t_mask, t_mask_1;
+```
+
### Reserved words
`DROP`, `MASK`, `RULE`
diff --git
a/docs/document/content/user-manual/shardingsphere-proxy/distsql/syntax/rdl/rule-definition/readwrite-splitting/drop-readwrite-splitting-rule.cn.md
b/docs/document/content/user-manual/shardingsphere-proxy/distsql/syntax/rdl/rule-definition/readwrite-splitting/drop-readwrite-splitting-rule.cn.md
index f7b9d4165e1..0a1c13c8973 100644
---
a/docs/document/content/user-manual/shardingsphere-proxy/distsql/syntax/rdl/rule-definition/readwrite-splitting/drop-readwrite-splitting-rule.cn.md
+++
b/docs/document/content/user-manual/shardingsphere-proxy/distsql/syntax/rdl/rule-definition/readwrite-splitting/drop-readwrite-splitting-rule.cn.md
@@ -13,7 +13,13 @@ weight = 4
{{% tab name="语法" %}}
```sql
DropReadwriteSplittingRule ::=
- 'DROP' 'READWRITE_SPLITTING' 'RULE' ('FROM' databaseName)?
+ 'DROP' 'READWRITE_SPLITTING' 'RULE' ifExists? readwriteSplittingRuleName
(',' readwriteSplittingRuleName)* ('FROM' databaseName)?
+
+ifExists ::=
+ 'IF' 'EXISTS'
+
+readwriteSplittingRuleName ::=
+ identifier
databaseName ::=
identifier
@@ -26,7 +32,8 @@ databaseName ::=
### 补充说明
-- 未指定 `databaseName` 时,默认是当前使用的 `DATABASE`。 如果也未使用 `DATABASE` 则会提示 `No
database selected`。
+- 未指定 `databaseName` 时,默认是当前使用的 `DATABASE`。 如果也未使用 `DATABASE` 则会提示 `No
database selected`;
+- `ifExists` 子句用于避免 `Readwrite splitting rule not exists` 错误。
### 示例
@@ -42,6 +49,12 @@ DROP READWRITE_SPLITTING RULE ms_group_1 FROM
readwrite_splitting_db;
DROP READWRITE_SPLITTING RULE ms_group_1;
```
+- 使用 `ifExists` 子句删除读写分离规则
+
+```sql
+DROP READWRITE_SPLITTING RULE IF EXISTS ms_group_1;
+```
+
### 保留字
`DROP`、`READWRITE_SPLITTING`、`RULE`
diff --git
a/docs/document/content/user-manual/shardingsphere-proxy/distsql/syntax/rdl/rule-definition/readwrite-splitting/drop-readwrite-splitting-rule.en.md
b/docs/document/content/user-manual/shardingsphere-proxy/distsql/syntax/rdl/rule-definition/readwrite-splitting/drop-readwrite-splitting-rule.en.md
index 43edcabdaac..f842f68afcb 100644
---
a/docs/document/content/user-manual/shardingsphere-proxy/distsql/syntax/rdl/rule-definition/readwrite-splitting/drop-readwrite-splitting-rule.en.md
+++
b/docs/document/content/user-manual/shardingsphere-proxy/distsql/syntax/rdl/rule-definition/readwrite-splitting/drop-readwrite-splitting-rule.en.md
@@ -13,7 +13,13 @@ The `DROP READWRITE_SPLITTING RULE` syntax is used to drop
readwrite splitting r
{{% tab name="Grammar" %}}
```sql
DropReadwriteSplittingRule ::=
- 'DROP' 'READWRITE_SPLITTING' 'RULE' ('FROM' databaseName)?
+ 'DROP' 'READWRITE_SPLITTING' 'RULE' ifExists? readwriteSplittingRuleName
(',' readwriteSplittingRuleName)* ('FROM' databaseName)?
+
+ifExists ::=
+ 'IF' 'EXISTS'
+
+readwriteSplittingRuleName ::=
+ identifier
databaseName ::=
identifier
@@ -26,7 +32,8 @@ databaseName ::=
### Supplement
-- When `databaseName` is not specified, the default is the currently used
`DATABASE`. If `DATABASE` is not used, `No database selected` will be prompted.
+- When `databaseName` is not specified, the default is the currently used
`DATABASE`. If `DATABASE` is not used, `No database selected` will be prompted;
+- `ifExists` clause is used for avoid `Readwrite splitting rule not exists`
error.
### Example
@@ -42,6 +49,12 @@ DROP READWRITE_SPLITTING RULE ms_group_1 FROM
readwrite_splitting_db;
DROP READWRITE_SPLITTING RULE ms_group_1;
```
+- Drop readwrite splitting rule with `ifExists` clause
+
+```sql
+DROP READWRITE_SPLITTING RULE IF EXISTS ms_group_1;
+```
+
### Reserved word
`DROP`, `READWRITE_SPLITTING`, `RULE`
diff --git
a/docs/document/content/user-manual/shardingsphere-proxy/distsql/syntax/rdl/rule-definition/shadow/drop-default-shadow-algorithm.cn.md
b/docs/document/content/user-manual/shardingsphere-proxy/distsql/syntax/rdl/rule-definition/shadow/drop-default-shadow-algorithm.cn.md
index e10dba9a758..2149497c7d1 100644
---
a/docs/document/content/user-manual/shardingsphere-proxy/distsql/syntax/rdl/rule-definition/shadow/drop-default-shadow-algorithm.cn.md
+++
b/docs/document/content/user-manual/shardingsphere-proxy/distsql/syntax/rdl/rule-definition/shadow/drop-default-shadow-algorithm.cn.md
@@ -13,7 +13,10 @@ weight = 7
{{% tab name="语法" %}}
```sql
DropDefaultShadowAlgorithm ::=
- 'DROP' 'DEFAULT' 'SHADOW' 'ALGORITHM' ('FROM' databaseName)?
+ 'DROP' 'DEFAULT' 'SHADOW' 'ALGORITHM' ifExists? ('FROM' databaseName)?
+
+ifExists ::=
+ 'IF' 'EXISTS'
databaseName ::=
identifier
@@ -26,7 +29,8 @@ databaseName ::=
### 补充说明
-- 未指定 `databaseName` 时,默认是当前使用的 `DATABASE`。 如果也未使用 `DATABASE` 则会提示 `No
database selected`。
+- 未指定 `databaseName` 时,默认是当前使用的 `DATABASE`。 如果也未使用 `DATABASE` 则会提示 `No
database selected`;
+- `ifExists` 子句用于避免 `Default shadow algorithm not exists` 错误。
### 示例
@@ -42,6 +46,12 @@ DROP DEFAULT SHADOW ALGORITHM FROM shadow_db;
DROP DEFAULT SHADOW ALGORITHM;
```
+- 使用 `ifExists` 子句删除默认影子库压测算法
+
+```sql
+DROP DEFAULT SHADOW ALGORITHM IF EXISTS;
+```
+
### 保留字
`DROP`、`DEFAULT`、`SHADOW`、`ALGORITHM`、`FROM`
diff --git
a/docs/document/content/user-manual/shardingsphere-proxy/distsql/syntax/rdl/rule-definition/shadow/drop-default-shadow-algorithm.en.md
b/docs/document/content/user-manual/shardingsphere-proxy/distsql/syntax/rdl/rule-definition/shadow/drop-default-shadow-algorithm.en.md
index 1272e44a5b4..01324e0b67c 100644
---
a/docs/document/content/user-manual/shardingsphere-proxy/distsql/syntax/rdl/rule-definition/shadow/drop-default-shadow-algorithm.en.md
+++
b/docs/document/content/user-manual/shardingsphere-proxy/distsql/syntax/rdl/rule-definition/shadow/drop-default-shadow-algorithm.en.md
@@ -13,7 +13,10 @@ The `DROP DEFAULT SHADOW ALGORITHM` syntax is used to drop
default shadow algori
{{% tab name="Grammar" %}}
```sql
DropDefaultShadowAlgorithm ::=
- 'DROP' 'DEFAULT' 'SHADOW' 'ALGORITHM' ('FROM' databaseName)?
+ 'DROP' 'DEFAULT' 'SHADOW' 'ALGORITHM' ifExists? ('FROM' databaseName)?
+
+ifExists ::=
+ 'IF' 'EXISTS'
databaseName ::=
identifier
@@ -26,7 +29,8 @@ databaseName ::=
### Supplement
-- When databaseName is not specified, the default is the currently used
DATABASE. If DATABASE is not used, No database selected will be prompted.
+- When databaseName is not specified, the default is the currently used
DATABASE. If DATABASE is not used, No database selected will be prompted;
+- `ifExists` clause used for avoid `Default shadow algorithm not exists` error.
### Example
@@ -42,6 +46,12 @@ DROP DEFAULT SHADOW ALGORITHM FROM shadow_db;
DROP DEFAULT SHADOW ALGORITHM;
```
+- Drop default shadow algorithm with `ifExists` clause
+
+```sql
+DROP DEFAULT SHADOW ALGORITHM IF EXISTS;
+```
+
### Reserved word
`DROP`, `DEFAULT`, `SHODOW`, `ALGORITHM`, `FROM`
diff --git
a/docs/document/content/user-manual/shardingsphere-proxy/distsql/syntax/rdl/rule-definition/shadow/drop-shadow-algorithm.cn.md
b/docs/document/content/user-manual/shardingsphere-proxy/distsql/syntax/rdl/rule-definition/shadow/drop-shadow-algorithm.cn.md
index 4ced4dff041..643b2137111 100644
---
a/docs/document/content/user-manual/shardingsphere-proxy/distsql/syntax/rdl/rule-definition/shadow/drop-shadow-algorithm.cn.md
+++
b/docs/document/content/user-manual/shardingsphere-proxy/distsql/syntax/rdl/rule-definition/shadow/drop-shadow-algorithm.cn.md
@@ -13,7 +13,10 @@ weight = 8
{{% tab name="语法" %}}
```sql
DropShadowAlgorithm ::=
- 'DROP' 'SHADOW' 'ALGORITHM' shadowAlgorithmName (',' shadowAlgorithmName)*
('FROM' databaseName)?
+ 'DROP' 'SHADOW' 'ALGORITHM' ifExists? shadowAlgorithmName (','
shadowAlgorithmName)* ('FROM' databaseName)?
+
+ifExists ::=
+ 'IF' 'EXISTS'
shadowAlgorithmName ::=
identifier
@@ -29,7 +32,8 @@ databaseName ::=
### 补充说明
-- 未指定 `databaseName` 时,默认是当前使用的 `DATABASE`。 如果也未使用 `DATABASE` 则会提示 `No
database selected`。
+- 未指定 `databaseName` 时,默认是当前使用的 `DATABASE`。 如果也未使用 `DATABASE` 则会提示 `No
database selected`;
+- `ifExists` 子句用于避免 `shadow algorithm not exists` 错误。
### 示例
@@ -45,6 +49,12 @@ DROP SHADOW ALGORITHM shadow_rule_t_order_simple_hint_0,
shadow_rule_t_order_ite
DROP SHADOW ALGORITHM shadow_rule_t_order_simple_hint_0;
```
+- 使用 `ifExists` 子句删除影子库压测算法
+
+```sql
+DROP SHADOW ALGORITHM IF EXISTS shadow_rule_t_order_simple_hint_0;
+```
+
### 保留字
`DROP`、`SHADOW`、`ALGORITHM`、`FROM`
diff --git
a/docs/document/content/user-manual/shardingsphere-proxy/distsql/syntax/rdl/rule-definition/shadow/drop-shadow-algorithm.en.md
b/docs/document/content/user-manual/shardingsphere-proxy/distsql/syntax/rdl/rule-definition/shadow/drop-shadow-algorithm.en.md
index f6405430bc6..d79ef420a7a 100644
---
a/docs/document/content/user-manual/shardingsphere-proxy/distsql/syntax/rdl/rule-definition/shadow/drop-shadow-algorithm.en.md
+++
b/docs/document/content/user-manual/shardingsphere-proxy/distsql/syntax/rdl/rule-definition/shadow/drop-shadow-algorithm.en.md
@@ -13,7 +13,10 @@ The `DROP SHADOW ALGORITHM` syntax is used to drop shadow
algorithm for specifie
{{% tab name="Grammar" %}}
```sql
DropShadowAlgorithm ::=
- 'DROP' 'SHADOW' 'ALGORITHM' shadowAlgorithmName (',' shadowAlgorithmName)*
('FROM' databaseName)?
+ 'DROP' 'SHADOW' 'ALGORITHM' ifExists? shadowAlgorithmName (','
shadowAlgorithmName)* ('FROM' databaseName)?
+
+ifExists ::=
+ 'IF' 'EXISTS'
shadowAlgorithmName ::=
identifier
@@ -29,7 +32,8 @@ databaseName ::=
### Supplement
-- When databaseName is not specified, the default is the currently used
DATABASE. If DATABASE is not used, No database selected will be prompted.
+- When databaseName is not specified, the default is the currently used
DATABASE. If DATABASE is not used, No database selected will be prompted;
+- `ifExists` clause is used for avoid `shadow algorithm not exists` error.
### Example
@@ -45,6 +49,12 @@ DROP SHADOW ALGORITHM shadow_rule_t_order_simple_hint_0,
shadow_rule_t_order_ite
DROP SHADOW ALGORITHM shadow_rule_t_order_simple_hint_0;
```
+- Drop shadow algorithm with `ifExists` clause
+
+```sql
+DROP SHADOW ALGORITHM IF EXISTS shadow_rule_t_order_simple_hint_0;
+```
+
### Reserved word
`DROP`, `SHODOW`, `ALGORITHM`, `FROM`
diff --git
a/docs/document/content/user-manual/shardingsphere-proxy/distsql/syntax/rdl/rule-definition/shadow/drop-shadow-rule.cn.md
b/docs/document/content/user-manual/shardingsphere-proxy/distsql/syntax/rdl/rule-definition/shadow/drop-shadow-rule.cn.md
index 5699996cfd5..3d9c5fe6c22 100644
---
a/docs/document/content/user-manual/shardingsphere-proxy/distsql/syntax/rdl/rule-definition/shadow/drop-shadow-rule.cn.md
+++
b/docs/document/content/user-manual/shardingsphere-proxy/distsql/syntax/rdl/rule-definition/shadow/drop-shadow-rule.cn.md
@@ -13,7 +13,10 @@ weight = 4
{{% tab name="语法" %}}
```sql
DropShadowRule ::=
- 'DROP' 'SHADOW' 'TABLE' 'RULE' shadowRuleName ('FROM' databaseName)?
+ 'DROP' 'SHADOW' 'TABLE' 'RULE' ifExists? shadowRuleName ('FROM'
databaseName)?
+
+ifExists ::=
+ 'IF' 'EXISTS'
shadowRuleName ::=
identifier
@@ -29,7 +32,8 @@ databaseName ::=
### 补充说明
-- 未指定 `databaseName` 时,默认是当前使用的 `DATABASE`。 如果也未使用 `DATABASE` 则会提示 `No
database selected`。
+- 未指定 `databaseName` 时,默认是当前使用的 `DATABASE`。 如果也未使用 `DATABASE` 则会提示 `No
database selected`;
+- `ifExists` 子句用于避免 `Shadow rule not exists` 错误。
### 示例
@@ -45,6 +49,12 @@ DROP SHADOW RULE shadow_rule FROM shadow_db;
DROP SHADOW RULE shadow_rule;
```
+- 使用 `ifExists` 子句删除影子库压测规则
+
+```sql
+DROP SHADOW RULE IF EXISTS shadow_rule;
+```
+
### 保留字
`DROP`、`SHADOW`、`RULE`、`FROM`
diff --git
a/docs/document/content/user-manual/shardingsphere-proxy/distsql/syntax/rdl/rule-definition/shadow/drop-shadow-rule.en.md
b/docs/document/content/user-manual/shardingsphere-proxy/distsql/syntax/rdl/rule-definition/shadow/drop-shadow-rule.en.md
index 839d34f4662..d0439453cf0 100644
---
a/docs/document/content/user-manual/shardingsphere-proxy/distsql/syntax/rdl/rule-definition/shadow/drop-shadow-rule.en.md
+++
b/docs/document/content/user-manual/shardingsphere-proxy/distsql/syntax/rdl/rule-definition/shadow/drop-shadow-rule.en.md
@@ -13,7 +13,10 @@ The `DROP SHADOW RULE` syntax is used to drop shadow rule
for specified database
{{% tab name="Grammar" %}}
```sql
DropShadowRule ::=
- 'DROP' 'SHADOW' 'TABLE' 'RULE' shadowRuleName ('FROM' databaseName)?
+ 'DROP' 'SHADOW' 'TABLE' 'RULE' ifExists? shadowRuleName ('FROM'
databaseName)?
+
+ifExists ::=
+ 'IF' 'EXISTS'
shadowRuleName ::=
identifier
@@ -29,7 +32,8 @@ databaseName ::=
### Supplement
-- When databaseName is not specified, the default is the currently used
DATABASE. If DATABASE is not used, No database selected will be prompted.
+- When databaseName is not specified, the default is the currently used
DATABASE. If DATABASE is not used, No database selected will be prompted;
+- `ifExists` clause is used for avoid `Shadow rule not exists` error.
### Example
@@ -45,6 +49,12 @@ DROP SHADOW RULE shadow_rule FROM shadow_db;
DROP SHADOW RULE shadow_rule;
```
+- Drop shadow rule with `ifExists` clause
+
+```sql
+DROP SHADOW RULE IF EXISTS shadow_rule;
+```
+
### Reserved word
`DROP`, `SHODOW`, `RULE`, `FROM`
diff --git
a/docs/document/content/user-manual/shardingsphere-proxy/distsql/syntax/rdl/rule-definition/sharding/drop-broadcast-table-rule.cn.md
b/docs/document/content/user-manual/shardingsphere-proxy/distsql/syntax/rdl/rule-definition/sharding/drop-broadcast-table-rule.cn.md
index dd0041ab9c5..5a2b39abc88 100644
---
a/docs/document/content/user-manual/shardingsphere-proxy/distsql/syntax/rdl/rule-definition/sharding/drop-broadcast-table-rule.cn.md
+++
b/docs/document/content/user-manual/shardingsphere-proxy/distsql/syntax/rdl/rule-definition/sharding/drop-broadcast-table-rule.cn.md
@@ -13,7 +13,10 @@ weight = 17
{{% tab name="语法" %}}
```sql
DropBroadcastTableRule ::=
- 'DROP' 'BROADCAST' 'TABLE' 'RULE' tableName (',' tableName)*
+ 'DROP' 'BROADCAST' 'TABLE' 'RULE' ifExists? tableName (',' tableName)*
+
+ifExists ::=
+ 'IF' 'EXISTS'
tableName ::=
identifier
@@ -26,7 +29,8 @@ tableName ::=
### 补充说明
-- `tableName` 可使用已经存在的广播规则的表。
+- `tableName` 可使用已经存在的广播规则的表;
+- `ifExists` 子句用于避免 `Broadcast rule not exists` 错误。
### 示例
@@ -36,6 +40,12 @@ tableName ::=
DROP BROADCAST TABLE RULE t_province, t_city;
```
+- 使用 `ifExists` 子句为广播表删除广播规则
+
+```sql
+DROP BROADCAST TABLE RULE IF EXISTS t_province, t_city;
+```
+
### 保留字
`DROP`、`BROADCAST`、`TABLE`、`RULE`
diff --git
a/docs/document/content/user-manual/shardingsphere-proxy/distsql/syntax/rdl/rule-definition/sharding/drop-broadcast-table-rule.en.md
b/docs/document/content/user-manual/shardingsphere-proxy/distsql/syntax/rdl/rule-definition/sharding/drop-broadcast-table-rule.en.md
index d7c00925d2c..c4edfbb38f8 100644
---
a/docs/document/content/user-manual/shardingsphere-proxy/distsql/syntax/rdl/rule-definition/sharding/drop-broadcast-table-rule.en.md
+++
b/docs/document/content/user-manual/shardingsphere-proxy/distsql/syntax/rdl/rule-definition/sharding/drop-broadcast-table-rule.en.md
@@ -13,7 +13,10 @@ The `DROP BROADCAST TABLE RULE` syntax is used to drop
broadcast table rule for
{{% tab name="Grammar" %}}
```sql
DropBroadcastTableRule ::=
- 'DROP' 'BROADCAST' 'TABLE' 'RULE' tableName (',' tableName)*
+ 'DROP' 'BROADCAST' 'TABLE' 'RULE' ifExists? tableName (',' tableName)*
+
+ifExists ::=
+ 'IF' 'EXISTS'
tableName ::=
identifier
@@ -26,7 +29,8 @@ tableName ::=
### Supplement
-- `tableName` can use the table of existing broadcast rules
+- `tableName` can use the table of existing broadcast rules;
+- `ifExists` clause is used for avoid `Broadcast rule not exists` error.
### Example
@@ -36,6 +40,12 @@ tableName ::=
DROP BROADCAST TABLE RULE t_province, t_city;
```
+- Drop broadcast table rule with `ifExists` clause
+
+```
+DROP BROADCAST TABLE RULE IF EXISTS t_province, t_city;
+```
+
### Reserved word
`DROP`, `BROADCAST`, `TABLE`, `RULE`
diff --git
a/docs/document/content/user-manual/shardingsphere-proxy/distsql/syntax/rdl/rule-definition/sharding/drop-default-sharding-strategy.cn.md
b/docs/document/content/user-manual/shardingsphere-proxy/distsql/syntax/rdl/rule-definition/sharding/drop-default-sharding-strategy.cn.md
index 22bfed9252a..9172a3ca22c 100644
---
a/docs/document/content/user-manual/shardingsphere-proxy/distsql/syntax/rdl/rule-definition/sharding/drop-default-sharding-strategy.cn.md
+++
b/docs/document/content/user-manual/shardingsphere-proxy/distsql/syntax/rdl/rule-definition/sharding/drop-default-sharding-strategy.cn.md
@@ -13,7 +13,10 @@ weight = 7
{{% tab name="语法" %}}
```sql
DropDefaultShardingStrategy ::=
- 'DROP' 'DEFAULT' 'SHARDING' ('TABLE' | 'DATABASE') 'STRATEGY' ('FROM'
databaseName)?
+ 'DROP' 'DEFAULT' 'SHARDING' ('TABLE' | 'DATABASE') 'STRATEGY' ifExists?
('FROM' databaseName)?
+
+ifExists ::=
+ 'IF' 'EXISTS'
databaseName ::=
identifier
@@ -26,7 +29,8 @@ databaseName ::=
### 补充说明
-- 未指定 `databaseName` 时,默认是当前使用的 `DATABASE`。 如果也未使用 `DATABASE` 则会提示 `No
database selected`。
+- 未指定 `databaseName` 时,默认是当前使用的 `DATABASE`。 如果也未使用 `DATABASE` 则会提示 `No
database selected`;
+- `ifExists` 子句用于避免 `Default sharding strategy not exists` 错误。
### 示例
@@ -42,6 +46,18 @@ DROP DEFAULT SHARDING TABLE STRATEGY FROM sharding_db;
DROP DEFAULT SHARDING DATABASE STRATEGY;
```
+- 使用 `ifExists` 子句删除默认表分片策略
+
+```sql
+DROP DEFAULT SHARDING TABLE STRATEGY IF EXISTS;
+```
+
+- 使用 `ifExists` 子句删除默认库分片策略
+
+```sql
+DROP DEFAULT SHARDING DATABASE STRATEGY IF EXISTS;
+```
+
### 保留字
`DROP`、`DEFAULT`、`SHARDING`、`TABLE`、`DATABASE`、`STRATEGY`、`FROM`
diff --git
a/docs/document/content/user-manual/shardingsphere-proxy/distsql/syntax/rdl/rule-definition/sharding/drop-default-sharding-strategy.en.md
b/docs/document/content/user-manual/shardingsphere-proxy/distsql/syntax/rdl/rule-definition/sharding/drop-default-sharding-strategy.en.md
index 730905d0c1a..29cb018bd4c 100644
---
a/docs/document/content/user-manual/shardingsphere-proxy/distsql/syntax/rdl/rule-definition/sharding/drop-default-sharding-strategy.en.md
+++
b/docs/document/content/user-manual/shardingsphere-proxy/distsql/syntax/rdl/rule-definition/sharding/drop-default-sharding-strategy.en.md
@@ -13,7 +13,10 @@ The `DROP DEFAULT SHARDING STRATEGY` syntax is used to drop
default sharding str
{{% tab name="Grammar" %}}
```sql
DropDefaultShardingStrategy ::=
- 'DROP' 'DEFAULT' 'SHARDING' ('TABLE' | 'DATABASE') 'STRATEGY' ('FROM'
databaseName)?
+ 'DROP' 'DEFAULT' 'SHARDING' ('TABLE' | 'DATABASE') 'STRATEGY' ifExists?
('FROM' databaseName)?
+
+ifExists ::=
+ 'IF' 'EXISTS'
databaseName ::=
identifier
@@ -26,22 +29,35 @@ databaseName ::=
### Supplement
-- When `databaseName` is not specified, the default is the currently used
`DATABASE`. If `DATABASE` is not used, `No database selected` will be prompted.
+- When `databaseName` is not specified, the default is the currently used
`DATABASE`. If `DATABASE` is not used, `No database selected` will be prompted;
+- `ifExists` clause is used for avoid `Default sharding strategy not exists`
error.
### Example
-- Drop default sharding table strategy for specified database.
+- Drop default sharding table strategy for specified database
```sql
DROP DEFAULT SHARDING TABLE STRATEGY FROM sharding_db;
```
-- Drop default sharding database strategy for current database.
+- Drop default sharding database strategy for current database
```sql
DROP DEFAULT SHARDING DATABASE STRATEGY;
```
+- Drop default sharding table strategy with `ifExists` clause
+
+```sql
+DROP DEFAULT SHARDING TABLE STRATEGY IF EXISTS;
+```
+
+- Drop default sharding database strategy with `ifExists` clause
+
+```sql
+DROP DEFAULT SHARDING DATABASE STRATEGY IF EXISTS;
+```
+
### Reserved word
`DROP`, `DEFAULT` , `SHARDING`, `TABLE`, `DATABASE` ,`STRATEGY`, `FROM`
diff --git
a/docs/document/content/user-manual/shardingsphere-proxy/distsql/syntax/rdl/rule-definition/sharding/drop-sharding-algorithm.cn.md
b/docs/document/content/user-manual/shardingsphere-proxy/distsql/syntax/rdl/rule-definition/sharding/drop-sharding-algorithm.cn.md
index 91dff490f0a..dc7b3f973ba 100644
---
a/docs/document/content/user-manual/shardingsphere-proxy/distsql/syntax/rdl/rule-definition/sharding/drop-sharding-algorithm.cn.md
+++
b/docs/document/content/user-manual/shardingsphere-proxy/distsql/syntax/rdl/rule-definition/sharding/drop-sharding-algorithm.cn.md
@@ -13,7 +13,10 @@ weight = 12
{{% tab name="语法" %}}
```sql
DropShardingAlgorithm ::=
- 'DROP' 'SHARDING' 'ALGORITHM' shardingAlgorithmName ('FROM' databaseName)?
+ 'DROP' 'SHARDING' 'ALGORITHM' shardingAlgorithmName ifExists? ('FROM'
databaseName)?
+
+ifExists ::=
+ 'IF' 'EXISTS'
shardingAlgorithmName ::=
identifier
@@ -29,7 +32,8 @@ databaseName ::=
### 补充说明
-- 未指定 `databaseName` 时,默认是当前使用的 `DATABASE`。 如果也未使用 `DATABASE` 则会提示 `No
database selected`。
+- 未指定 `databaseName` 时,默认是当前使用的 `DATABASE`。 如果也未使用 `DATABASE` 则会提示 `No
database selected`;
+- `ifExists` 子句用于避免 `Sharding algorithm not exists` 错误。
### 示例
@@ -45,6 +49,12 @@ DROP SHARDING ALGORITHM t_order_hash_mod FROM sharding_db;
DROP SHARDING ALGORITHM t_order_hash_mod;
```
+- 使用 `ifExists` 子句删除分片算法
+
+```sql
+DROP SHARDING ALGORITHM IF EXISTS t_order_hash_mod;
+```
+
### 保留字
`DROP`、`SHARDING`、`ALGORITHM`、`FROM`
diff --git
a/docs/document/content/user-manual/shardingsphere-proxy/distsql/syntax/rdl/rule-definition/sharding/drop-sharding-algorithm.en.md
b/docs/document/content/user-manual/shardingsphere-proxy/distsql/syntax/rdl/rule-definition/sharding/drop-sharding-algorithm.en.md
index 80c645cf183..539409abc51 100644
---
a/docs/document/content/user-manual/shardingsphere-proxy/distsql/syntax/rdl/rule-definition/sharding/drop-sharding-algorithm.en.md
+++
b/docs/document/content/user-manual/shardingsphere-proxy/distsql/syntax/rdl/rule-definition/sharding/drop-sharding-algorithm.en.md
@@ -13,7 +13,10 @@ The `DROP SHARDING ALGORITHM` syntax is used to drop
sharding algorithm for spec
{{% tab name="Grammar" %}}
```sql
DropShardingAlgorithm ::=
- 'DROP' 'SHARDING' 'ALGORITHM' shardingAlgorithmName ('FROM' databaseName)?
+ 'DROP' 'SHARDING' 'ALGORITHM' shardingAlgorithmName ifExists? ('FROM'
databaseName)?
+
+ifExists ::=
+ 'IF' 'EXISTS'
shardingAlgorithmName ::=
identifier
@@ -29,22 +32,29 @@ databaseName ::=
### Supplement
-- When `databaseName` is not specified, the default is the currently used
`DATABASE`. If `DATABASE` is not used, `No database selected` will be prompted.
+- When `databaseName` is not specified, the default is the currently used
`DATABASE`. If `DATABASE` is not used, `No database selected` will be prompted;
+- `ifExists` clause used for avoid `Sharding algorithm not exists` error.
### Example
-- Drop sharding algorithm for specified database.
+- Drop sharding algorithm for specified database
```sql
DROP SHARDING ALGORITHM t_order_hash_mod FROM sharding_db;
```
-- Drop sharding algorithm for current database.
+- Drop sharding algorithm for current database
```sql
DROP SHARDING ALGORITHM t_order_hash_mod;
```
+- Drop sharding algorithm with `ifExists` clause
+
+```sql
+DROP SHARDING ALGORITHM IF EXISTS t_order_hash_mod;
+```
+
### Reserved word
`DROP`, `SHARDING`, `ALGORITHM`, `FROM`
diff --git
a/docs/document/content/user-manual/shardingsphere-proxy/distsql/syntax/rdl/rule-definition/sharding/drop-sharding-key-generator.cn.md
b/docs/document/content/user-manual/shardingsphere-proxy/distsql/syntax/rdl/rule-definition/sharding/drop-sharding-key-generator.cn.md
index 442ec2899f3..7a5883628ab 100644
---
a/docs/document/content/user-manual/shardingsphere-proxy/distsql/syntax/rdl/rule-definition/sharding/drop-sharding-key-generator.cn.md
+++
b/docs/document/content/user-manual/shardingsphere-proxy/distsql/syntax/rdl/rule-definition/sharding/drop-sharding-key-generator.cn.md
@@ -13,7 +13,10 @@ weight = 11
{{% tab name="语法" %}}
```sql
DropShardingKeyGenerator ::=
- 'DROP' 'SHARDING' 'KEY' 'GENERATOR' keyGeneratorName ('FROM' databaseName)?
+ 'DROP' 'SHARDING' 'KEY' 'GENERATOR' ifExists? keyGeneratorName
(keyGeneratorName)* ('FROM' databaseName)?
+
+ifExists ::=
+ 'IF' 'EXISTS'
keyGeneratorName ::=
identifier
@@ -29,7 +32,8 @@ databaseName ::=
### 补充说明
-- 未指定 `databaseName` 时,默认是当前使用的 `DATABASE`。 如果也未使用 `DATABASE` 则会提示 `No
database selected`。
+- 未指定 `databaseName` 时,默认是当前使用的 `DATABASE`。 如果也未使用 `DATABASE` 则会提示 `No
database selected`;
+- `ifExists` 子句用于避免 `Sharding key generator not exists` 错误。
### 示例
@@ -45,6 +49,12 @@ DROP SHARDING KEY GENERATOR t_order_snowflake FROM
sharding_db;
DROP SHARDING KEY GENERATOR t_order_snowflake;
```
+- 使用 `ifExists` 子句删除分片主键生成器
+
+```sql
+DROP SHARDING KEY GENERATOR IF EXISTS t_order_snowflake;
+```
+
### 保留字
`DROP`、`SHARDING`、`KEY`、`GENERATOR`、`FROM`
diff --git
a/docs/document/content/user-manual/shardingsphere-proxy/distsql/syntax/rdl/rule-definition/sharding/drop-sharding-key-generator.en.md
b/docs/document/content/user-manual/shardingsphere-proxy/distsql/syntax/rdl/rule-definition/sharding/drop-sharding-key-generator.en.md
index 43dea7a4e5d..2351cb0bd42 100644
---
a/docs/document/content/user-manual/shardingsphere-proxy/distsql/syntax/rdl/rule-definition/sharding/drop-sharding-key-generator.en.md
+++
b/docs/document/content/user-manual/shardingsphere-proxy/distsql/syntax/rdl/rule-definition/sharding/drop-sharding-key-generator.en.md
@@ -13,11 +13,14 @@ The `DROP SHARDING KEY GENERATOR` syntax is used to drop
sharding key generator
{{% tab name="Grammar" %}}
```sql
DropShardingKeyGenerator ::=
- 'DROP' 'SHARDING' 'KEY' 'GENERATOR' keyGeneratorName ('FROM' databaseName)?
+ 'DROP' 'SHARDING' 'KEY' 'GENERATOR' ifExists? keyGeneratorName
(keyGeneratorName)* ('FROM' databaseName)?
+
+ifExists ::=
+ 'IF' 'EXISTS'
keyGeneratorName ::=
identifier
-
+
databaseName ::=
identifier
```
@@ -29,22 +32,29 @@ databaseName ::=
### Supplement
-- When `databaseName` is not specified, the default is the currently used
`DATABASE`. If `DATABASE` is not used, `No database selected` will be prompted.
+- When `databaseName` is not specified, the default is the currently used
`DATABASE`. If `DATABASE` is not used, `No database selected` will be prompted;
+- `ifExists` clause is used for avoid `Sharding key generator not exists`
error.
### Example
-- Drop sharding key generator for specified database.
+- Drop sharding key generator for specified database
```sql
DROP SHARDING KEY GENERATOR t_order_snowflake FROM sharding_db;
```
-- Drop sharding key generator for current database.
+- Drop sharding key generator for current database
```sql
DROP SHARDING KEY GENERATOR t_order_snowflake;
```
+- Drop sharding key generator with `ifExists` clause
+
+```sql
+DROP SHARDING KEY GENERATOR IF EXISTS t_order_snowflake;
+```
+
### Reserved word
`DROP`, `SHARDING`, `KEY`, `GENERATOR`, `FROM`
diff --git
a/docs/document/content/user-manual/shardingsphere-proxy/distsql/syntax/rdl/rule-definition/sharding/drop-sharding-table-reference-rule.cn.md
b/docs/document/content/user-manual/shardingsphere-proxy/distsql/syntax/rdl/rule-definition/sharding/drop-sharding-table-reference-rule.cn.md
index fc679ec8bd1..e49883c0da5 100644
---
a/docs/document/content/user-manual/shardingsphere-proxy/distsql/syntax/rdl/rule-definition/sharding/drop-sharding-table-reference-rule.cn.md
+++
b/docs/document/content/user-manual/shardingsphere-proxy/distsql/syntax/rdl/rule-definition/sharding/drop-sharding-table-reference-rule.cn.md
@@ -13,9 +13,12 @@ weight = 15
{{% tab name="语法" %}}
```sql
DropShardingTableReferenceRule ::=
- 'DROP' 'SHARDING' 'TABLE' 'REFERENCE' 'RULE' ruleName (',' ruleName)*
+ 'DROP' 'SHARDING' 'TABLE' 'REFERENCE' 'RULE' ifExists?
shardingReferenceRuleName (',' shardingReferenceRuleName)*
-ruleName ::=
+ifExists ::=
+ 'IF' 'EXISTS'
+
+shardingReferenceRuleName ::=
identifier
```
{{% /tab %}}
@@ -24,6 +27,10 @@ ruleName ::=
{{% /tab %}}
{{< /tabs >}}
+### 补充说明
+
+- `ifExists` 子句用于避免 `Sharding reference rule not exists` 错误。
+
### 示例
- 删除单个关联规则
@@ -38,6 +45,12 @@ DROP SHARDING TABLE REFERENCE RULE ref_0;
DROP SHARDING TABLE REFERENCE RULE ref_0, ref_1;
```
+- 使用 `ifExists` 子句删除关联规则
+
+```sql
+DROP SHARDING TABLE REFERENCE RULE IF EXISTS ref_0;
+```
+
### 保留字
`DROP`、`SHARDING`、`TABLE`、`REFERENCE`、`RULE`
diff --git
a/docs/document/content/user-manual/shardingsphere-proxy/distsql/syntax/rdl/rule-definition/sharding/drop-sharding-table-reference-rule.en.md
b/docs/document/content/user-manual/shardingsphere-proxy/distsql/syntax/rdl/rule-definition/sharding/drop-sharding-table-reference-rule.en.md
index 66fa1ce136a..dcd9b639fd1 100644
---
a/docs/document/content/user-manual/shardingsphere-proxy/distsql/syntax/rdl/rule-definition/sharding/drop-sharding-table-reference-rule.en.md
+++
b/docs/document/content/user-manual/shardingsphere-proxy/distsql/syntax/rdl/rule-definition/sharding/drop-sharding-table-reference-rule.en.md
@@ -13,9 +13,12 @@ The `DROP SHARDING TABLE REFERENCE RULE` syntax is used to
drop specified shardi
{{% tab name="Grammar" %}}
```sql
DropShardingTableReferenceRule ::=
- 'DROP' 'SHARDING' 'TABLE' 'REFERENCE' 'RULE' ruleName (',' ruleName)*
+ 'DROP' 'SHARDING' 'TABLE' 'REFERENCE' 'RULE' ifExists?
shardingReferenceRuleName (',' shardingReferenceRuleName)*
-ruleName ::=
+ifExists ::=
+ 'IF' 'EXISTS'
+
+shardingReferenceRuleName ::=
identifier
```
{{% /tab %}}
@@ -24,6 +27,9 @@ ruleName ::=
{{% /tab %}}
{{< /tabs >}}
+### Supplement
+
+- `ifExists` clause is used for avoid `Sharding reference rule not exists`
error.
### Example
- Drop a specified sharding table reference rule
@@ -38,6 +44,12 @@ DROP SHARDING TABLE REFERENCE RULE ref_0;
DROP SHARDING TABLE REFERENCE RULE ref_0, ref_1;
```
+- Drop sharding table reference rule with `ifExists` clause
+
+```sql
+DROP SHARDING TABLE REFERENCE RULE IF EXISTS ref_0;
+```
+
### Reserved word
`DROP`, `SHARDING`, `TABLE`, `REFERENCE`, `RULE`
diff --git
a/docs/document/content/user-manual/shardingsphere-proxy/distsql/syntax/rdl/rule-definition/sharding/drop-sharding-table-rule.cn.md
b/docs/document/content/user-manual/shardingsphere-proxy/distsql/syntax/rdl/rule-definition/sharding/drop-sharding-table-rule.cn.md
index 23a049b9959..24ddbae6d9a 100644
---
a/docs/document/content/user-manual/shardingsphere-proxy/distsql/syntax/rdl/rule-definition/sharding/drop-sharding-table-rule.cn.md
+++
b/docs/document/content/user-manual/shardingsphere-proxy/distsql/syntax/rdl/rule-definition/sharding/drop-sharding-table-rule.cn.md
@@ -13,7 +13,10 @@ weight = 4
{{% tab name="语法" %}}
```sql
DropShardingTableRule ::=
- 'DROP' 'SHARDING' 'TABLE' 'RULE' shardingRuleName (',' shardingRuleName)*
('FROM' databaseName)?
+ 'DROP' 'SHARDING' 'TABLE' 'RULE' ifExists? shardingRuleName (','
shardingRuleName)* ('FROM' databaseName)?
+
+ifExists ::=
+ 'IF' 'EXISTS'
shardingRuleName ::=
identifier
@@ -29,7 +32,8 @@ databaseName ::=
### 补充说明
-- 未指定 `databaseName` 时,默认是当前使用的 `DATABASE`。 如果也未使用 `DATABASE` 则会提示 `No
database selected`。
+- 未指定 `databaseName` 时,默认是当前使用的 `DATABASE`。 如果也未使用 `DATABASE` 则会提示 `No
database selected`;
+- `ifExists` 子句用于避免 `Sharding rule not exists` 错误。
### 示例
@@ -45,6 +49,12 @@ DROP SHARDING TABLE RULE t_order, t_order_item FROM
sharding_db;
DROP SHARDING TABLE RULE t_order;
```
+- 使用 `ifExists` 子句删除分片规则
+
+```sql
+DROP SHARDING TABLE RULE IF EXISTS t_order;
+```
+
### 保留字
`DROP`、`SHARDING`、`TABLE`、`RULE`、`FROM`
diff --git
a/docs/document/content/user-manual/shardingsphere-proxy/distsql/syntax/rdl/rule-definition/sharding/drop-sharding-table-rule.en.md
b/docs/document/content/user-manual/shardingsphere-proxy/distsql/syntax/rdl/rule-definition/sharding/drop-sharding-table-rule.en.md
index 36e2ba32147..5a080327291 100644
---
a/docs/document/content/user-manual/shardingsphere-proxy/distsql/syntax/rdl/rule-definition/sharding/drop-sharding-table-rule.en.md
+++
b/docs/document/content/user-manual/shardingsphere-proxy/distsql/syntax/rdl/rule-definition/sharding/drop-sharding-table-rule.en.md
@@ -13,7 +13,10 @@ The `DROP SHARDING TABLE RULE` syntax is used to drop
sharding table rule for sp
{{% tab name="Grammar" %}}
```sql
DropShardingTableRule ::=
- 'DROP' 'SHARDING' 'TABLE' 'RULE' shardingRuleName (',' shardingRuleName)*
('FROM' databaseName)?
+ 'DROP' 'SHARDING' 'TABLE' 'RULE' ifExists? shardingRuleName (','
shardingRuleName)* ('FROM' databaseName)?
+
+ifExists ::=
+ 'IF' 'EXISTS'
shardingRuleName ::=
identifier
@@ -29,22 +32,29 @@ databaseName ::=
### Supplement
-- When `databaseName` is not specified, the default is the currently used
`DATABASE`. If `DATABASE` is not used, `No database selected` will be prompted.
+- When `databaseName` is not specified, the default is the currently used
`DATABASE`. If `DATABASE` is not used, `No database selected` will be prompted;
+- `ifExists` clause is used to avoid `Sharding rule not exists` error.
### Example
-- Drop mutiple sharding table rules for specified database.
+- Drop mutiple sharding table rules for specified database
```sql
DROP SHARDING TABLE RULE t_order, t_order_item FROM sharding_db;
```
-- Drop a sharding table rule for current database.
+- Drop a sharding table rule for current database
```sql
DROP SHARDING TABLE RULE t_order;
```
+- Drop sharding table rule with `ifExists` clause
+
+```sql
+DROP SHARDING TABLE RULE IF EXISTS t_order;
+```
+
### Reserved word
`DROP`, `SHARDING`, `TABLE`, `RULE`, `FROM`
diff --git
a/docs/document/content/user-manual/shardingsphere-proxy/distsql/syntax/rdl/storage-unit-definition/unregister-storage-unit.cn.md
b/docs/document/content/user-manual/shardingsphere-proxy/distsql/syntax/rdl/storage-unit-definition/unregister-storage-unit.cn.md
index d7411825b6b..70d7448b60a 100644
---
a/docs/document/content/user-manual/shardingsphere-proxy/distsql/syntax/rdl/storage-unit-definition/unregister-storage-unit.cn.md
+++
b/docs/document/content/user-manual/shardingsphere-proxy/distsql/syntax/rdl/storage-unit-definition/unregister-storage-unit.cn.md
@@ -13,7 +13,10 @@ weight = 4
{{% tab name="语法" %}}
```sql
UnregisterStorageUnit ::=
- 'UNREGISTER' 'STORAGE' 'UNIT' ('IF' 'EXISTS')? storageUnitName (','
storageUnitName)* ('IGNORE' 'SINGLE' 'TABLES')?
+ 'UNREGISTER' 'STORAGE' 'UNIT' ifExists? storageUnitName (','
storageUnitName)* ('IGNORE' 'SINGLE' 'TABLES')?
+
+ifExists ::=
+ 'IF' 'EXISTS'
storageUnitName ::=
identifier
@@ -28,7 +31,8 @@ storageUnitName ::=
- `UNREGISTER STORAGE UNIT` 只会移除 Proxy 中的存储单元,不会删除与存储单元对应的真实数据源;
- 无法移除已经被规则使用的存储单元。移除被规则使用的存储单元时会提示 `Storage unit are still in used`;
-- 将要移除的存储单元中仅包含 `SINGLE TABLE RULE`,且用户确认可以忽略该限制时,可添加 `IGNORE SINGLE TABLES`
关键字移除存储单元。
+- 将要移除的存储单元中仅包含 `SINGLE TABLE RULE`,且用户确认可以忽略该限制时,可添加 `IGNORE SINGLE TABLES`
关键字移除存储单元;
+- `ifExists` 子句用于避免 `Storage unit not exists` 错误。
### 示例
@@ -50,7 +54,7 @@ UNREGISTER STORAGE UNIT ds_0, ds_1;
UNREGISTER STORAGE UNIT ds_0 IGNORE SINGLE TABLES;
```
-- 如果存储单元存在则移除
+- 使用 `ifExists` 子句移除存储单元
```sql
UNREGISTER STORAGE UNIT IF EXISTS ds_0;
diff --git
a/docs/document/content/user-manual/shardingsphere-proxy/distsql/syntax/rdl/storage-unit-definition/unregister-storage-unit.en.md
b/docs/document/content/user-manual/shardingsphere-proxy/distsql/syntax/rdl/storage-unit-definition/unregister-storage-unit.en.md
index 1088d50c678..ee9ee97f14c 100644
---
a/docs/document/content/user-manual/shardingsphere-proxy/distsql/syntax/rdl/storage-unit-definition/unregister-storage-unit.en.md
+++
b/docs/document/content/user-manual/shardingsphere-proxy/distsql/syntax/rdl/storage-unit-definition/unregister-storage-unit.en.md
@@ -13,7 +13,10 @@ The `UNREGISTER STORAGE UNIT` syntax is used to unregister
storage unit from the
{{% tab name="Grammar" %}}
```sql
UnregisterStorageUnit ::=
- 'UNREGISTER' 'STORAGE' 'UNIT' ('IF' 'EXISTS')? storageUnitName (','
storageUnitName)* ('IGNORE' 'SINGLE' 'TABLES')?
+ 'UNREGISTER' 'STORAGE' 'UNIT' ifExists? storageUnitName (','
storageUnitName)* ('IGNORE' 'SINGLE' 'TABLES')?
+
+ifExists ::=
+ 'IF' 'EXISTS'
storageUnitName ::=
identifier
@@ -31,7 +34,8 @@ storageUnitName ::=
- Unable to unregister storage unit already used by rules. `Storage unit are
still in used.` will be prompted when removing
storage units used by rules;
- The storage unit need to be removed only contains `SINGLE TABLE RULE`, and
when the user confirms that this restriction
- can be ignored, the `IGNORE SINGLE TABLES` keyword can be added to remove
the storage unit.
+ can be ignored, the `IGNORE SINGLE TABLES` keyword can be added to remove
the storage unit;
+- `ifExists` clause is used for avoid `Storage unit not exists` error.
### Example
@@ -53,7 +57,7 @@ UNREGISTER STORAGE UNIT ds_0, ds_1;
UNREGISTER STORAGE UNIT ds_0 IGNORE SINGLE TABLES;
```
-- Drop the storage unit if it exists
+- Drop the storage unit with `ifExists` clause
```sql
UNREGISTER STORAGE UNIT IF EXISTS ds_0;