Entity reference autocomplete's "Add another item" button doesn't work with PostgreSQL

Created on 30 June 2014, almost 10 years ago
Updated 19 January 2023, over 1 year ago

Problem/Motivation

There is a bug in "add another" button inside the entity reference field when using the PostgreSQL database. The bug consists on a sql error inside the ajax requisition, as shown on the attached image, saying that '' isn't a valid integer. This error doesn't happens when using a MySQL database.

Proposed resolution

After some bug tracking, I've found that the root of the problem is that, inside the entityreference_field_widget_form function, there is an entity_load call sending an empty string as an entity_id. The clean solution is if the id is empty inside a previous foreach lace on the code. After this simple change the problem is solved.

πŸ› Bug report
Status

Closed: outdated

Version

1.0

Component

Code

Created by

Live updates comments and jobs are added and updated live.
  • PostgreSQL

    Particularly affects sites running on the PostgreSQL database.

  • Needs reroll

    The patch will have to be re-rolled with new suggestions/changes described in the comments in the issue.

Sign in to follow issues

Comments & Activities

Not all content is available!

It's likely this issue predates Contrib.social: some issue and comment data are missing.

No activities found.

Production build 0.69.0 2024