Fix PostgreSQL error not null constraint violation gives me an wsod

Created on 5 October 2020, over 3 years ago
Updated 4 October 2023, 9 months ago

Problem/Motivation

Trying to install varbase.

Steps to reproduce

Install varbase, using Drupal-VM with postgresql as the database. Enabled most of the extra components (all but SSO & Google).

Get an error:

An AJAX HTTP error occurred.
HTTP Result Code: 200
Debugging information follows.
Path: /core/install.php?rewrite=ok&profile=varbase&langcode=en&id=3&op=do_nojs&op=do
StatusText: OK
ResponseText: Drupal\Core\Entity\EntityStorageException: SQLSTATE[23502]: Not null violation: 7 ERROR:  null value in column "lid" violates not-null constraint
DETAIL:  Failing row contains (null, user, update, <none>, 1, webmaster, <em class="placeholder">webmaster</em> (uid <em class="placehold..., 0, 192.168.88.1, 1601936279).: INSERT INTO admin_audit_trail (lid, type, operation, description, created, uid, ip, path, ref_char, ref_numeric) 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, :db_insert_placeholder_6, :db_insert_placeholder_7, :db_insert_placeholder_8, :db_insert_placeholder_9); Array
(
)
in Drupal\Core\Entity\Sql\SqlContentEntityStorage->save() (line 846 of /web/www/docroot/core/lib/Drupal/Core/Entity/Sql/SqlContentEntityStorage.php).

The apache error log includes:

[Mon Oct 05 21:31:09.127475 2020] [proxy_fcgi:error] [pid 46160:tid 140718043535104] [client 192.168.88.1:54880] AH01071: Got error 'PHP message: Drupal\\Core\\Entity\\EntityStorageException: SQLSTATE[23502]: Not null violation: 7 ERROR:  null value in column "lid" violates not-null constraint\nDETAIL:  Failing row contains (null, user, update, <none>, 1, webmaster, <em class="placeholder">webmaster</em> (uid <em class="placehold..., 0, 192.168.88.1, 1601933427).: INSERT INTO admin_audit_trail (lid, type, operation, description, created, uid, ip, path, ref_char, ref_numeric) 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, :db_insert_placeholder_6, :db_insert_placeholder_7, :db_insert_placeholder_8, :db_insert_placeholder_9); Array\n(\n)\n in /web/www/docroot/core/lib/Drupal/Core/Entity/Sql/SqlContentEntityStorage.php on line 846 #0 /web/www/docroot/core/lib/Drupal/Core/Entity/EntityBase.php(395): Drupal\\Core\\Entity\\Sql\\SqlContentEntityStorage->save(Object(Drupal\\user\\Entity\\User))\n#1 /web/www/docroot/modules/contrib/varb...', referer: http://gerpeople.test/core/install.php?rewrite=ok&profile=varbase&langcode=en&id=3&op=start

When I try to visit the module's admin page, I get a bare error page and:

[Mon Oct 05 22:03:33.132977 2020] [proxy_fcgi:error] [pid 46159:tid 140717934429952] [client 192.168.88.1:55818] AH01071: Got error 'PHP message: Uncaught PHP Exception Drupal\\Core\\Database\\DatabaseExceptionWrapper: "SQLSTATE[42P01]: Undefined table: 7 ERROR:  relation "admin_audit_trail" does not exist\nLINE 5: admin_audit_trail e) subquery\n        ^: SELECT COUNT(*) AS expression\nFROM\n(SELECT 1 AS expression\nFROM\n{admin_audit_trail} e) subquery; Array\n(\n)\n" at /web/www/docroot/core/lib/Drupal/Core/Database/Connection.php line 701', referer: http://gerpeople.test/admin/help/admin_audit_trail

Proposed resolution

Remaining tasks

User interface changes

API changes

Data model changes

🐛 Bug report
Status

Fixed

Version

1.0

Component

Code

Created by

🇬🇧United Kingdom rivimey

Live updates comments and jobs are added and updated live.
  • PostgreSQL

    Particularly affects sites running on the PostgreSQL database.

  • PHP 7.3

    The issue particularly affects sites running on PHP version 7.3.0 or later.

  • PHP 7.4

    The issue particularly affects sites running on PHP version 7.4.0 or later.

  • PHP 8.0

    The issue particularly affects sites running on PHP version 8.0.0 or later.

  • PHP 8.1

    The issue particularly affects sites running on PHP version 8.1.0 or later.

  • PHP 8.2

    The issue particularly affects sites running on PHP version 8.2.0 or later.

Sign in to follow issues

Comments & Activities

Not all content is available!

It's likely this issue predates Contrib.social: some issue and comment data are missing.

Production build 0.69.0 2024