What is the syntax to add a constraint on an already-created table? PostgreSQL exclusion constraints are documented briefly under


DDL-Constraints
CREATE TABLE .. CONSTRAINT .. EXCLUDE As linked in ddl-constraint


But, the syntax for ALTER TABLE does not mention /EXCLUDE/ anywhere. How do I add one if one is not already present.

I can in psql, TAB-complete

ALTER TABLE foo ADD


However subsequent tabs do not provide CONSTRAINT which the documentation mentions nor anything that comes after.
Follow the example here by ypercube

ALTER TABLE table_name
  ADD CONSTRAINT only_one_is_active_value_per_name
    EXCLUDE  USING gist
    ( name WITH =, 
      is_active WITH &lt;&gt; 
    );


The ALTER TABLE command only lists examples of constraints. Constraints are actually added with the same syntax on DDL-Constraints,

CREATE TABLE foo (
  -- stuff
  EXCLUDE USING gist ( name WITH =, is_active WITH &lt;&gt; );
);

ALTER TABLE foo
  ADD CONSTRAINT
  EXCLUDE USING gist ( name WITH =, is_active WITH &lt;&gt; );