Skip to content

Fix long identifier names exceeding PostgreSQL NAMEDATALEN limit#4235

Merged
jeremydmiller merged 1 commit intomasterfrom
fix/4224-long-identifier-hashing
Apr 6, 2026
Merged

Fix long identifier names exceeding PostgreSQL NAMEDATALEN limit#4235
jeremydmiller merged 1 commit intomasterfrom
fix/4224-long-identifier-hashing

Conversation

@jeremydmiller
Copy link
Copy Markdown
Member

Summary

  • Apply PostgresqlIdentifier.Shorten() to all dynamically generated FK, PK, and index names in EventTagTable and NaturalKeyTable
  • When names exceed 63 chars, they are deterministically truncated with a 4-char hash suffix
  • Short names pass through unchanged (no impact on existing stores)

Fixes #4224 — auto-discovered tag types with long names (e.g., BootstrapTokenResourceName) generated FK names exceeding 63 chars, causing PostgresqlIdentifierTooLongException at startup.

Depends on JasperFx/weasel#241

Test plan

  • 5 tests: schema creation with long names (archived + non-archived), determinism, no-op for short names, collision resistance

🤖 Generated with Claude Code

Apply PostgresqlIdentifier.Shorten() (from Weasel 8.12.0) to all
dynamically generated FK, PK, and index names in EventTagTable and
NaturalKeyTable. When names exceed 63 chars, they are deterministically
truncated with a 4-char FNV-1a hash suffix to avoid collisions.

Fixes the scenario from #4224: auto-discovered tag types with long names
generating identifiers like "fkey_mt_event_tag_bootstrap_token_resource_
name_seq_id_is_archived" (69 chars) that exceed the limit.

Also upgrades Weasel.Postgresql and Weasel.EntityFrameworkCore to 8.12.0.

Closes #4224

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
@jeremydmiller jeremydmiller force-pushed the fix/4224-long-identifier-hashing branch from a0aac8e to 622eb91 Compare April 6, 2026 22:04
@jeremydmiller jeremydmiller merged commit 797ddfb into master Apr 6, 2026
5 of 6 checks passed
@jeremydmiller jeremydmiller deleted the fix/4224-long-identifier-hashing branch April 6, 2026 22:07
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.

Auto registered tag types create too long foreign keys breaking startup

1 participant