-
Notifications
You must be signed in to change notification settings - Fork 3.5k
Open
Labels
area: coreCore Payload functionalityCore Payload functionalitycreated-by: Contributorstatus: needs-triagePossible bug which hasn't been reproduced yetPossible bug which hasn't been reproduced yet
Description
Describe the bug
Filtering a polymorphic relationship field with hasMany: true throws APIError: Not supported.
I can reproduce this in a fresh Payload app with a minimal schema:
userspersonspartnersarticlestitle: textauthors: relationship,relationTo: ['persons', 'partners'],hasMany: true
This affects:
- REST queries like
where[authors][exists]=true - Admin list view filters generated by the UI, including:
exists- polymorphic
equalsobject notation
Reproduction repo
https://github.com/atimmer/payload-polymorphic-hasmany-filter-repro
Versions
payload:3.79.0@payloadcms/db-postgres:3.79.0- PostgreSQL
16
Minimal field config
{
name: 'authors',
type: 'relationship',
relationTo: ['persons', 'partners'],
hasMany: true,
}
### Link to the code that reproduces this issue
https://github.com/atimmer/payload-polymorphic-hasmany-filter-repro
### Reproduction Steps
## REST reproduction
This request returns `500` instead of returning the matching article:
```bash
curl -i 'http://127.0.0.1:3110/api/articles?where%5Bauthors%5D%5Bexists%5D=true'Expected: one article.
Actual: 500 Internal Server Error with APIError: Not supported.
Admin reproduction
-
Log in:
curl -s -c /tmp/payload-repro-cookies.txt \ -H 'Content-Type: application/json' \ -d '{"email":"admin@example.com","password":"password"}' \ http://127.0.0.1:3110/api/users/login
-
Request the admin list page using the
existsfilter generated by the admin UI:curl -i -b /tmp/payload-repro-cookies.txt \ 'http://127.0.0.1:3110/admin/collections/articles?depth=1&limit=10&where%5Bor%5D%5B0%5D%5Band%5D%5B0%5D%5Bauthors%5D%5Bexists%5D=true&page=1' -
Request the admin list page using the
equalsfilter generated by the admin UI:curl -i -b /tmp/payload-repro-cookies.txt \ 'http://127.0.0.1:3110/admin/collections/articles?depth=1&limit=10&where%5Bor%5D%5B0%5D%5Band%5D%5B0%5D%5Bauthors%5D%5Bequals%5D%5B0%5D%5BrelationTo%5D=persons&where%5Bor%5D%5B0%5D%5Band%5D%5B0%5D%5Bauthors%5D%5Bequals%5D%5B0%5D%5Bvalue%5D=1&page=1'
Expected: the list view loads and shows the matching article.
Actual: the server logs APIError: Not supported from @payloadcms/drizzle/dist/queries/getTableColumnFromPath.js.
Which area(s) are affected?
area: core
Environment Info
Node 25.4.0
npm 11.7.0
pnpm 10.17.0
payload 3.79.0
@payloadcms/db-postgres 3.79.0
@payloadcms/drizzle 3.79.0
next 15.4.11
react / react-dom 19.2.1
OS: macOS Darwin arm64, 16 cores, 64 GB RAM
Reactions are currently unavailable
Metadata
Metadata
Assignees
Labels
area: coreCore Payload functionalityCore Payload functionalitycreated-by: Contributorstatus: needs-triagePossible bug which hasn't been reproduced yetPossible bug which hasn't been reproduced yet