Skip to content

Conversation

@askalt
Copy link
Contributor

@askalt askalt commented Jan 21, 2026

Rationale for this change

In our project we support multi-statement SQL with DF statements.

If we use next_token(...) then in the case of multi-statement query it consumes a semicolon token which leads to the parse error on the correct queries like:

CREATE EXTERNAL TABLE t1 ...;
CREATE EXTERNAL TABLE t2 ...;

This patch fixes this behavior switching next_token(...) to peek_token(...) to test on EOF.

Are these changes tested?

There is a unit test covering multi-statement SQL.

@github-actions github-actions bot added the sql SQL Planner label Jan 21, 2026
If we use `next_token(...)` then in the case of multi-statement query
it consumes a semicolon token which leads to the parse error on the
correct queries like:

```sql
CREATE EXTERNAL TABLE t1 ...;
CREATE EXTERNAL TABLE t2 ...;
```
@askalt askalt force-pushed the askalt/use-pick-in-parser branch from ef2c3ae to e2a3470 Compare January 23, 2026 08:26
Copy link
Contributor

@alamb alamb left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks @askalt and @martin-g

@Jefffrey Jefffrey added this pull request to the merge queue Jan 24, 2026
Merged via the queue into apache:main with commit 1897924 Jan 24, 2026
28 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

sql SQL Planner

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants