Skip to content

DuckDB: f(a == b) is displayed as f(a = b), which reparses as a named argument #2808

Open

Description

@alpaylan

== is parsed as BinaryOperator::Eq and displayed as =. Inside a function call with DuckDbDialect, a = b is a named argument (supports_named_fn_args_with_eq_operator, #1182), so the output means something else:

SELECT coalesce(a == b) FROM t
  -> AST arg: Unnamed(BinaryOp { a Eq b })
  -> displays as: SELECT coalesce(a = b) FROM t
  -> reparse arg: Named { name: a, arg: b, operator: Equals }
SELECT a == b FROM t
  -> displays as SELECT a = b FROM t, same AST (fine)

DuckDB documents = and == as equal (https://duckdb.org/docs/stable/sql/expressions/comparison_operators) and evaluates coalesce(a == b) as a comparison. This may count as accepted normalisation; the only effect is the AST change inside call arguments.

Tested on main ce12f1f (also 0.63.0 and 0.58.0).

Found with a property-based fuzzer (round trip check); I used AI assistance for triage and verified every case above.

Activity

  1. added
    Prolific Authorauthor opened PRs or issues in more than 20 repositories in the last 30 days
    on Nov 2, 2026
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

    DuckDBProlific Authorauthor opened PRs or issues in more than 20 repositories in the last 30 days

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions