Skip to content

[BUG]: column answer misreads names written outside a SELECT list, and repeats beside a qualified star #1850

In review

Description

@ralphstodomingo

Description

Follow-ups from the reviews of #1754 and #1760: impact_analysis's column answer and dbt_lineage misread a few names. Nothing is reported unaffected; these are wrong or missing names and one "has no column" error.

  • A _N or _col_N written anywhere in the SQL counts as an alias. So a table alias _1 (select _1.order_id, _1.amount * 2 from orders _1) keeps the engine's fake _1, and dbt_lineage for a select * child lists a _1 column no warehouse makes.
  • On Postgres and Redshift, a _col_1 table alias or WHERE column stops an unaliased cast from taking its column's name, so the trace stops at _col_1.
  • On DuckDB, a repeat beside a qualified or CTE-wrapped star (select f.*, val as id from f f, with q as (select *, val as id from f) select * from q) leaves the model settled, so id_1 throws "has no column".
  • dbt_lineage shows a model's own unaliased cast under the engine's _col_N label, while the column answer names it after the column.

Plugins

None needed; the CLI (altimate tool run impact_analysis, column_reach and dbt_lineage).

OpenCode version

v0.12.12 (main).

Steps to reproduce

  1. DuckDB: f = select 1 as id, 2 as val, documenting id, val; r = select f.*, val as id from f f; child = select id_1 as x from r.
  2. Run column_reach or column_answer for r.id_1: it throws "r has no column id_1; its columns are id, val".
  3. The other shapes above reproduce the same way, each with its one-line model.

Screenshot and/or share link

No response

Operating System

Any

Terminal

Any

Activity

  1. added
    bug
    on Nov 27, 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

    bug

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions