зеркало из https://github.com/github/vitess-gh.git
fix: added null safe operator precendence rule (#12306)
Signed-off-by: Harshit Gangal <harshit@planetscale.com> Co-authored-by: Harshit Gangal <harshit@planetscale.com>
This commit is contained in:
Родитель
ad802f0d11
Коммит
358b68929d
|
@ -59,7 +59,7 @@ func precedenceFor(in Expr) Precendence {
|
|||
return P12
|
||||
case *ComparisonExpr:
|
||||
switch node.Operator {
|
||||
case EqualOp, NotEqualOp, GreaterThanOp, GreaterEqualOp, LessThanOp, LessEqualOp, LikeOp, InOp, RegexpOp:
|
||||
case EqualOp, NotEqualOp, GreaterThanOp, GreaterEqualOp, LessThanOp, LessEqualOp, LikeOp, InOp, RegexpOp, NullSafeEqualOp:
|
||||
return P11
|
||||
}
|
||||
case *IsExpr:
|
||||
|
|
|
@ -198,6 +198,7 @@ func TestParens(t *testing.T) {
|
|||
{in: "10 - 2 - 1", expected: "10 - 2 - 1"},
|
||||
{in: "(10 - 2) - 1", expected: "10 - 2 - 1"},
|
||||
{in: "10 - (2 - 1)", expected: "10 - (2 - 1)"},
|
||||
{in: "0 <=> (1 and 0)", expected: "0 <=> (1 and 0)"},
|
||||
}
|
||||
|
||||
for _, tc := range tests {
|
||||
|
|
Загрузка…
Ссылка в новой задаче