Support for Drupal 7 is ending on 5 January 2025—it’s time to migrate to Drupal 10! Learn about the many benefits of Drupal 10 and find migration tools in our resource center.
Problem/Motivation
While updating the module (drush updatedb):
Failed: Drupal\Core\Database\DatabaseExceptionWrapper: SQLSTATE[42000]: Syntax error or access violation: 1064 You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near 'AS [error]
FROM
node_revision__field_address f
INNER JOIN paragraphs_item_revision_fiel' at line 1: SELECT f.entity_id AS entity_id, f. AS
FROM
{node_revision__field_address} f
INNER JOIN {paragraphs_item_revision_field_data} p ON f. = p.revision_id
WHERE ((p.parent_id <> f.entity_id)) OR (p.parent_type <> :db_condition_placeholder_0) OR (p.parent_field_name <> :db_condition_placeholder_1)
ORDER BY p.revision_id ASC
LIMIT 100 OFFSET 0; Array
(
[:db_condition_placeholder_0] => node
[:db_condition_placeholder_1] => field_address
)
in paragraphs_post_update_rebuild_parent_fields() (regel 240 van /var/www/html/web/modules/contrib/paragraphs/paragraphs.post_update.php).
If I check the $current_field array, the revision_column is NULL for multiple fields on my site. Strange?
array(6) {
["entity_type_id"]=>
string(4) "node"
["field_name"]=>
string(13) "field_address"
["revision_table"]=>
string(28) "node_revision__field_address"
["entity_id_column"]=>
string(9) "entity_id"
["revision_column"]=>
NULL
["langcode_column"]=>
string(8) "langcode"
}
Proposed resolution
See Patch.
Remaining tasks
Review patch.
User interface changes
None
API changes
None
Data model changes
None
Comments
Comment #2
SpokjeExact same error using the same (
drush updb
) method.Weirdly this is the first out of 25 sites that fails in this way. All others had no problems at all.
Anyway: RTBC for me.
Comment #3
SpokjeComment #4
Berdirfield_address? Is that really a paragraph field or is it something else?
Comment #5
Spokje@Berdir:
In my case the error is/was:
So at the very least the parent is a paragraph.
Looking at the report at
/admin/reports/fields
:Comment #6
Spokje(Semi?) Interesting addendum: If I do the paragraphs update together with a Drupal Core update from D8.6.17 => D8.7.7, the patch is not needed and the post-update does not fail on the mentioned field.
Comment #7
BerdirI'm more interested in the target entity type of field_p_tl_tiles than its host entity type :)
Comment #8
SpokjeIts parent is another Paragraph.
Comment #9
BerdirI still don't understand when this happens, but it shouldn't interfere with anything that currently works. We have upgrade path tests now, they work, the sqlite fails seem unrelated.