You are viewing a plain text version of this content. The canonical link for it is here.
Posted to notifications@shardingsphere.apache.org by du...@apache.org on 2025/04/08 06:58:35 UTC
(shardingsphere) branch master updated: Support parsing MySQL stored procedure syntax (#35137)
This is an automated email from the ASF dual-hosted git repository.
duanzhengqiang 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 43f20e86bbd Support parsing MySQL stored procedure syntax (#35137)
43f20e86bbd is described below
commit 43f20e86bbde0beadf9fa0cff3c6c3c1a88f9218
Author: Chakkk <ch...@gmail.com>
AuthorDate: Tue Apr 8 14:58:30 2025 +0800
Support parsing MySQL stored procedure syntax (#35137)
* Support parsing MySQL stored procedure syntax
* Update release notes
---
RELEASE-NOTES.md | 1 +
.../mysql/src/main/antlr4/imports/mysql/DCLStatement.g4 | 10 +++++-----
test/it/parser/src/main/resources/case/dcl/revoke.xml | 3 +++
.../src/main/resources/sql/supported/dcl/revoke-user.xml | 3 +++
4 files changed, 12 insertions(+), 5 deletions(-)
diff --git a/RELEASE-NOTES.md b/RELEASE-NOTES.md
index 49f7c9b580a..99e6980626a 100644
--- a/RELEASE-NOTES.md
+++ b/RELEASE-NOTES.md
@@ -31,6 +31,7 @@
1. DistSQL: Add job sharding nodes to the result set of `SHOW MIGRATION LIST` - [#35053](https://github.com/apache/shardingsphere/pull/35053)
1. SQL Parser: Enhance combineType in Oracle to support EXCEPT ALL and INTERSECT ALL - [#35099](https://github.com/apache/shardingsphere/pull/35099)
1. DistSQL: Add InUsedStorageUnitRetriever for single rule - [#35131](https://github.com/apache/shardingsphere/pull/35131)
+1. SQL Parser: Support parsing MySQL stored procedure syntax - [#35137](https://github.com/apache/shardingsphere/pull/35137)
### Bug Fixes
diff --git a/parser/sql/dialect/mysql/src/main/antlr4/imports/mysql/DCLStatement.g4 b/parser/sql/dialect/mysql/src/main/antlr4/imports/mysql/DCLStatement.g4
index eb133d7c021..09572eb543a 100644
--- a/parser/sql/dialect/mysql/src/main/antlr4/imports/mysql/DCLStatement.g4
+++ b/parser/sql/dialect/mysql/src/main/antlr4/imports/mysql/DCLStatement.g4
@@ -27,11 +27,11 @@ grant
;
revoke
- : REVOKE roleOrPrivileges FROM userList # revokeFrom
- | REVOKE roleOrPrivileges ON aclType? grantIdentifier FROM userList # revokeOnFrom
- | REVOKE ALL PRIVILEGES? ON aclType? grantIdentifier FROM userList # revokeOnFrom
- | REVOKE ALL PRIVILEGES? COMMA_ GRANT OPTION FROM userList # revokeFrom
- | REVOKE PROXY ON username FROM userList # revokeOnFrom
+ : REVOKE ifExists? roleOrPrivileges FROM userList # revokeFrom
+ | REVOKE ifExists? roleOrPrivileges ON aclType? grantIdentifier FROM userList # revokeOnFrom
+ | REVOKE ifExists? ALL PRIVILEGES? ON aclType? grantIdentifier FROM userList # revokeOnFrom
+ | REVOKE ifExists? ALL PRIVILEGES? COMMA_ GRANT OPTION FROM userList # revokeFrom
+ | REVOKE ifExists? PROXY ON username FROM userList # revokeOnFrom
;
userList
diff --git a/test/it/parser/src/main/resources/case/dcl/revoke.xml b/test/it/parser/src/main/resources/case/dcl/revoke.xml
index a5969a0dc53..3d430aa2e87 100644
--- a/test/it/parser/src/main/resources/case/dcl/revoke.xml
+++ b/test/it/parser/src/main/resources/case/dcl/revoke.xml
@@ -230,4 +230,7 @@
<revoke sql-case-id="revoke_execute_on_xml_schema_collection" />
<revoke sql-case-id="revoke_usage_on_column_encryption_key" />
<revoke sql-case-id="revoke_usage_on_client_master_key" />
+ <revoke sql-case-id="revoke_alter_execute_on_procedure_from_role" />
+ <revoke sql-case-id="revoke_grant_option_on_procedure_from_user" />
+ <revoke sql-case-id="revoke_alter_execute_on_procedure_from_user" />
</sql-parser-test-cases>
diff --git a/test/it/parser/src/main/resources/sql/supported/dcl/revoke-user.xml b/test/it/parser/src/main/resources/sql/supported/dcl/revoke-user.xml
index 4db968095c4..cf1329dc2c4 100644
--- a/test/it/parser/src/main/resources/sql/supported/dcl/revoke-user.xml
+++ b/test/it/parser/src/main/resources/sql/supported/dcl/revoke-user.xml
@@ -127,4 +127,7 @@
<sql-case id="revoke_execute_on_xml_schema_collection" value="REVOKE EXECUTE ON XML SCHEMA COLLECTION::schema1.xmlschemacollection1 FROM user1" db-types="SQLServer" />
<sql-case id="revoke_usage_on_column_encryption_key" value="REVOKE USAGE ON COLUMN_ENCRYPTION_KEY MyCEK1 FROM user1" db-types="openGauss" />
<sql-case id="revoke_usage_on_client_master_key" value="REVOKE USAGE ON CLIENT_MASTER_KEY MyCMK1 FROM user1" db-types="openGauss" />
+ <sql-case id="revoke_alter_execute_on_procedure_from_role" value="REVOKE IF EXISTS ALTER ROUTINE, EXECUTE ON PROCEDURE rngp_db.rngp_proc FROM rngp_role" db-types="MySQL" />
+ <sql-case id="revoke_grant_option_on_procedure_from_user" value="REVOKE IF EXISTS GRANT OPTION ON PROCEDURE rngp_db.rngp_proc FROM rngp_user" db-types="MySQL" />
+ <sql-case id="revoke_alter_execute_on_procedure_from_user" value="REVOKE IF EXISTS ALTER ROUTINE, EXECUTE ON PROCEDURE rngp_db.rngp_proc FROM rngp_user" db-types="MySQL" />
</sql-cases>