From 67ca63dace7ed7a190c3a8c3aa15390ca257fab7 Mon Sep 17 00:00:00 2001
From: Andrey Sobolev <haiodo@gmail.com>
Date: Sat, 18 Jan 2025 23:38:46 +0700
Subject: [PATCH] QFIX: PG query

Signed-off-by: Andrey Sobolev <haiodo@gmail.com>
---
 server/postgres/src/storage.ts | 3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)

diff --git a/server/postgres/src/storage.ts b/server/postgres/src/storage.ts
index 2286109a4e..3fdb7d997d 100644
--- a/server/postgres/src/storage.ts
+++ b/server/postgres/src/storage.ts
@@ -1267,7 +1267,8 @@ abstract class PostgresAdapterBase implements DbAdapter {
             switch (type) {
               case 'common':
                 if (Array.isArray(val) && val.includes(null)) {
-                  res.push(`(${tkey} = ANY(${vars.addArray(val, inferType(val))})) OR ${tkey} IS NULL`)
+                  const vv = vars.addArray(val, inferType(val))
+                  res.push(`(${tkey} = ANY(${vv}) OR ${tkey} IS NULL)`)
                 } else {
                   if (val.length > 0) {
                     res.push(`${tkey} = ANY(${vars.addArray(val, inferType(val))})`)