Views JOIN condition fails in PostgreSQL when comparing entity identifiers of different datatypes

Created on 5 September 2019, over 5 years ago
Updated 31 January 2024, 11 months ago

Problem/Motivation

Entity IDs can be either a string or an int. Both are acceptable, and even tested for (EntityTestStringID.php). Postgres cannot join across different datatypes. So, when a View lists a relationship between two tables, and the shared identifier stores one as a string and the other as an integer, the query causes an error:

SQLSTATE[42883]: Undefined function: 7 ERROR: operator does not exist: bigint = character varying

Proposed resolution

Cast both condition values to strings.

πŸ› Bug report
Status

Needs work

Version

11.0 πŸ”₯

Component
ViewsΒ  β†’

Last updated 2 days ago

Created by

πŸ‡ΊπŸ‡ΈUnited States jcandan

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

    Particularly affects sites running on the PostgreSQL database.

  • Needs tests

    The change is currently missing an automated test that fails when run with the original code, and succeeds when the bug has been fixed.

Sign in to follow issues

Merge Requests

Comments & Activities

Not all content is available!

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

Production build 0.71.5 2024