metabase / metabase/metabase

Breakout on a joined model shows the wrong column - specifc after changes to the model definition and similar field names

Open
#66,843 9 comments 0 reactions 0 assignees View on GitHub
.Backend .Correctness .Escalation .Frontend .Has Repro Steps .Team/Graphy .Triaged Dec 2025 Difficulty:Hard Priority:P1 Querying/MBQL Querying/Models Type:Bug
Dominant language
Clojure
Stars
49.3k
Forks
6.8k
Avg merge
1d 13h
Merged PRs (30d)
653

Description

### Describe the bug

Choosing implicitly joined columns with the same names as the ones that exist in the initial model brings incorrect fields to the summarization.

Don't know if this happens for all fields or only keys.

In a customer scenario, a model has subsequent and placed next to each other "name" fields (thus they are named as follows: `52: "name", 53: "name_2", 54: "name_3"`). Name_2 is the one being brought in the question instead of a field from a table in a question being joined to the model, which is incorrect.

### To Reproduce

1. Create a model joining Accounts + Analytics Events + Invoices from the Sample database
2. Do a count by the IDs from the model and the IDs from the implicitly joined tables
3. See that the fields being brought are incorrect for the implicitly joined tables
Image

### Expected behavior
Should bring the correct breakout

### Logs

_No response_

### Information about your Metabase installation

```JSON
-v1.57.4
```

### Severity
p1

Contributor guide

Open the contributing guide

Research direction

Reproduce the issue by creating the Accounts + Analytics Events + Invoices model in the Sample database and comparing breakouts from the model with those from implicitly joined tables. Trace how similarly named fields such as name, name_2, and name_3 are resolved; done means each breakout selects the correct source column.

Written by the indexing model from the issue text.

Assessment

Tech stack
clojure
Domain
backend, data, databases
Issue type
Bug
Difficulty
4/5
Estimated time
3-5 days
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
42/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.