Column not found: 1054 Unknown column '%language%' in 'where clause'

Created on 19 February 2024, 10 months ago
Updated 20 February 2024, 10 months ago

Problem/Motivation

After updating Drupal core from version 10.1.6 to 10.1.8, I encountered an issue with the drush config:import command. The system utilizes PHP version 8.1.18, MariaDB version 10.3.27, and is configured as a Drupal multisite with config split enabled.

Steps to reproduce

1. Update Drupal core from version 10.1.6 to 10.1.8.
2. Execute drush config:import.
3. The following error occurs:

SQLSTATE[42S22]: Column not found: 1054 Unknown column '%language%' in 'where clause': SELECT DISTINCT "collection" FROM "config_import" WHERE "collection" <> :collection AND "collection" NOT LIKE "%language%" ORDER BY "collection"; Array

This error also occurs when navigating to Configuration -> Development -> Configuration Synchronization.

Proposed resolution

It appears that in the file core/lib/Drupal/Core/Config/DatabaseStorage.php, within the method getAllCollectionNames(), the following line is causing the issue:

return $this->connection->query('SELECT DISTINCT [collection] FROM {' . $this->connection->escapeTable($this->table) . '} WHERE [collection] <> :collection AND [collection] NOT LIKE "%language%" ORDER BY [collection]', [
':collection' => StorageInterface::DEFAULT_COLLECTION,
])->fetchCol();

In this line, [collection] NOT LIKE "%language%", MySQL interprets "language" as a field. To resolve the issue, I modified double quotes to single quotes in the patch, which fixed the problem:
'%language%'

πŸ› Bug report
Status

Closed: works as designed

Version

11.0 πŸ”₯

Component
DatabaseΒ  β†’

Last updated 2 days ago

  • Maintained by
  • πŸ‡³πŸ‡±Netherlands @daffie
Created by

πŸ‡§πŸ‡¬Bulgaria ovanes Sofia

Live updates comments and jobs are added and updated live.
Sign in to follow issues

Comments & Activities

Production build 0.71.5 2024