sqlparser icon indicating copy to clipboard operation
sqlparser copied to clipboard

Space Support

Open Colhodm opened this issue 7 years ago • 5 comments

"select 'name 1' from test where names = 'a1' and names ='a3' LIMIT 10"

Column Names with spaces in them are not handled correctly by the parser, rather than being recognized as columns they are parsed as SQL vals and classified as ints. I tried surrounding 'name 1' with double quotes as well and this also did not work. If you could fix this that would be great, as it currently is not compatible with the behavior described for case sensitivity and spaces defined by the Amazon S3 Select API.

Thanks!

Colhodm avatar Jun 13 '18 22:06 Colhodm

Also another error is that your parser is flagging a syntax error on this expression: "select * from S3Object where cast(age AS int) > 12" at the character after int even though this is a perfectly valid query. Thanks! Arjun

Colhodm avatar Jun 13 '18 23:06 Colhodm

This is a mysql parser, and in that the syntax to escape column names is to use backticks. Please try name 1.

bramp avatar Jun 13 '18 23:06 bramp

Hi, awesome that works for escaping spaces in column names.

The issue with the query: select * from S3Object where cast(age AS int) > 12 still stands, even if I try age instead of age. This is a valid SQL query as demonstrated here: https://aws.amazon.com/blogs/developer/introducing-support-for-amazon-s3-select-in-the-aws-sdk-for-ruby/ Another question/issue I had is does your parser support case sensitivity as shown/described in this amazon example: https://docs.aws.amazon.com/AmazonS3/latest/dev/s3-glacier-select-sql-reference-select.html. Thanks so much!

Colhodm avatar Jun 14 '18 19:06 Colhodm

Yes, I'll look into that other query.

As for case sensitivity, take a look at https://dev.mysql.com/doc/refman/8.0/en/identifier-case-sensitivity.html as it describes the rules for MySQL.

bramp avatar Jun 15 '18 03:06 bramp

Hi, so I read through that doc, and I understand the general approach and rules for MySQL, but as for your actual built parser, is there anyway to specify case sensitivity for column names or do you not support this, e.g I have two columns "weight" and "Weight", and I use some type of escape character to show that I want it to be case sensitive, as Amazon shows in their Select S3 API here: https://docs.aws.amazon.com/AmazonS3/latest/dev/s3-glacier-select-sql-reference-select.html. Sorry if I'm being redundant, I'm just not sure I see the relationship of how the file system being case sensitive relates to your parser. E.g if your parser was on linux, shouldnt it support case sensitivity. Sorry If I was unclear, or a little obtuse! Thanks for all the help! Arjun!

Colhodm avatar Jun 16 '18 00:06 Colhodm