Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[MySQL] Dbz crashed on parsing MySQL DDL statement including "SELECT 1 + @sum:=1 AS ss;" #3661

Merged
merged 1 commit into from
Aug 13, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 2 additions & 1 deletion sql/mysql/Positive-Technologies/MySqlParser.g4
Original file line number Diff line number Diff line change
Expand Up @@ -2615,8 +2615,8 @@ predicate
| predicate SOUNDS LIKE predicate #soundsLikePredicate
| predicate NOT? LIKE predicate (ESCAPE STRING_LITERAL)? #likePredicate
| predicate NOT? regex=(REGEXP | RLIKE) predicate #regexpPredicate
| (LOCAL_ID VAR_ASSIGN)? expressionAtom #expressionAtomPredicate
| predicate MEMBER OF '(' predicate ')' #jsonMemberOfPredicate
| expressionAtom #expressionAtomPredicate
;


Expand All @@ -2629,6 +2629,7 @@ expressionAtom
| mysqlVariable #mysqlVariableExpressionAtom
| unaryOperator expressionAtom #unaryExpressionAtom
| BINARY expressionAtom #binaryExpressionAtom
| LOCAL_ID VAR_ASSIGN expressionAtom #variableAssignExpressionAtom
| '(' expression (',' expression)* ')' #nestedExpressionAtom
| ROW '(' expression (',' expression)+ ')' #nestedRowExpressionAtom
| EXISTS '(' selectStatement ')' #existsExpressionAtom
Expand Down
14 changes: 13 additions & 1 deletion sql/mysql/Positive-Technologies/examples/dml_select.sql
Original file line number Diff line number Diff line change
Expand Up @@ -232,4 +232,16 @@ SELECT *
NESTED PATH '$.b[*]' COLUMNS (b INT PATH '$')
)
) AS tt;

SELECT !(1 + @sum:=1) AS ss;
SELECT (@sum:=1 + 1) AS ss;
SELECT 1 + @sum:=1 AS ss;
SELECT 100 >> @sum:=1 AS ss;
SELECT @sum:=1 < 100 AS ss;
SELECT 100 and @sum:=1 AS ss;
SELECT
@sum := @sum + column_name AS running_sum
FROM
your_table,
(SELECT @sum := 0) AS init
ORDER BY
some_order_column;
Loading