Skip to content


Unique constraint
When adding a unique constraint with several columns, it is possible to add a duplicate row with null values.
CREATE UNIQUE INDEX unique_every ON locations(name, street,number);
It is possible to add ‘Tuinhuis, gemeentestraat’ twice if the number contains a null value.
Solution: defaulting null values to ” or creating a partial index

Published inPostgres

Be First to Comment

Leave a Reply

Your email address will not be published. Required fields are marked *