After enable translation for content type "Basic page", the following error when adding a node :
Drupal\Core\Database\DatabaseExceptionWrapper: SQLSTATE[42S22]: Column not found: 1054 Unknown column 'content_translation_source' in 'where clause': SELECT DISTINCT t.nid AS nid FROM {node_field_data} t WHERE ( (content_translation_source IS NOT NULL ) ) LIMIT 1 OFFSET 0; Array ( ) in Drupal\Core\Entity\Sql\SqlContentEntityStorage->countFieldData() (line 1784 of core/lib/Drupal/Core/Entity/Sql/SqlContentEntityStorage.php).
Drupal\Core\Database\Statement->execute(Array, Array)
Drupal\Core\Database\Connection->query('SELECT DISTINCT t.nid AS nid
FROM
{node_field_data} t
WHERE ( (content_translation_source IS NOT NULL ) )
LIMIT 1 OFFSET 0', Array, Array)
Drupal\Core\Database\Query\Select->execute()
Drupal\Core\Entity\Sql\SqlContentEntityStorage->countFieldData(Object, 1)
Drupal\Core\Field\FieldModuleUninstallValidator->validate('content_translation')
Drupal\Core\Extension\ModuleInstaller->validateUninstall(Array)
Drupal\system\Form\ModulesUninstallForm->buildForm(Array, Object)
call_user_func_array(Array, Array)
Drupal\Core\Form\FormBuilder->retrieveForm('system_modules_uninstall', Object)
Drupal\Core\Form\FormBuilder->buildForm(Object, Object)
Drupal\Core\Controller\FormController->getContentResult(Object, Object)
call_user_func_array(Array, Array)
Symfony\Component\HttpKernel\HttpKernel->handleRaw(Object, 1)
Symfony\Component\HttpKernel\HttpKernel->handle(Object, 1, 1)
Drupal\Core\StackMiddleware\KernelPreHandle->handle(Object, 1, 1)
Drupal\Core\StackMiddleware\PageCache->pass(Object, 1, 1)
Drupal\Core\StackMiddleware\PageCache->handle(Object, 1, 1)
Drupal\Core\StackMiddleware\ReverseProxyMiddleware->handle(Object, 1, 1)
Stack\StackedHttpKernel->handle(Object, 1, 1)
Drupal\Core\DrupalKernel->handle(Object)This error is caused by a known regression introduced in #1916790: Convert translation metadata into regular entity fields. Running update.php after enabling content translation on an entity type for the first time will add the required columns and fix the issue.
| Comment | File | Size | Author |
|---|---|---|---|
| #6 | column_not_found_1054-2418563-6.patch | 2.87 KB | legolasbo |
| #6 | interdiff.txt | 2.22 KB | legolasbo |
| #1 | column_not_found_test-2418563-1.patch | 1.84 KB | legolasbo |
Comments
Comment #1
legolasboEnabling content translations for an entity_type requires a database update for the schema to be adjusted. In my opinion this is not good UX. I've attached a (failing) test which reproduces the problem and a patch containing a possible fix.
Comment #4
legolasboThis patch is a combination of both previously posted patches.
Comment #6
legolasboImproved the patch by calling
\Drupal::service('content_translation.updates_manager')->updateDefinitionsinstead of using it's code.Comment #7
legolasboComment #9
legolasboTests seems to be failing because of a problem with testbot.
Comment #10
plachThanks for the patch, but this is fixed in the latest -dev, core moves fast these days :)
#2419649: Content translation schema updates are not triggered consistently