cosmosdb-server icon indicating copy to clipboard operation
cosmosdb-server copied to clipboard

Query triggers `Unexpected token '.'`

Open pvdz opened this issue 4 years ago • 2 comments

Looks like an internal error on the following query (went sent raw, untransformed):

SELECT
  COUNT(1)
FROM (
  SELECT
    c.name
  FROM c
  WHERE
    c.name = 'READY'
) AS c

pvdz avatar Aug 25 '21 13:08 pvdz

Its worth noting that non-correlated sub queries are not supported in Cosmos https://docs.microsoft.com/en-us/azure/cosmos-db/sql/sql-query-subquery. These queries will return results, but if the sub query is cross partition or paginated the results will be incorrect

southpolesteve avatar Aug 25 '21 16:08 southpolesteve

Good to know. To be fair, I was trying to craft a query that would expose a problem in a different library when I noticed that particular error message.

My suggestion is to catch it properly and return a semantic error for it. But if you're considering this out of scope because the query itself happens to be garbage then by all means just close the issue :)

pvdz avatar Aug 25 '21 17:08 pvdz