PostGreSQL and citext

Tags: #<Tag:0x00007fc0dd5ebfa0>

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.

CREATE EXTENSION citext;

CREATE TABLE users (
    nick CITEXT PRIMARY KEY,
    pass TEXT   NOT NULL
);