Skip to content

Trino: CTE User-Defined Function Parse Error #5178

Description

@Jared314

We are using a CTE UDF in a complex Trino query. Parsing that CTE UDF with SQLGlot (26.25.3) results in a ParseError exception. A normal UDF and a normal CTE query parses as expected.

WITH FUNCTION f(num int)
    RETURNS int
    RETURN num
SELECT f(1);

sqlglot.parse_one(sql, dialect="trino")

sqlglot.errors.ParseError: Expecting (. Line 1, Col: 15.
  WITH FUNCTION f(num int)
    RETURNS int
    RETURN num
SELECT f(1);

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions