Fix pg in query (#7207)

This commit is contained in:
Denis Bykhov 2024-11-21 09:15:44 +05:00 committed by GitHub
parent 6971dea915
commit 98bb4fe0ef
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194

View File

@ -1002,11 +1002,17 @@ abstract class PostgresAdapterBase implements DbAdapter {
res.push(`${tkey} <= '${val}'`) res.push(`${tkey} <= '${val}'`)
break break
case '$in': case '$in':
res.push( switch (type) {
type !== 'common' case 'common':
? `${tkey} ?| array[${val.length > 0 ? val.map((v: any) => `'${v}'`).join(', ') : 'NULL'}]` res.push(`${tkey} IN (${val.length > 0 ? val.map((v: any) => `'${v}'`).join(', ') : 'NULL'})`)
: `${tkey} IN (${val.length > 0 ? val.map((v: any) => `'${v}'`).join(', ') : 'NULL'})` break
) case 'array':
res.push(`${tkey} && array[${val.length > 0 ? val.map((v: any) => `'${v}'`).join(', ') : 'NULL'}]`)
break
case 'dataArray':
res.push(`${tkey} ?| array[${val.length > 0 ? val.map((v: any) => `'${v}'`).join(', ') : 'NULL'}]`)
break
}
break break
case '$nin': case '$nin':
if (val.length > 0) { if (val.length > 0) {