fix(db-postgres): search is broken when useAsTitle is not specified (#13232)

Fixes https://github.com/payloadcms/payload/issues/13171
This commit is contained in:
Sasha
2025-07-24 18:42:17 +03:00
committed by GitHub
parent 8f85da8931
commit a83ed5ebb5
2 changed files with 19 additions and 1 deletions

View File

@@ -219,7 +219,10 @@ export function parseParams({
if (
operator === 'like' &&
(field.type === 'number' || table[columnName].columnType === 'PgUUID')
(field.type === 'number' ||
field.type === 'relationship' ||
field.type === 'upload' ||
table[columnName].columnType === 'PgUUID')
) {
operator = 'equals'
}

View File

@@ -3001,6 +3001,21 @@ describe('database', () => {
}
})
it('should allow to query like by ID with draft: true', async () => {
const category = await payload.create({
collection: 'categories',
data: { title: 'category123' },
})
const res = await payload.find({
collection: 'categories',
draft: true,
// eslint-disable-next-line jest/no-conditional-in-test
where: { id: { like: typeof category.id === 'number' ? `${category.id}` : category.id } },
})
expect(res.docs).toHaveLength(1)
expect(res.docs[0].id).toBe(category.id)
})
it('should allow incremental number update', async () => {
const post = await payload.create({ collection: 'posts', data: { number: 1, title: 'post' } })