metabase / metabase/metabase

Metabase incorrectly parses user-defined data type aliases, uses alias name instead of underlying type

Open
#62,335 12 comments 0 reactions 0 assignees View on GitHub
.Backend .Escalation .Team/Graphy .Triaged Dec 2025 Administration/Metadata & Sync Database/SQLServer Difficulty:Hard Priority:P1 Type:Bug
Dominant language
Clojure
Stars
49.3k
Forks
6.8k
Avg merge
1d 13h
Merged PRs (30d)
653

Description

### Describe the bug

When a user-defined data type alias like `Key10` is used to define `varchar(10)` Metabase parses the data type as `Key10` instead of the underlying data type. This leads to the column being misidentified and limits the available features to the user. e.g. text column cannot be filtered etc.

https://learn.microsoft.com/en-us/sql/relational-databases/databases/create-a-user-defined-data-type-alias?view=sql-server-ver17

Here's an example from a popular ERP system JobBoss. A type definition of `Key10:varchar(10)` is used to define the customer foreign key column.

Image

However, Metabase parses the type definition as `Key10` and only allows casting as temporal values.

Image

And since Metabase cannot determine the type information correctly, other features like filtering in questions and dashboards etc. are also not available to the user either.

Image

### To Reproduce

1. Create a type alias for something like varchar(10).
2. Create a table that uses the type alias.
3. Add the table to Metabase.
4. Check the table metadata.

### Expected behavior

Metabase to use the underlying data type of the type alias.

### Logs

There are no error logs for this issue.

### Information about your Metabase installation

```JSON
{
"browser-info": {
"language": "en-US",
"platform": "Win32",
"userAgent": "Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/139.0.0.0 Safari/537.36",
"vendor": "Google Inc."
},
"metabase-info": {
"databases": [
"sqlserver"
],
"run-mode": "prod",
"plan-alias": "",
"version": {
"date": "2025-08-15",
"tag": "v0.56.2.3",
"hash": "5642e77"
},
"settings": {
"report-timezone": null
},
"hosting-env": "unknown",
"application-database": "postgres",
"application-database-details": {
"database": {
"name": "PostgreSQL",
"version": "15.14 (Debian 15.14-1.pgdg13+1)"
},
"jdbc-driver": {
"name": "PostgreSQL JDBC Driver",
"version": "42.7.7"
}
}
},
"system-info": {
"file.encoding": "UTF-8",
"java.runtime.name": "OpenJDK Runtime Environment",
"java.runtime.version": "21.0.8+9-LTS",
"java.vendor": "Eclipse Adoptium",
"java.vendor.url": "https://adoptium.net/",
"java.version": "21.0.8",
"java.vm.name": "OpenJDK 64-Bit Server VM",
"java.vm.version": "21.0.8+9-LTS",
"os.name": "Linux",
"os.version": "6.1.0-38-amd64",
"user.language": "en",
"user.timezone": "GMT"
}
}
```

### Severity

Medium

### Additional context

Type alias are very common when trying to manage common types like SSN, foreign keys, etc.

Contributor guide

Open the contributing guide

Research direction

Reproduce the issue by creating a SQL Server alias such as Key10 for varchar(10), then adding a table that uses it and checking Metabase table metadata. Trace the metadata parsing path to see where the alias name is retained instead of its underlying type. Done means the column is recognized as varchar and the related filtering and casting features are available.

Written by the indexing model from the issue text.

Assessment

Tech stack
clojure, sql
Domain
databases
Issue type
Bug
Difficulty
4/5
Estimated time
3-5 days
Activity status
Active
Clarity
Mostly clear
Newbie friendliness
48/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.