Benefit of TEXT with CHECK over VARCHAR(X) in PostgreSQL. Brandur suggests using email TEXT CHECK (char_length(email) <= 255)
to define a column with a length limit in PostgreSQL over VARCHAR(255)
because TEXT
and VARCHAR
are equally performant but a CHECK
length can be changed later on without locking the table, whereas a VARCHAR
requires an ALTER TABLE
with an exclusive lock.
Recent articles
- My AI/LLM predictions for the next 1, 3 and 6 years, for Oxide and Friends - 10th January 2025
- Weeknotes: Starting 2025 a little slow - 4th January 2025
- I still don't think companies serve you ads based on spying through your microphone - 2nd January 2025