I am creating a column in postgres that must only accept 10 characters. VARCHAR(10)
works in the sense that it allows data to be a maximum of 10 characters, however i cant seem to figure out a way to define a minimum.
How can one do this using 11.5 psql?
Add a constraint to the table that checks the length:
ALTER TABLE tbl ADD CONSTRAINT check_min_len CHECK (length(col) >= 10);