从nodejs服务器搜索Postgres中的数组字段

Searching array field in Postgres from nodejs server

此查询:select * from test where all_ids && array['Cff203176c6d007c1a5b1111e0978221d', 'Cfef30ccc18809aeb413e94101eac0684', 'Cfe6e67da4edd16cd9f022fee1f11bfdf', 'Cfe5a61f4e6dd546abc8e5d9f84bdc43b']; 适用于 postgres,其中 all_ids 是 text[] 数据类型。返回四个结果。

但是当我从 nodejs 应用程序 运行 使用 pg 模块时,例如:

const { rows, rowCount } = await conn.query('SELECT * FROM test WHERE all_ids && array[]', [ids]);

我得到零行。 ids 是一个字符串数组,其中包含上面的值。这在 node-postgres 中没有启用吗?

这种查询有效:

const { rows, rowCount } = await conn.query('SELECT * FROM test WHERE all_ids && ::text[]', [ids]);