Identifier length
Supported by ✅ Open Source Edition ✅ Express Edition ✅ Professional Edition ✅ Enterprise Edition
Most databases limit the length of identifiers, e.g. to 63 characters in PostgreSQL. jOOQ sometimes generates identifiers itself, e.g. when deriving an alias from an expression, and those may exceed such a limit. Long user-defined aliases can, too. When the nameAutoAliasingIfMaxLengthExceeded setting is active, jOOQ replaces any unqualified, quoted identifier that exceeds the maximum length with a generated alias_[hash] identifier, where [hash] is a hash of the original identifier.
-
nameAutoAliasingIfMaxLengthExceeded: Whether to replace identifiers that are too long. The default isfalse. -
nameMaxLength: An override for the maximum identifier length. If this isn't set, jOOQ uses the dialect's maximum identifier length. This setting has no effect ifnameAutoAliasingIfMaxLengthExceededis turned off.
Identifiers are only replaced if they are quoted, see the identifier style settings.
Example configuration
Settings settings = new Settings()
.withNameAutoAliasingIfMaxLengthExceeded(true) // Defaults to false
.withNameMaxLength(30); // Defaults to the dialect's limit
Feedback
Do you have any feedback about this page? We'd love to hear it!