sql-parser icon indicating copy to clipboard operation
sql-parser copied to clipboard

"enclosed by" is not recognized by the SQL parser

Open svaningelgem opened this issue 6 years ago • 3 comments

Describe the bug

"enclosed by" is not recognized by the SQL parser

To Reproduce

Steps to reproduce the behavior:

  1. Go to SQL window
  2. Type for example:
SELECT a
into outfile '/tmp/temp.data' 
fields terminated by ',' enclosed by '"'
FROM sometable
  1. no need to run it (but when you run it against an actual table, it works just fine on the MySQL server)
  2. 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 '"')

svaningelgem avatar Mar 20 '19 19:03 svaningelgem

@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?

apoorvkhare07 avatar Mar 22 '19 07:03 apoorvkhare07

cc @devenbansod ?

williamdes avatar Mar 22 '19 16:03 williamdes

I agree, moving to sql-parser repository.

You may work on it if you'd like.

@svaningelgem thank you for the report.

ibennetch avatar Mar 30 '19 17:03 ibennetch

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)

williamdes avatar Apr 21 '23 20:04 williamdes

Okay, the bug in the code is about the casing of fields, use uppercase and it will be happy

williamdes avatar Apr 21 '23 22:04 williamdes