Skip to content

MATERIALIZED causes Binder Error: table has duplicate column name #10260

@tanner-lai

Description

@tanner-lai

What happens?

An unexpected error occurs when a CTE is MATERIALIZED: Error: Binder Error: table "CTE" has duplicate column name "A1"

To Reproduce

CREATE TABLE T0(C1 INT);
CREATE TABLE T1(C1 INT);

INSERT INTO T0(C1) VALUES (1);
INSERT INTO T1(C1) VALUES (1);
-- no problem
WITH CTE AS (
SELECT A1, * FROM T0
  LEFT JOIN (
    SELECT C1 AS A1 FROM T1
  ) ON T0.C1 = A1
) SELECT A1 FROM CTE;
-- binder error
WITH CTE AS MATERIALIZED (
SELECT A1, * FROM T0
  LEFT JOIN (
    SELECT C1 AS A1 FROM T1
  ) ON T0.C1 = A1
) SELECT A1 FROM CTE;

OS:

macOS 14.2.1 (23C71)

DuckDB Version:

v0.9.2

DuckDB Client:

CLI

Full Name:

Tanner Lai

Affiliation:

Appian

Have you tried this on the latest main branch?

I have tested with a release build (and could not test with a main build)

Have you tried the steps to reproduce? Do they include all relevant data and configuration? Does the issue you report still appear there?

  • Yes, I have

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions