- Issue created by @pfrenssen
- Status changed to Needs review
almost 2 years ago 3:42pm 7 February 2023 -
marcoscano →
committed b68beca1 on 8.x-2.x authored by
pfrenssen →
Issue #3340004 by pfrenssen: Fatal database error when updating to 2.0-...
-
marcoscano →
committed b68beca1 on 8.x-2.x authored by
pfrenssen →
- Status changed to Fixed
almost 2 years ago 6:02pm 7 February 2023 - 🇪🇸Spain marcoscano Barcelona, Spain
Thanks for filing the ticket and for the fix!
Committed and tagged beta10 with this fix, since it's better to avoid beta9 at this point.
https://www.drupal.org/project/entity_usage/releases/8.x-2.0-beta10 → Automatically closed - issue fixed for 2 weeks with no activity.
- Status changed to Fixed
about 1 year ago 11:21am 26 October 2023 - 🇭🇺Hungary szato
On entity_usage_update_8206() I got:
> [notice] Update started: entity_usage_update_8206 > [error] SQLSTATE[HY000]: General error: 3750 Unable to create or change a table without a primary key, when the system variable 'sql_require_primary_key' is set. Add a primary key to the table or unset this variable to avoid this message. Note that tables without a primary key can cause performance problems in row-based replication, so please consult your DBA before changing this setting .: ALTER TABLE `entity_usage` DROP PRIMARY KEY;
I have to disable 'sql_require_primary_key' on session level by adding code to entity_usage_update_8206():
$database->query('SET SESSION sql_require_primary_key=0;');
before calling:
// Drop all indices involving columns we want to change.
- 🇩🇰Denmark uv516 Denmark
I got the error as descriped in attached file. It handles about the field "tagert_id_string" which doesn't have a default value.
After a lot of searching I found the error and the solution:
In MySQL under entity_usage I inspected the table.
The field "target_id_string" is created with no NULL-value and no default value.
The field can not have at NULL-value, but it MUST have at default value.
I set (in) 0 as the default value and that solved my problem.From the patch:
+ $database->update('entity_usage') + ->fields(['target_id_string' => '']) + ->condition('target_id_string', NULL, 'IS NULL') + ->execute();
I think that line 3
('->condition('target_id_string', NULL, 'IS NULL')')
should be different?