-
Notifications
You must be signed in to change notification settings - Fork 3.4k
Open
Labels
Bugdb: postgres@payloadcms/db-postgres@payloadcms/db-postgresstatus: needs-triagePossible bug which hasn't been reproduced yetPossible bug which hasn't been reproduced yet
Description
Describe the Bug
When querying a collection with two different relationship fields that both have a nested field with the same name, the query fails. Each filter works correctly in isolation, but combining them causes an error.
Expected Behavior
The query should return documents where both conditions are satisfied.
Actual Behavior
The query fails. However:
- Querying only
artist.categoriesworks - Querying only
organizer.categoriesworks - Renaming one of the
categoriesfields to a unique name allows both filters to work together
Please fix this soon, it is impacting a project already in production.
Link to the code that reproduces this issue
https://github.com/leonardigabriele/query-test
Reproduction Steps
- Create two collections (e.g.,
artistsandorganizers) that both have a relationship field with the same name (e.g.,categories) - Create a third collection (e.g.,
events) with relationship fields to bothartistsandorganizers - Attempt to query filtering on both relationship paths:
const { docs } = await payload.find({
collection: "events",
where: {
"artist.categories": {
equals: 1,
},
"organizer.categories": {
equals: 1,
},
},
});
Which area(s) are affected?
db: postgres
Environment Info
Binaries:
Node: 24.13.0
npm: N/A
Yarn: N/A
pnpm: N/A
Relevant Packages:
payload: 3.76.0
next: 16.1.6
@payloadcms/db-postgres: 3.76.0
@payloadcms/drizzle: 3.76.0
@payloadcms/graphql: 3.76.0
@payloadcms/next/utilities: 3.76.0
@payloadcms/richtext-lexical: 3.76.0
@payloadcms/translations: 3.76.0
@payloadcms/ui/shared: 3.76.0
react: 19.2.3
react-dom: 19.2.3
Operating System:
Platform: win32
Arch: x64
Version: Windows 11 Pro
Available memory (MB): 32510
Available CPU cores: 20
Reactions are currently unavailable
Metadata
Metadata
Assignees
Labels
Bugdb: postgres@payloadcms/db-postgres@payloadcms/db-postgresstatus: needs-triagePossible bug which hasn't been reproduced yetPossible bug which hasn't been reproduced yet