Azurite icon indicating copy to clipboard operation
Azurite copied to clipboard

Azurite is more lenient than TableStorage when parsing a query

Open JimWolff opened this issue 1 year ago • 1 comments

Recently had an error in a non-dev environment because of the differences in how Azurite and actual table storage interprets a query.

I accidentally wrote Or instead of or in my query and azurite was fine with that, things worked, but when it was run on table storage it gave me a syntax error because the or has to be lowercase.

Azurite is probably more lenient because of some of the toLowerCase code found in QueryParser.ts

  private visitOr(): IQueryNode {
    const left = this.visitAnd();

    if (this.tokens.next(t => t.kind === "logic-operator" && t.value?.toLowerCase() === "or")) {
      const right = this.visitOr();

      return new OrNode(left, right);
    } else {
      return left;
    }
  }

Not sure where in the priority the consistency beween azurite and tablestorage in production are, since they are inherently very different technologies. Just wanted to let you know, if it was helpful, since it had me wondering for quite a while.

JimWolff avatar Dec 03 '24 13:12 JimWolff

Hi @JimWolff ,

Thanks for reporting this to us.

Seems you already find the root cause. Azurite welcome contribution. If you'd like to help, you can raise a PR to fix it. It'd be even greater if you can help to take a look at other operator key words like: "AND", "NOT" and comparison operators like: "EQ", "LE", etc.

I can also take care of this later, only it may not be in our priority for now.

Thanks Emma

EmmaZhu avatar Dec 04 '24 02:12 EmmaZhu