Repository navigation
Description
Describe the Bug
When I try to filter a collection on a property that is a hasMany relation and use the "equals" operator I get a blank screen and the following error:
[Error: Failed query: select distinct "users"."id", "users"."created_at", "users"."created_at" from "users" left join "users_rels" "4f704f54_123f_4661_90e5_71f0edee30e2" on ("users"."id" = "4f704f54_123f_4661_90e5_71f0edee30e2"."parent_id" and "4f704f54_123f_4661_90e5_71f0edee30e2"."path" like $1) left join "interests" "f1c01e26_80fb_4c44_9c38_5b99a8ce7377" on "f1c01e26_80fb_4c44_9c38_5b99a8ce7377"."id" = "4f704f54_123f_4661_90e5_71f0edee30e2"."interests_id" where "4f704f54_123f_4661_90e5_71f0edee30e2"."interests_id" = $2 order by "users"."created_at" desc limit $3
params: interests,2,2,10] {
query: 'select distinct "users"."id", "users"."created_at", "users"."created_at" from "users" left join "users_rels" "4f704f54_123f_4661_90e5_71f0edee30e2" on ("users"."id" = "4f704f54_123f_4661_90e5_71f0edee30e2"."parent_id" and "4f704f54_123f_4661_90e5_71f0edee30e2"."path" like $1) left join "interests" "f1c01e26_80fb_4c44_9c38_5b99a8ce7377" on "f1c01e26_80fb_4c44_9c38_5b99a8ce7377"."id" = "4f704f54_123f_4661_90e5_71f0edee30e2"."interests_id" where "4f704f54_123f_4661_90e5_71f0edee30e2"."interests_id" = $2 order by "users"."created_at" desc limit $3',
params: [Array],
[cause]: [error: invalid input syntax for type integer: "{"2","2"}"] {
length: 152,
severity: 'ERROR',
code: '22P02',
detail: undefined,
hint: undefined,
position: undefined,
internalPosition: undefined,
internalQuery: undefined,
where: "unnamed portal parameter $2 = '...'",
schema: undefined,
table: undefined,
column: undefined,
dataType: undefined,
constraint: undefined,
file: 'numutils.c',
line: '616',
routine: 'pg_strtoint32_safe'
}
}
Link to the code that reproduces this issue
Reproduction Steps
- Login and create user
- Create one or two interests and link one to the user
- Go to collection and add a filter "Interests" "equals" and one of the created interests
=> menu dissapears
Which area(s) are affected?
area: ui
Environment Info
Binaries:
Node: 22.22.0
npm: 10.9.4
Yarn: 1.22.22
pnpm: N/A
Relevant Packages:
payload: 3.72.0
next: 15.4.10
@payloadcms/db-postgres: 3.72.0
@payloadcms/drizzle: 3.72.0
@payloadcms/graphql: 3.72.0
@payloadcms/next/utilities: 3.72.0
@payloadcms/richtext-lexical: 3.72.0
@payloadcms/translations: 3.72.0
@payloadcms/ui/shared: 3.72.0
react: 19.2.1
react-dom: 19.2.1
Operating System:
Platform: darwin
Arch: arm64
Version: Darwin Kernel Version 25.2.0: Tue Nov 18 21:09:40 PST 2025; root:xnu-12377.61.12~1/RELEASE_ARM64_T6000
Available memory (MB): 32768
Available CPU cores: 10
Activity
RisaI commentedon Jan 29, 2026
Similar errors can be encountered when filtering a
richTextcolumn by acontainsaction:nehaaprasad commentedon Jan 29, 2026
Hello! @jaymaycry
please check out the PR!
JarrodMFlesch commentedon Jan 30, 2026
@naaa760 I think the fix here would be to focus on the frontend and not allow the list filter to show equals/not_equals when a field has
hasMany: true.nehaaprasad commentedon Feb 2, 2026
@JarrodMFlesch
updated it, please check it out!
jaymaycry commentedon Feb 9, 2026
@naaa760 lgtm, thank you!
JarrodMFlesch commentedon Oct 27, 2026
This is fixed in #15766, released in 3.82.0. The SQL adapter now converts array-valued relationship
equals/not_equalsfilters toin/not_ininstead of passing an array to a scalar comparison.I verified the reported relationship-filter failure on PostgreSQL with Payload 3.92.0 and 4.0.0-beta.4. The database checks pass with scalar, single-value, multiple-value, and duplicate array inputs, using both serial and UUID IDs. The recordings below show the Admin list filtering successfully on each version.
This closes the original relationship-filter report; the separate rich-text
containsexample in the comments is a different query path.PYLD-598-3x-take2.mp4
PYLD-598-main-take2.mp4