MYSQL READ-COMMITTED For this to work correctly, all tables must have a primary key. The following table(s) do not have a primary ke

Created on 1 May 2023, over 1 year ago

Problem/Motivation

MYSQL READ-COMMITTED
For this to work correctly, all tables must have a primary key. The following table(s) do not have a primary key: user_activity_send, activity_notification_status, user_activity_digest. See the setting MySQL transaction isolation level page โ†’ for more information.

Drupal 9.5.8
php8.1

Steps to reproduce

Proposed resolution

Remaining tasks

User interface changes

API changes

Data model changes

๐Ÿ› Bug report
Status

Active

Version

11.9

Component

Code (back-end)

Created by

๐Ÿ‡บ๐Ÿ‡ธUnited States SocialNicheGuru

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

Comments & Activities

  • Issue created by @SocialNicheGuru
  • ๐Ÿ‡ฉ๐Ÿ‡ชGermany m Sami Antaki

    m Sami Antaki โ†’ made their first commit to this issueโ€™s fork.

  • @m-sami-antaki opened merge request.
  • ๐Ÿ‡บ๐Ÿ‡ธUnited States bas123

    Drupal Version: 10.2.9
    Installation profile: Social (social-12.4.5)

    I have the following similar issue:

    Transaction isolation level
    READ-COMMITTED
    For this to work correctly, all tables must have a primary key. The following table(s) do not have a primary key: activity_notification_status, user_activity_digest, user_activity_send

    The error references: https://www.drupal.org/docs/system-requirements/setting-the-mysql-transa... โ†’ , however that page provides information on changing the transaction isolation level, but nothing about setting the primary key

    While I do have access to PHPMyAdmin and thus the database in order to set primary keys for those listed tables, I do not know which field to set for each!

    For example, in the 'activity_notification_status' I tried to set the 'UID' as the Primary Key, but this was the response...

    SQL query: ALTER TABLE `activity_notification_status` ADD PRIMARY KEY(`uid`);
    MySQL said: Documentation
    
    #1062 - Duplicate entry '3' for key 'PRIMARY'

    So, if that is the case, why would the Drupal Status Report show this error?
    And how would one resolve this?

  • ๐Ÿ‡ฎ๐Ÿ‡ณIndia zartab farooquee

    Check Table Definitions: Use the SQL command SHOW CREATE TABLE

  • ๐Ÿ‡บ๐Ÿ‡ธUnited States bas123

    zartab farooquee โ†’ ,

    Your recommendation:
    SHOW CREATE TABLE activity_notification_status
    Returned the following:

    Your SQL query has been executed successfully.
    
    SHOW CREATE TABLE activity_notification_status;
    activity_notification_status	CREATE TABLE `activity_notification_status` (
      `u...	

    I can add a primary key using the PHP MySQL function under "More", which create the same code you provided and the same result:

    ALTER TABLE `activity_notification_status` ADD PRIMARY KEY(`uid`);
    MySQL said: Documentation
    #1062 - Duplicate entry '3' for key 'PRIMARY'

    This still shows in the Drupal Status page as:

    The following table(s) do not have a primary key: activity_notification_status, user_activity_digest, user_activity_send

    From the database:

  • ๐Ÿ‡ฉ๐Ÿ‡ชGermany slowflyer

    You can not create a unique PRIMARY KEY out of the existing fields in this table.

    Either wait until the OS Team takes care od this issue, or create an additional field like this one:

    ALTER TABLE activity_notification_status ADD my_unique_id INT NOT NULL AUTO_INCREMENT AFTER status, ADD PRIMARY KEY (my_unique_id);

    (But in this case you will have trouble/error when the OS team adds a PRIMARY KEY field to the table)

  • ๐Ÿ‡บ๐Ÿ‡ธUnited States bas123

    slowflyer ,

    Thank you for the explanation. Obviously, it is better to wait for the Open Social developers to correct the issue!

Production build 0.71.5 2024