Skip to content

sqlglot OptimizeError "Alias already used" when parsing DuckDB unnest with JSON access #8080

@yan-hic

Description

@yan-hic

Describe the bug

Marimo's SQL static analysis fails on valid DuckDB syntax using unnest with JSON access.

Error:
sqlglot.errors.OptimizeError: Alias already used:

Will you submit a PR?

  • Yes

Environment

Details
Replace this line with the output of marimo env. Leave the backticks in place.

Code to reproduce

import marimo as mo
import duckdb

duckdb.sql("""
    SELECT unnest([1,2,3])->>'$'
    FROM (SELECT 1)
""").fetchall()

-- error can be reproduced in SQL cell too

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugSomething isn't working

    Type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions