Something else I noticed: the error message from ALTER TABLE ... ADD
CONSTRAINT in the case of a duplicate constraint name is not very
friendly:
ERROR: duplicate key value violates unique constraint
"pg_constraint_conrelid_contypid_conname_index"
DETAIL: Key (conrelid, contypid, conname)=(16540, 0, nn) already exists.
To match the error message for other constraint types, this should be:
ERROR: constraint "nn" for relation "foo" already exists
Regards,
Dean