-
Notifications
You must be signed in to change notification settings - Fork 3.5k
Open
Labels
db: postgres@payloadcms/db-postgres@payloadcms/db-postgres
Description
Describe the Bug
When querying a collection with a blocks field using draft=true and a where filter on blocks.blockType, it returns no results even though the published query returns the expected document.
This appears to affect the postgres adapter because versioned block rows are stored with _path = 'version.blocks', but the draft query constrains _path = 'blocks'. Mongo does not appear to be affected.
Link to the code that reproduces this issue
Reproduction Steps
- Create a Payload app with a collection that has drafts enabled and a
blocksfield. - Add a block with slug
block-name. - Create a document containing that block.
- Run a local API query without drafts enabled:
const publishedResults = await payload.find({
collection: 'pages',
where: {
'blocks.blockType': {
contains: 'block-name',
},
},
})Confirm the document is returned.
Run the same query with draft: true:
const draftResults = await payload.find({
collection: 'pages',
draft: true,
where: {
'blocks.blockType': {
contains: 'block-name',
},
},
})Observe that draftResults.docs is empty.
Note that the versioned block row is stored with _path = 'version.blocks', but the draft query still filters on _path = 'blocks'.
Which area(s) are affected?
db: postgres
Environment Info
Binaries:
Node: 24.14.0
npm: 11.9.0
Yarn: N/A
pnpm: 10.27.0
Relevant Packages:
payload: 3.79.1
Operating System:
Platform: darwin
Arch: arm64
Version: Darwin Kernel Version 25.3.0: Wed Jan 28 20:55:08 PST 2026; root:xnu-12377.91.3~2/RELEASE_ARM64_T6020
Available memory (MB): 32768
Available CPU cores: 12
Reactions are currently unavailable
Metadata
Metadata
Assignees
Labels
db: postgres@payloadcms/db-postgres@payloadcms/db-postgres