Skip to content

Feat: Introduce runtime check for identifier limits per engine#4432

Merged
VaggelisD merged 2 commits intomainfrom
vaggelisd/identifier_limit
May 21, 2025
Merged

Feat: Introduce runtime check for identifier limits per engine#4432
VaggelisD merged 2 commits intomainfrom
vaggelisd/identifier_limit

Conversation

@VaggelisD
Copy link
Contributor

@VaggelisD VaggelisD commented May 16, 2025

Fixes #4082

This PR introduces an identifier limit check right before SQL execution in the engine adapter and enables this check for Postgres & MySQL; These 2 dialects are the only ones with <100 char limits afaict, but we can always go ahead and fill in the rest of the engines too.

In my opinion, the main consideration of this PR is to not cause this issue on our end which should mostly happen during physical table creation; This is the reason that we'll walk the AST only if (1) the engine adapter has set its limit and (2) if the expression is a DDL.

We can also enable this check for any query expression but we'll introduce a perf hit; This might help unsuspecting users catch some nasty bugs in their SQL, but I wasn't sure if it's worth the added regression on every expression-based execute call.

The reason MAX_IDENTIFIER_LENGTH is generally set to None is because other dialects either don't make it clear what their limits are (e.g DuckDB) or allow for much larger table names (e.g BigQuery with 1024 chars).

Docs

Postgres | MySQL

@VaggelisD VaggelisD force-pushed the vaggelisd/identifier_limit branch from dfcb354 to b1e3086 Compare May 16, 2025 12:56
@VaggelisD VaggelisD merged commit a149d13 into main May 21, 2025
22 checks passed
@VaggelisD VaggelisD deleted the vaggelisd/identifier_limit branch May 21, 2025 07:51
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Postgres: identifier names >63 characters truncated

3 participants