IN 运算符中的 Postgres 不区分大小写?

Postgres Case Insensitive in IN operator?

我的样本Sql是

select * from fruits where name in ('Orange','grape','APPLE','ManGO',etc....);//

Is possible to include ilike or ~* in IN Operator in Postgres?

我的解决方案是

select * from fruits where upper(name) in 
(upper('Orange'),upper('grape'),upper('APPLE'),upper('ManGO'),etc....);

我认为这不是正确的方法,请让我知道针对这种情况的任何最佳解决方案

您可以尝试将 ILIKEANY

一起使用
SELECT * 
FROM fruits 
WHERE name ILIKE ANY(array['Orange', 'grape', 'APPLE', 'ManGO']);

sqlfiddle