Skip to content

Parser fails when using alias named "TOP" in SELECT statement #2046

Description

@2010YOUY01

Reproducer: Using datafusion-cli https://github.com/apache/datafusion/tree/main/datafusion-cli compiled from hash 5bbdb7eb1

> WITH t AS (SELECT 1 AS val) SELECT tt.val FROM t AS tt;
+-----+
| val |
+-----+
| 1   |
+-----+
1 row(s) fetched.
Elapsed 0.050 seconds.

> WITH t AS (SELECT 1 AS val) SELECT top.val FROM t AS top;  🤔 Invalid statement: SQL error: ParserError("Expected: literal int, found: . at Line: 1, Column: 39")

Found by SQLStorm apache/datafusion#17698

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Fields

    No fields configured for issues without a type.

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions