- 🇮🇹Italy mondrake 🇮🇹
I think at this point this is just a dupe of 📌 Forbid limited length primary and unique keys, allow only in indexes Needs work .
Per our Schema API documentation, each column of a unique key of a table schema can be specified either as a column name or as an array of column name and length:
* - 'unique keys': An associative array of unique keys ('keyname' =>
* specification). Each specification is an array of one or more
* key column specifiers (see below) that form a unique key on the table.
* A key column specifier is either a string naming a column or an
* array of two elements, column name and length, specifying a prefix
* of the named column.
The PostreSQL database backend does not support the latter case. The relevant code is in lines 135 to 139 of \Drupal\Core\Database\Driver\pqsql\Schema::createTableSql()
:
if (isset($table['unique keys']) && is_array($table['unique keys'])) {
foreach ($table['unique keys'] as $key_name => $key) {
$sql_keys[] = 'CONSTRAINT ' . $this->prefixNonTable($name, $key_name, 'key') . ' UNIQUE (' . implode(', ', $key) . ')';
}
}
The $key
variable in the foreach can be (per the API documentation) for example array(array('foo', 123))
in which case the implode()
fails. The resulting string will then be Array
and the resulting SQL will fail hard.
Active
11.0 🔥
Particularly affects sites running on the PostgreSQL database.
Not all content is available!
It's likely this issue predates Contrib.social: some issue and comment data are missing.
I think at this point this is just a dupe of 📌 Forbid limited length primary and unique keys, allow only in indexes Needs work .