Getting a 500 error when search by id in relation fields #21854

Required System information

  • Node.js version: 18
  • Strapi version: 5.0.6
  • Database: Postgres
  • Operating system: Ubuntu
  • Is your project Javascript or Typescript: Typescript

Describe the bug

When I’m trying to search an entry in relation fields I can’t make it due 500 error from Strapi backend. Besides I see documentIds in UI instead of numeric ids. Moreover I see a Postgres error in my strapi logs:

error: select “t0”.“id”, “t0”.“document_id”, “t0”.“published_at”, “t0”.“updated_at” from “public”.“matches” as “t0” where ((“t0”.“published_at” is null and “t0”.“id” not in (select distinct “t1”.“id” from “public”.“tournaments” as “t0” left join “public”.“tournaments_group_stage_matches_lnk” as “t2” on “t0”.“id” = “t2”.“tournament_id” left join “public”.“matches” as “t1” on “t2”.“match_id” = “t1”.“id” where (“t1”.“id” is not null and “t1”.“document_id” is not null and “t0”.“document_id” = $1 and “t1”.“published_at” is null)) and LOWER(“t0”.“id”) LIKE LOWER($2))) order by “t0”.“id” asc limit $3 - function lower(integer) does not exist
error: select “t0”.“id”, “t0”.“document_id”, “t0”.“published_at”, “t0”.“updated_at” from “public”.“matches” as “t0” where ((“t0”.“published_at” is null and “t0”.“id” not in (select distinct “t1”.“id” from “public”.“tournaments” as “t0” left join “public”.“tournaments_group_stage_matches_lnk” as “t2” on “t0”.“id” = “t2”.“tournament_id” left join “public”.“matches” as “t1” on “t2”.“match_id” = “t1”.“id” where (“t1”.“id” is not null and “t1”.“document_id” is not null and “t0”.“document_id” = $1 and “t1”.“published_at” is null)) and LOWER(“t0”.“id”) LIKE LOWER($2))) order by “t0”.“id” asc limit $3 - function lower(integer) does not exist
at Parser.parseErrorMessage (/opt/node_modules/pg-protocol/dist/parser.js:283:98)
at Parser.handlePacket (/opt/node_modules/pg-protocol/dist/parser.js:122:29)
at Parser.parse (/opt/node_modules/pg-protocol/dist/parser.js:35:38)
at Socket. (/opt/node_modules/pg-protocol/dist/index.js:11:42)
at Socket.emit (node:events:517:28)
at Socket.emit (node:domain:489:12)
at addChunk (node:internal/streams/readable:368:12)
at readableAddChunk (node:internal/streams/readable:341:9)
at Readable.push (node:internal/streams/readable:278:10)
at TCP.onStreamRead (node:internal/stream_base_commons:190:23)

Expected behavior

I can search documents in relation field of entry by numeric ID.

Screenshots