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
- Qwen2.5-Coder-32B is an LLM that can code well that runs on my Mac - 12th November 2024
- Visualizing local election results with Datasette, Observable and MapLibre GL - 9th November 2024
- Project: VERDAD - tracking misinformation in radio broadcasts using Gemini 1.5 - 7th November 2024