Problem/Motivation
Primary keys are missing from the publishing_options_bundles and publishing_options_option_node tables. This causes the following warning on the status page:
Transaction isolation level
REPEATABLE-READ
The recommended level for Drupal is "READ COMMITTED". For this to work correctly, all tables must have a primary key. The following table(s) do not have a primary key: publishing_options_bundles, publishing_options_option_node. See the setting MySQL transaction isolation level page for more information.
Steps to reproduce
Install module and have db stet to READ COMMITTED. Navigate to the /admin/reports/status page.
Proposed resolution
Update schema definition and add update hook in publishing_options.install file.
| Comment | File | Size | Author |
|---|---|---|---|
| #5 | pub-options-before.png | 80.51 KB | mukhtarm |
Issue fork pub_options-3396971
Show commands
Start within a Git clone of the project using the version control instructions.
Or, if you do not have SSH keys set up on git.drupalcode.org:
Comments
Comment #4
sarwan_verma commentedHi @mizage@gmail.com ,
I have fixed this issue "Primary keys missing" and also created MR,
kindly review the MR.
Comment #5
mukhtarm commentedI reviewed the MR. On the
publishing_options_bundlestable the better primary key option would on thepubidas it does for thepublishing_optionstable. Updated the MR, please reviewComment #6
mizage@gmail.com commentedThanks for the quick response! Do we need an update hook for existing installations?
Comment #7
mukhtarm commentedUpdated the MR with
hook_updatethat tested locally. Note that if you applied https://git.drupalcode.org/project/pub_options/-/merge_requests/15/diffs... already, it wont have any effects. Or you have to revert it to the earlier and rundrush updb.Comment #8
geocalleo commentedHi and thanks for the update. I'll check the code and get it merged in once I'm done testing!
Comment #9
mizage@gmail.com commentedThanks again for the quick response.
Comment #10
mizage@gmail.com commentedI'm seeing the following when applying the update:
Comment #14
mukhtarm commentedThanks @geocalleo. When i tried to apply the patch from MR via composer (https://git.drupalcode.org/project/pub_options/-/merge_requests/17.patch) it fails (As there are conflicts in
publishing_options.install). I had to wget the patch to local and thengit apply -3 patchand had to resolve the conflict to get it work. I think all other changes was already there in place for2.0.3version.Comment #16
geocalleo commentedHi @MukhtarM, I am trying to merge the updates you put in place. But it looks like the merge request is set for 2.x branch. Can you switch that over to 2.0.0 branch? I've been making release tags on that branch for the latest releases.
Comment #17
mukhtarm commentedYea sure @geocalleo i will do that
Comment #21
mukhtarm commented@geocalleo i raised against
2.0.0now. First i tried to raise in the git UI itself (as there no code change), but it didn't worked. Thats why there is a intermediate MR :)Comment #22
aurora.luzzardiNone of those branches/pr could be applied on 2.0.3 what should be the steps?
Do we have a patch that can be applied?
Comment #23
sprite commentedthread started: 2026-10-03 - - current comment added: 2026-06-21 -
Drupal 11 admin [ status report] error:
The - captcha_questions_dblog - table needs a primary key.
Comment #25
geocalleo commentedHi all,
Thanks for the report, @mlcage, and thanks @sarwan_verma and @mukharrm for taking a crack at this.
I committed a fix to the 2.0.x branch (6b17b72) and tagged it as 2.0.4. I went a slightly different route from the MRs, so here's the quick rundown:
The two tables are many-to-many. One publishing option can map to a bunch of bundles, and a node can have more than one option on it, so the keys need to be composite instead of single column: publishing_options_bundles gets (pubid, bundle) and publishing_options_option_node gets (pubid, nid). I left pubid as a plain int since it's just pointing back at publishing_options, not a serial.
For existing sites, the update hook (publishing_options_update_8001) clears out any duplicate rows first and then adds the keys, so you just need to run your db updates after pulling 2.0.4. I bumped it to 8001 since update hooks numbered below 8000 don't actually run on Drupal 8+.
I tested it on a Drupal 10 site set to READ COMMITTED. Before the update the status report flags both tables, and once it runs the isolation check goes back to green. Fresh installs come out with the keys already in place.
Marking this fixed. Thanks again, everyone.
Comment #26
geocalleo commented