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}'`)
break
case '$in':
res.push(
type !== 'common'
? `${tkey} ?| array[${val.length > 0 ? val.map((v: any) => `'${v}'`).join(', ') : 'NULL'}]`
: `${tkey} IN (${val.length > 0 ? val.map((v: any) => `'${v}'`).join(', ') : 'NULL'})`
)
switch (type) {
case 'common':
res.push(`${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
case '$nin':
if (val.length > 0) {