Skip to content

[Bug]: Support ALTER VIEW ... REFRESH syntax added in Trino 477 #493

Description

@glebcha

Version

v4.5.1

Which SQL?

Trino

What happened?

Currently, the Trino SQL parser implementation in this repository is based on an older version of Trino SQL grammar. As specified in the grammar file comment:

* current version 450 (https://github.com/DTStack/dt-sql-parser/blob/main/src/grammar/trino/TrinoSql.g4#L18C4-L18C23)

Because of this, the parser lacks support for several new DDL statements introduced in later versions of Trino. Specifically, trying to validate or parse the ALTER VIEW ... REFRESH statement results in a syntax error.

TrinoSql.g4 grammar can be updated to support the ALTER VIEW view_name REFRESH statement.

According to the official Trino 477 Release Notes:

Proposed Grammar Changes (TrinoSql.g4):

  1. Add a new alternative rule to the statement block:
statement
    : ...
    | KW_ALTER KW_VIEW from=viewRef KW_REFRESH # refreshView
    | ...
    ;

(Alternatively, it can be named alterView if extracted into a separate rule).

  1. Ensure REFRESH is registered as a keyword/lexer token if it's not fully global.

Additional context
This feature is highly required for correct parsing and auto-completion validation when working with Hive or Memory connectors in modern Trino clusters (v477+).

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions