fix: column names at the edges of the column answer

RA
7m ago
+225-14

Issue for this PR

Closes #1753

Type of change

  • Bug fix

What does this PR do?

Follow-up to #1710, from its last review: column names at the edges of impact_analysis's column answer and dbt_lineage.

  • A _N a parent passes on, or that the SQL writes as an alias, stays a column.
  • Only a COLUMNS(...) AS "…" item's own alias is a template.
  • A name repeated beside * doesn't settle.
  • Postgres and Redshift name an unaliased cast after its column, so the trace goes on.
  • DuckDB's repeated outputs get its _1 names.
  • The text line reads "K of them not traced (no sign either way)".

Nothing is reported unaffected, as before.

How did you verify your code works?

Each shape has a test that fails on main. The demo project's answer is unchanged: 11 carry it, 28 may carry it, of 39.

Cost side effects

None (local manifest only).

Checklist

  • I have tested my changes locally
  • I have not included unrelated changes in this PR
  • I checked for cost side effects (model calls, queries or cloud resources that grow with user data) and described them, or wrote "none"

🤖 Generated with Claude Code

https://claude.ai/code/session_01VEmKQwEiHMwQ7BdwgPo9sb


Summary by cubic

Fixes how the column answer identifies column names at its edges so tracing follows real columns instead of dropping them or following engine-generated placeholder names. Closes #1753.

  • A _N a parent passes on, or the SQL writes as an alias, stays a column; only a COLUMNS(...) AS "…" item's own alias is treated as a template.
  • A name repeated beside a bare * no longer settles as a column of the model.
  • Postgres and Redshift name an unaliased cast after its column, so a cast of a real column traces through, and DuckDB's repeated outputs get their _1 names.
  • The summary text now reads "not traced (no sign either way)" for models with no trace either way.

Summary by CodeRabbit

  • Bug Fixes
    • Improved column lineage results for repeated output names, aliases, wildcard selections, and casts across supported database engines.
    • Corrected handling of columns passed through from parent models, helping preserve accurate tracing when names overlap.
    • Clarified the description of models with no tracing information: “not traced (no sign either way).”