Exception thrown when enabling Custom table logging

Created on 23 April 2025, 24 days ago

Problem/Motivation

Visit /admin/config/development/config_log and enable the Custom table ("config_log") option:

Drupal\Core\Database\DatabaseExceptionWrapper: SQLSTATE[42703]: Undefined column: 7 ERROR: column "originalData" of relation "config_log" does not exist LINE 1: ..."config_log" ("uid", "operation", "name", "data", "originalD... ^: INSERT INTO "config_log" ("uid", "operation", "name", "data", "originalData", "created") VALUES (:db_insert_placeholder_0, :db_insert_placeholder_1, :db_insert_placeholder_2, :db_insert_placeholder_3, :db_insert_placeholder_4, :db_insert_placeholder_5) RETURNING clid; Array ( ) in Drupal\config_log\EventSubscriber\ConfigLogDatabaseSubscriber->insertRecord() (line 121 of modules/contrib/config_log/src/EventSubscriber/ConfigLogDatabaseSubscriber.php).
Drupal\Core\Database\StatementWrapperIterator->execute(NULL, Array) (Line: 98)
Drupal\pgsql\Driver\Database\pgsql\Insert->execute() (Line: 121)
Drupal\config_log\EventSubscriber\ConfigLogDatabaseSubscriber->insertRecord(Array) (Line: 160)
Drupal\config_log\EventSubscriber\ConfigLogDatabaseSubscriber->onConfigSave(Object, 'config.save', Object)
call_user_func(Array, Object, 'config.save', Object) (Line: 111)
Drupal\Component\EventDispatcher\ContainerAwareEventDispatcher->dispatch(Object, 'config.save') (Line: 230)
Drupal\Core\Config\Config->save() (Line: 108)
Drupal\config_log\Form\ConfigLogConfigForm->submitForm(Array, Object)
call_user_func_array(Array, Array) (Line: 129)
Drupal\Core\Form\FormSubmitter->executeSubmitHandlers(Array, Object) (Line: 67)
Drupal\Core\Form\FormSubmitter->doSubmitForm(Array, Object) (Line: 597)
Drupal\Core\Form\FormBuilder->processForm('config_log_config_form', Array, Object) (Line: 326)
Drupal\Core\Form\FormBuilder->buildForm(Object, Object) (Line: 73)
Drupal\Core\Controller\FormController->getContentResult(Object, Object)
call_user_func_array(Array, Array) (Line: 123)
Drupal\Core\EventSubscriber\EarlyRenderingControllerWrapperSubscriber->Drupal\Core\EventSubscriber\{closure}() (Line: 638)
Drupal\Core\Render\Renderer->executeInRenderContext(Object, Object) (Line: 121)
Drupal\Core\EventSubscriber\EarlyRenderingControllerWrapperSubscriber->wrapControllerExecutionInRenderContext(Array, Array) (Line: 97)
Drupal\Core\EventSubscriber\EarlyRenderingControllerWrapperSubscriber->Drupal\Core\EventSubscriber\{closure}() (Line: 181)
Symfony\Component\HttpKernel\HttpKernel->handleRaw(Object, 1) (Line: 76)
Symfony\Component\HttpKernel\HttpKernel->handle(Object, 1, 1) (Line: 53)
Drupal\Core\StackMiddleware\Session->handle(Object, 1, 1) (Line: 48)
Drupal\Core\StackMiddleware\KernelPreHandle->handle(Object, 1, 1) (Line: 28)
Drupal\Core\StackMiddleware\ContentLength->handle(Object, 1, 1) (Line: 32)
Drupal\big_pipe\StackMiddleware\ContentLength->handle(Object, 1, 1) (Line: 106)
Drupal\page_cache\StackMiddleware\PageCache->pass(Object, 1, 1) (Line: 85)
Drupal\page_cache\StackMiddleware\PageCache->handle(Object, 1, 1) (Line: 48)
Drupal\Core\StackMiddleware\ReverseProxyMiddleware->handle(Object, 1, 1) (Line: 51)
Drupal\Core\StackMiddleware\NegotiationMiddleware->handle(Object, 1, 1) (Line: 36)
Drupal\Core\StackMiddleware\AjaxPageState->handle(Object, 1, 1) (Line: 51)
Drupal\Core\StackMiddleware\StackedHttpKernel->handle(Object, 1, 1) (Line: 741)
Drupal\Core\DrupalKernel->handle(Object) (Line: 19)

Looks like this also affects the 4.0 branch.

Steps to reproduce

See above.

Note, the database type is postgres.

Proposed resolution

Fix bug. Patch/MR incoming.

Remaining tasks

N/A

User interface changes

None.

API changes

None.

Data model changes

None.

🐛 Bug report
Status

Active

Version

3.0

Component

Code

Created by

🇨🇦Canada slydevil Halifax

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

Comments & Activities

  • Issue created by @slydevil
  • @slydevil opened merge request.
  • @slydevil opened merge request.
  • 🇨🇦Canada slydevil Halifax

    slydevil changed the visibility of the branch 3520720-exception-thrown-when to hidden.

  • 🇨🇦Canada slydevil Halifax
  • 🇨🇦Canada slydevil Halifax
  • 🇨🇦Canada slydevil Halifax
  • 🇨🇦Canada JordanDukart PEI

    Reviewed this on both 3.x and 4.x.

    Main issue here seems to stem from Postgres. That is, if I provision two barebones ddev instances one MariaDB, one Postgres the following happens when enabling the module via drush on the Postgres instance:

    ddev drush en config_log          
    
    In ExceptionHandler.php line 66:
                                                                                                                                
      SQLSTATE[42703]: Undefined column: 7 ERROR:  column "originalData" of relation "config_log" does not exist                
      LINE 1: ..."config_log" ("uid", "operation", "name", "data", "originalD...                                                
                                                                   ^: INSERT INTO "config_log" ("uid", "operation", "name", "d  
      ata", "originalData", "created") VALUES (:db_insert_placeholder_0, :db_insert_placeholder_1, :db_insert_placeholder_2, :  
      db_insert_placeholder_3, :db_insert_placeholder_4, :db_insert_placeholder_5) RETURNING clid; Array                        
      (                                                                                                                         
      )                                                                                                                         
                                                                                                                                
    
    In StatementWrapperIterator.php line 113:
                                                                                                                  
      SQLSTATE[42703]: Undefined column: 7 ERROR:  column "originalData" of relation "config_log" does not exist  
      LINE 1: ..."config_log" ("uid", "operation", "name", "data", "originalD...

    The module still enables and the issue is then reproducible via the UI as well.

    To note the module enables and operates as normal as expected on the MariaDB instance.

    • nagy.balint committed ef1e6241 on 4.x
      Issue #3520720 by slydevil, jordandukart: Exception thrown when enabling...
    • nagy.balint committed 0db3d38e on 3.0.x
      Issue #3520720 by slydevil, jordandukart: Exception thrown when enabling...
Production build 0.71.5 2024