Skip to content

Referencing a column from your SELECT clause, pointing at a non-existent upstream column, causes the wrong error message #10057

@jraede

Description

@jraede

What happens?

Error message is "referenced column not found in FROM clause", but should be "column X does not exist".

To Reproduce

Run the following in any duckdb (I ran it in motherduck)

with test_data as (
  select 'foo' as a
)

select test_data.foobar as new_column from test_data where new_column is not null;

The trick is defining new_column as some sort of reference to a non-existent column in the upstream CTE.

The error message DuckDB returns is "referenced column new_column not found in FROM clause", which is not the case (caused me to pull my hair out wondering about mismatched DuckDB versions and stuff). The actual error is because there is no column named foobar in the test_data CTE.

OS:

Linux x64

DuckDB Version:

0.9.2

DuckDB Client:

Python

Full Name:

Jason Raede

Affiliation:

Pliable

Have you tried this on the latest main branch?

I have tested 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