Skip to content

PostgreSQL:Constraints

제약조건

글자 수 제한

When you create the table you can do something of this sort,

CREATE TABLE names (
  name text CONSTRAINT namechk CHECK (char_length(name) <= 255)
)

(namechk is just a name for the constraint)

Same goes for ALTER TABLE for example:

ALTER TABLE names
  ADD CONSTRAINT namechk CHECK (char_length(name) <= 255);

Check Constraints

on delete cascade

on update cascade

See also

Favorite site