Skip to content

Commit

Permalink
Fix pg in query (#7207)
Browse files Browse the repository at this point in the history
  • Loading branch information
BykhovDenis authored Nov 21, 2024
1 parent 6971dea commit 98bb4fe
Showing 1 changed file with 11 additions and 5 deletions.
16 changes: 11 additions & 5 deletions server/postgres/src/storage.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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) {
Expand Down

0 comments on commit 98bb4fe

Please sign in to comment.