我在 Postgres 表上运行如下查询:
Column | Type | Modifiers
------------------+-----------------------------+--------------------
status | character varying(16)
select FROM incoming_requests WHERE COALESCE(TRIM(status), '') IN ('','OK','ERROR');
这似乎工作正常,但低于
select FROM incoming_requests WHERE COALESCE(TRIM(status), '') = ANY ('','OK','ERROR');
ERROR: syntax error at or near ","
LINE 1: ...quests WHERE COALESCE(TRIM(status), '') = ANY (" ","OK","ERR...
select FROM incoming_requests WHERE COALESCE(TRIM(status), '') = ANY (" ","OK","ERROR");
ANY
还建议使用或在性能上是否有任何差异IN
不,没有区别
db<>在这里摆弄