Skip to content

weird parse involving identifiers with backticks and dots #246

@humanchimp

Description

@humanchimp

I'm seeing a weird parse for the below filterQL input. The trivial AND is needed for the minimal repro. (Without the AND, the statement cannot be parsed, but more on that below)

FILTER AND ( EXISTS `foo`.bar ) FROM user

I'm seeing the nonsensical parse:

FILTER AND ( EXISTS `foo`, `.bar` ) FROM user

I noticed this while i was fuzzing my own filterQL parser which gives the AST:

{
  "op": "and",
  "args": [
    {
      "op": "exists",
      "args": [
        {
          "ident": "foo.bar"
        }
      ]
    }
  ]
}

I think this parse is correct for this admittedly weird input. I don't have a code generator yet, but if I did, from this AST, it would emit:

FILTER AND ( EXISTS foo.bar ) FROM user

Which just removes the unneeded backticks from the input (my parser loses that information, but my hypothetical code generator could insert them where they are necessary; here they are not).

Relatedly, without the seemingly redundant AND, this cannot be parsed, but it seems like it should be parseable, from what I can glean, looking at the grammar.

FILTER EXISTS `foo`.bar FROM user

For this statement, my parser emits the AST I expect:

{
  "op": "exists",
  "args": [
    {
      "ident": "foo.bar"
    }
  ]
}

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions