citext
F.7. citext
The citext
module provides a case-insensitive character string type, citext
. Essentially, it internally calls lower
when comparing values. Otherwise, it behaves almost exactly like text
.
F.7.1. Rationale
The standard approach to doing case-insensitive matches in PostgreSQL has been to use the lower
function when comparing values, for example
SELECT * FROM tab WHERE lower(col) = LOWER(?);
This works reasonably well, but has a number of drawbacks:
-
It makes your SQL statements verbose, and you always have to remember to use
lower
on both the column and the query value. -
It won't