-
Notifications
You must be signed in to change notification settings - Fork 625
Closed
Description
It took me a while to come up with this example, and it's not totally realistic, but it's probably still worth fixing. Basically, the precedence of NOT LIKE
is mishandled, because the precedence of NOT
is fixed to its unary operator precedence, when in it needs to vary based on whether the NOT keyword is followed by LIKE/BETWEEN/IN/.
Concretely, SELECT a LIKE b IS NULL
parses correctly, with the LIKE binding more tightly than the IS NULL:
SQLIsNull(
SQLBinaryExpr {
left: SQLIdentifier(
"a"
),
op: Like,
right: SQLIdentifier(
"b"
)
}
)
But when NOT LIKE is substituted for LIKE, the IS NULL incorrectly binds more tightly than the NOT LIKE:
SQLBinaryExpr {
left: SQLIdentifier(
"a"
),
op: NotLike,
right: SQLIsNull(
SQLIdentifier(
"b"
)
)
}
Metadata
Metadata
Assignees
Labels
No labels