Closed timnghg closed 9 months ago
A unique index is different from a unique constraint (The latter contains a unique index automatically). Indexes are generally optimisations, whereas constraints are something you declare about your data, so we only use constraints when determining uniqueness.
You can use the ALTER TABLE … ADD CONSTRAINT … UNIQUE USING INDEX …
syntax to add a unique constraint using your existing unique index, which should be near-instant: https://www.postgresql.org/docs/current/sql-altertable.html
Do you think if it is intended and unrelated to #474?