Skip to content

ADT identifiers can be truncated #366

Open

Description

@tomsmalley

Using deeply nested ADTs or types with long names can cause postgres to truncate them, emitting warnings like:

NOTICE: identifier "SomeReallyLongIdentifier/etc" will be truncated to "SomeReallyLongIden"

The truncation length is adjustable, defaulting to 63 bytes, and described here https://www.postgresql.org/docs/current/sql-syntax-lexical.html#SQL-SYNTAX-IDENTIFIERS.

Relevant example in the rel8 docs: https://hackage.haskell.org/package/rel8-1.6.0.0/docs/Rel8.html#g:19

Ideally this wouldn't happen (rel8 avoids generating very long identifiers) but at least it should be called out in the docs.

Activity

  1. jy14898 commented on May 6, 2025

    @jy14898

    It seems the latest version of rel8 is doing truncation itself (so the warning is silenced):

    pure $ take (63 - length suffix) label ++ suffix

    But it still seems likely that field names collide. A simple 'fix' would be to make it so the suffix is a prefix, as that's the freshly generated unique name? parsed the expression wrong, this indeed fixes the issue!

  2. TeofilC commented on May 8, 2025

    @TeofilC
    Contributor

    A documentation PR would be appreciated if someone has capacity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions