[Model] Bad field name used when filtering

Describe the bug
When you edit model metadata linking a field to a table column, it's the name of the table column that is used in queries (on filters for example)

To Reproduce

  1. Native > Sample > select name, category as "category_name" from products
  2. Save question and turn it into Model as "M1"
  3. Edit Metadata and map the column category_name to Products.category

  1. Ask a question based on "M1" : Filter on column "category_name"

You will have this error


"browser-info": {
"language": "fr-FR",
"platform": "Win32",
"userAgent": "Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/ Safari/537.36",
"vendor": "Google Inc."
"system-info": {
"file.encoding": "UTF-8",
"java.runtime.name": "OpenJDK Runtime Environment",
"java.runtime.version": "11.0.11+9",
"java.vendor": "AdoptOpenJDK",
"java.vendor.url": "https://adoptopenjdk.net/",
"java.version": "11.0.11",
"java.vm.name": "OpenJDK 64-Bit Server VM",
"java.vm.version": "11.0.11+9",
"os.name": "Linux",
"os.version": "4.19.0-13-cloud-amd64",
"user.language": "fr",
"user.timezone": "Europe/Paris"
"metabase-info": {
"databases": [
"hosting-env": "unknown",
"application-database": "postgres",
"application-database-details": {
"database": {
"name": "PostgreSQL",
"version": "13.6 (Debian 13.6-1.pgdg100+1)"
"jdbc-driver": {
"name": "PostgreSQL JDBC Driver",
"version": "42.3.5"
"run-mode": "prod",
"version": {
"date": "2022-08-04",
"tag": "v1.44.0",
"branch": "release-x.44.x",
"hash": "d3700f5"
"settings": {
"report-timezone": null

Hi @bilpostman
Sounds like you are seeing this issue:
https://github.com/metabase/metabase/issues/22715 - upvote by clicking :+1: on the first post
If you are a Pro/Enterprise customer, then please use the support email.

Hi @flamber
Yes it's the same issue.
Is a fix planned? Because I see that the bug has not received many votes.
My company plans to subscribe to metabase Pro, and the "model" functionality is very important (decoupling between questions and db schema).


@bilpostman There's work being done trying to fix the issue (see the bottom). It's not simple.
Contact sales if you are interested in Pro. If you already have a trial, then contact support.
We cannot prioritize customer issues based on posts in the forum.

1 Like