PostgreSQL: Case insensitive string comparison
问题 Is there a simple ignore-case-comparison for PostgreSQL? I want to replace: SELECT id, user_name FROM users WHERE lower(email) IN (lower('adamB@a.com'), lower('eveA@b.com')); With something like: SELECT id, user_name FROM users WHERE email IGNORE_CASE_IN ('adamB@a.com', 'eveA@b.com'); The like and ilike operators work on single values (e.g. like 'adamB@a.com' ), but not on sets. 回答1: First, what not to do, don't use ilike... create table y ( id serial not null, email text not null unique );