sql-parser
sql-parser copied to clipboard
"enclosed by" is not recognized by the SQL parser
Describe the bug
"enclosed by" is not recognized by the SQL parser
To Reproduce
Steps to reproduce the behavior:
- Go to SQL window
- Type for example:
SELECT a
into outfile '/tmp/temp.data'
fields terminated by ',' enclosed by '"'
FROM sometable
- no need to run it (but when you run it against an actual table, it works just fine on the MySQL server)
- See error
Expected behavior
No error (no red cross at the left side)
Observed behaviour
Red cross at the left + these messages:
- Unrecognised keyword. (near enclosed by)
- Unexpected token. (near '"')
@williamdes @svaningelgem I think this issue should be added in sql-parser repository as this issue is with the parser. The solution is adding parsing for these unimplemented options. Should I work on this one?
cc @devenbansod ?
I agree, moving to sql-parser repository.
You may work on it if you'd like.
@svaningelgem thank you for the report.
echo "SELECT a into outfile '/tmp/temp.data' fields terminated by ',' enclosed by '\"' FROM sometable" | ./bin/lint-query
#1: Unrecognized keyword. (near "enclosed by" at position 65)
#2: Unexpected token. (near "'"'" at position 77)
Okay, the bug in the code is about the casing of fields, use uppercase and it will be happy