Skip to content

.tip

· one of the small things

text, not varchar(255)

In Postgres, text and varchar(n) perform exactly the same. The length limit is just a check constraint with a worse error message, and changing it later takes a migration.

name text NOT NULL CHECK (length(name) <= 200)

If you need a limit, write it as a constraint you can drop or change without rewriting the column type.

postgresqlschema-design