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.

Comments

michaelsoetaert created an issue. See original summary.

michaelsoetaert’s picture

StatusFileSize
new658 bytes
kruser’s picture

Worked for me thanks! Postgress DB as well.

jcandan’s picture

I have submitted a patch to core to address this same issue in Views. I wonder if there is a pgsql driver change necessary to address this.

robert-io’s picture

Casting to VARCHAR breaks mysql installations, so this patch is for postgres only. Maybe casting to CHAR works for both databases?

arefen’s picture

Patch #2 fixed my problem

berdir’s picture

Status: Active » Closed (duplicate)
Issue tags: -