Cosmonaut icon indicating copy to clipboard operation
Cosmonaut copied to clipboard

Raw SQL Identifier Match doesn't work with multiple spaces

Open tidusjar opened this issue 6 years ago • 3 comments

When attempting to use the Raw SQL for the following query: select * from c order by c.id asc it does not match on the c identifier because there is a double space between the identifier and the operation (order). It seems that Github truncates the double space, but if you edit this post you can see there is a double space.

Now this is a bit of an edge case, but I found this as I was dynamically generating my order clauses and it happened to have an extra space. Ideally spacing between keywords shouldn't matter in the library since it doesn't matter to the underlying data provider.

There are the regular expressions I am referring to: https://github.com/Elfocrash/Cosmonaut/blob/develop/src/Cosmonaut/Extensions/CosmosSqlQueryExtensions.cs#L14

tidusjar avatar Jul 24 '19 13:07 tidusjar

Does the underlying sdk allow multiple spaces??

Elfocrash avatar Jul 24 '19 13:07 Elfocrash

I'm not sure about the underlying sdk, but querying via Azure Portal seems to allow this.

This is not really a big issue, since I've now fixed my issue to not provide any extra spaces (for the better). But I was not expecting this behavior :smile:

EDIT: Also Azure Storage Explorer also allows this

tidusjar avatar Jul 24 '19 13:07 tidusjar

I would check how the underlying sdk reacts. It would be too tricky to write the regex for that if it’s not supported. I might pull the sql validation out of the CosmosDB sdk. I don’t consider this high priority.

Elfocrash avatar Jul 24 '19 14:07 Elfocrash