jakob / Postico

Public issue tracking for Postico
https://eggerapps.at/postico/
476 stars 9 forks source link

Multi-column Unique Constraints #29

Open emaddoma opened 9 years ago

emaddoma commented 9 years ago

Would be cool to support this

trapias commented 9 years ago

+1

qwesda commented 7 years ago

Can probably be closed. Multi-column unique constraints are visible and can be created/deleted.

jakob commented 7 years ago

@qwesda Only the indices are displayed. You can create (and later drop) a unique index, but you can't drop a unique index that belongs to a unique constraint.

When you create a UNIQUE constraint (using ALTER TABLE ... ADD UNIQUE (...), PostgreSQL creates a CONSTRAINT and a UNIQUE INDEX. You can't drop the INDEX, you have to drop the CONSTRAINT.

If you just create a UNIQUE INDEX, PostgreSQL doesn't create a CONSTRAINT, and you can drop the index normally.

Both methods prevent duplicate entries, but only the former shows up in the pg_constraint column.

This is pretty confusing.

TLDR: Issue needs to stay open!

dmr07 commented 7 years ago

+1