1
votes

How to perform case sensitive filter On Azure Table storage 2.0 ?

If i do this query
TableQuery.GenerateFilterCondition("ShortUrl", QueryComparisons.Equal, "Abc");

It will returns 2 records with shortUrl "Abc" and "ABC"
The generated query show like this

/devstoreaccount1/Articles?$filter=shortUrl%20eq%20%27Abc%27&timeout=90

There is a solution for version 1.7 shown here , but this is not applicable on version 2.0. I have checked DataService Documentation and it is not mentioned there.

Since Table storage queries based on OData Protocol, why it behaves different when comparing string values. I am sure the Odata "eq" operator is supposed to be case sensitive.
Check OData Api Explorer with this query

http://services.odata.org/V3/OData/OData.svc/Products?$filter= Name eq 'Bread'

Then change it to bread.

1

1 Answers

3
votes

As per documentation here:

All parts of the filter string are case-sensitive.

So I suggest that you try a real table storage, not the Development Storage. If you find this behavior on the real Storage service, please write here again, the team will be alerted!

Also please use the latest SDK/Tools (currently 2.0). If you find this behavior in development storage 2.0, update your question again, this might be a bug in the Development Storage.

But in any case, I suggest that you use real storage account when testing such "sensitive" features. I almost never use Development Storage account.