protected Schema::ensureIdentifiersLength($identifier)
Make sure to limit identifiers according to PostgreSQL compiled in length.
PostgreSQL allows in standard configuration no longer identifiers than 63 chars for table/relation names, indexes, primary keys, and constraints. So we map all identifiers that are too long to drupal_base64hash_tag, where tag is one of:
$identifiers: The arguments to build the identifier string
The index/constraint/pkey identifier
protected function ensureIdentifiersLength($identifier) { $args = func_get_args(); $info = $this->getPrefixInfo($identifier); $args[0] = $info['table']; $identifierName = implode('__', $args); // Retrieve the max identifier length which is usually 63 characters // but can be altered before PostgreSQL is compiled so we need to check. $this->maxIdentifierLength = $this->connection->query("SHOW max_identifier_length")->fetchField(); if (strlen($identifierName) > $this->maxIdentifierLength) { $saveIdentifier = '"drupal_' . $this->hashBase64($identifierName) . '_' . $args[2] . '"'; } else { $saveIdentifier = $identifierName; } return $saveIdentifier; }
© 2001–2016 by the original authors
Licensed under the GNU General Public License, version 2 and later.
Drupal is a registered trademark of Dries Buytaert.
https://api.drupal.org/api/drupal/core!lib!Drupal!Core!Database!Driver!pgsql!Schema.php/function/Schema::ensureIdentifiersLength/8.1.x