This repository was archived by the owner on Jul 15, 2021. It is now read-only.
This repository was archived by the owner on Jul 15, 2021. It is now read-only.
Incorrect AST when using "LIKE" expression #47
Open
Description
When parsing a query like:
SELECT *
FROM Bees b
WHERE wings LIKE '1' AND limbs = 'blah'
The AST generated is incorrect.
{
"type": "statement",
"variant": "list",
"statement": [
{
"type": "statement",
"variant": "select",
"result": [
{
"type": "identifier",
"variant": "star",
"name": "*"
}
],
"from": {
"type": "identifier",
"variant": "table",
"name": "bees",
"alias": "b"
},
"where": [
{
"type": "expression",
"format": "binary",
"variant": "operation",
"operation": "like",
"right": {
"type": "expression",
"format": "binary",
"variant": "operation",
"operation": "and",
"left": {
"type": "literal",
"variant": "text",
"value": "1"
},
"right": {
"type": "expression",
"format": "binary",
"variant": "operation",
"operation": "=",
"left": {
"type": "identifier",
"variant": "column",
"name": "limbs"
},
"right": {
"type": "literal",
"variant": "text",
"value": "blah"
}
}
},
"left": {
"type": "identifier",
"variant": "column",
"name": "wings"
}
}
]
}
]
}
In the where clause, the LIKE
node is the root node. However AND
node should be the root node.