Add a method for retrieving the maximum table name (or other identifier) length

Created on 29 September 2014, over 10 years ago
Updated 9 April 2025, 13 days ago

All DBMSs impose some kind of character limit on table names and other identifiers (e.g., 64 for MySQL, 62 for Postgres). However, it is currently (to my knowledge) not possible to retrieve that information via the database layer.
I vote for adding such a method to \Drupal\Core\Database\Connection. Something like
getTableNameLengthLimit()
or
getCharacterLimit($type = 'table').
The latter could return different values for different kinds of identifiers, depending on the DBMS.

Such a method could help prevent related errors for non-MySQL systems, and would help with issues like 🐛 Tests fail on websites with a table prefix Closed: outdated and #998898: Make sure that the identifiers are not more the 63 characters on PostgreSQL .

Feature request
Status

Postponed: needs info

Version

11.0 🔥

Component

database system

Created by

🇦🇹Austria drunken monkey Vienna, Austria

Live updates comments and jobs are added and updated live.
  • stale-issue-cleanup

    To track issues in the developing policy for closing stale issues, [Policy, no patch] closing older issues

Sign in to follow issues

Comments & Activities

Not all content is available!

It's likely this issue predates Contrib.social: some issue and comment data are missing.

Production build 0.71.5 2024