Skip to content

Commit 89f21d4

Browse files
authored
Fix mysql parse zone unreserved keyword error (#33720)
* Fix mysql parse zone unreversed keyword error * Update release note
1 parent 572bca6 commit 89f21d4

File tree

4 files changed

+13
-0
lines changed

4 files changed

+13
-0
lines changed

RELEASE-NOTES.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -33,6 +33,7 @@
3333
1. Sharding: Fix SQL COUNT with GROUP BY to prevent incorrect row returns - [#33380](https://github.com/apache/shardingsphere/pull/33380)
3434
1. Sharding: Fix avg, sum, min, max function return empty data when no query result return - [#33449](https://github.com/apache/shardingsphere/pull/33449)
3535
1. Encrypt: Fix merge exception without encrypt rule in database - [#33708](https://github.com/apache/shardingsphere/pull/33708)
36+
1. SQL Parser: Fix mysql parse zone unreserved keyword error - [#33720](https://github.com/apache/shardingsphere/pull/33720)
3637

3738
### Change Logs
3839

parser/sql/dialect/mysql/src/main/antlr4/imports/mysql/BaseRule.g4

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -525,6 +525,7 @@ identifierKeywordsUnambiguous
525525
| YEAR_MONTH
526526
| CONDITION
527527
| DESCRIBE
528+
| ZONE
528529
;
529530

530531
identifierKeywordsAmbiguous1RolesAndLabels

test/it/parser/src/main/resources/case/dml/select.xml

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -9624,4 +9624,14 @@
96249624
</expression-projection>
96259625
</projections>
96269626
</select>
9627+
9628+
<select sql-case-id="select_with_zone_keyword">
9629+
<projections start-index="7" stop-index="20">
9630+
<column-projection name="order_id" start-index="7" stop-index="14" />
9631+
<column-projection name="zone" start-index="17" stop-index="20" />
9632+
</projections>
9633+
<from>
9634+
<simple-table name="t_order" start-index="27" stop-index="33" />
9635+
</from>
9636+
</select>
96279637
</sql-parser-test-cases>

test/it/parser/src/main/resources/sql/supported/dml/select.xml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -286,4 +286,5 @@
286286
<sql-case id="select_with_nvl_function_and_interval_hour" value="SELECT * FROM t_order t WHERE t.CREATE_TIME &lt;= nvl(END_TIME, sysdate) - INTERVAL ? HOUR AND t.STATUS = 'FAILURE'" db-types="Oracle"/>
287287
<sql-case id="select_with_not_operator_number" value="SELECT NOT 0, NOT 1, NOT 2" db-types="MySQL" />
288288
<sql-case id="select_with_not_operator_boolean" value="SELECT NOT TRUE, NOT FALSE" db-types="MySQL" />
289+
<sql-case id="select_with_zone_keyword" value="SELECT order_id, zone FROM t_order" db-types="MySQL" />
289290
</sql-cases>

0 commit comments

Comments
 (0)