I'm try to bring all index creations to the same style. This article says that add constraint ... unique
better than create index unique
. And now I have a problem with indexes that contains ((case ...))
.
Can I use add constraint ... unique
for this?
CodePudding user response:
Different from indexes, constraints can only be defined on columns, not on expressions. So if you need to enforce uniqueness on expressions, you have to CREATE UNIQUE INDEX
.