
But you need to read the sections "String Comparison Behavior" and "Limitations" in the docs before you decide to use citext. The advantage is that programmers don't have to remember to lowercase strings.

That is, it behaves as if you had called lower() on each string, as in number 3 above. Instead, it behaves as if each string were lowercased. The citext module doesn't provide a true case-insensitive data type. Of the index with queries like SELECT id FROM groups WHERE LOWER(name) = LOWER('ADMINISTRATOR'), or SELECT id FROM groups WHERE LOWER(name) = 'administrator' You have to remember to use LOWER(), though. (It also means you can't do case-sensitive queries. Just about any format from client code, and you'll still return Using a case-insensitive collation means you can accept This is set when you initialize aĭatabase. Having loaded that module, you can create a case-insensitive index by CREATE INDEX ON groups (name::citext). Use the citext module, which mostly mimics the behavior of a case-insensitive data type.There are at least three less frequently used solutions that might be more effective. On my test system, using lower() takesĪbout 2000 times longer than a query that can use an index.

Using functions like lower() and upper() will give you a sequential.Uppercase letter not every uppercase letter has a corresponding

Most languages.) Not every lowercase letter has a corresponding
