sql-parser
sql-parser copied to clipboard
Use of certain keywords in SELECT field list
Some queries with keywords in the SELECT field list are marked as invalid by the SQL parser.
Examples:
SELECT NULL IS NULLSELECT NOT 1SELECT 1 BETWEEN 0 AND 2
Wrapping the expression in parentheses avoids the errors, eg. SELECT (NULL IS NULL).
phpMyAdmin version: 4.7.4
Reproduced with current master:
./bin/lint-query --query 'SELECT NULL IS NULL'
#1: Unrecognized keyword. (near "IS" at position 12)
#2: Unrecognized keyword. (near "NULL" at position 15)
./bin/lint-query --query 'SELECT NOT 1'
#1: An expression was expected. (near "NOT" at position 7)
#2: Unrecognized keyword. (near "NOT" at position 7)
#3: Unexpected token. (near "1" at position 11)
./bin/lint-query --query 'SELECT 1 BETWEEN 0 AND 2'
#1: Unrecognized keyword. (near "BETWEEN" at position 9)
#2: Unexpected token. (near "0" at position 17)
#3: Unrecognized keyword. (near "AND" at position 19)
#4: Unexpected token. (near "2" at position 23)
Not sure if those are not three separate issues...