I've updated paragraphs to the latest version (1.9) and tried to run the database updates.
(Sidenote - I'm using PostgreSQL as database system)
However, trying to run the post update function 'paragraphs_post_update_rebuild_parent_fields' results in a crash with the following error:
> [notice] Update started: paragraphs_post_update_rebuild_parent_fields
> [error] SQLSTATE[42883]: Undefined function: 7 ERROR: operator does not exist: character varying <> bigint
> LINE 5: WHERE (((p.parent_id <> f.entity_id)) OR (p.parent_type <> '...
> ^
> HINT: No operator matches the given name and argument types. You might need to add explicit type casts.: SELECT f.entity_id AS entity_id, f.field_paragraph_target_revision_id AS field_paragraph_target_revision_id, p.revision_id AS prevision_id
> FROM
> {paragraph_revision__field_paragraph} f
> INNER JOIN {paragraphs_item_revision_field_data} p ON f.field_paragraph_target_revision_id = 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)) AND ((p.langcode = f.langcode))
> ORDER BY p.revision_id ASC NULLS FIRST
> LIMIT 100 OFFSET 0; Array
> (
> [:db_condition_placeholder_0] => paragraph
> [:db_condition_placeholder_1] => field_paragraph
> )
>
> [error] Update failed: paragraphs_post_update_rebuild_parent_fields
> [error] Update aborted by: paragraphs_post_update_rebuild_parent_fields
In my understanding this is caused by the type difference of the values that are being compared: 'p.parent_id' being 'varying' and 'f.entity_id' being 'bigint'. What worked for me, was explicitly casting the value of type 'bigint' to 'varying (varchar)', so that the types are the same. The other way around would work too, but I thought it would be safer to cast a 'bigint' to 'varying (varchar)', in case the 'p.parent_id' wouldn't contain a numerical value.
I've created a patch containing the change I did to solve this issue for me.
| Comment | File | Size | Author |
|---|---|---|---|
| #2 | operator-does-not-exist-3076096-2.patch | 658 bytes | michaelsoetaert |
Comments
Comment #2
michaelsoetaertComment #3
kruser commentedWorked for me thanks! Postgress DB as well.
Comment #4
jcandan commentedI have submitted a patch to core to address this same issue in Views. I wonder if there is a
pgsqldriver change necessary to address this.Comment #5
robert-io commentedCasting to VARCHAR breaks mysql installations, so this patch is for postgres only. Maybe casting to CHAR works for both databases?
Comment #6
arefen commentedPatch #2 fixed my problem
Comment #7
berdirDuplicate of #3081645: make paragraphs_post_update_rebuild_parent_fields() compatible with PostGreSQL dbs