dolthub / dolthub/dolt

`AS OF` won't parse without a `FROM` clause.

Open
#8,873 3 comments 0 reactions 1 assignee Claimed by @zachmu View on GitHub
parser sql
Dominant language
Go
Stars
24.4k
Forks
873
Avg merge
1d 5h
Merged PRs (30d)
108

Description

The following is a completely valid way to get the hash of a table on a chosen branch:

`SELECT DOLT_HASHOF_TABLE('table') AS OF main`

However, this fails to parse with the error message:

```
syntax error at position 36 near 'of'
select DOLT_HASHOF_TABLE('t') as of HEAD
```

However, `SELECT DOLT_HASHOF_TABLE('table') FROM table AS OF main` is accepted, despite the fact that table is not actually used in the query. Curiously, `SELECT DOLT_HASHOF_TABLE('table') FROM dual AS OF main` is also rejected.

This is likely a parsing issue in Vitess, where the grammar only matches an `AS OF` clause in the presence of a `FROM` clause. (And `AS OF dual` is handled specially.)

Contributor guide

No contributing guide indexed for this repository

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.