Re: Enforcing uniqueness on [real estate/postal] addresses
| От | David G. Johnston |
|---|---|
| Тема | Re: Enforcing uniqueness on [real estate/postal] addresses |
| Дата | |
| Msg-id | CAKFQuwbvAGvqwb=0uj2fP-eReGt=+GKojpOCagOWnUU-0XaySA@mail.gmail.com обсуждение исходный текст |
| Ответ на | Enforcing uniqueness on [real estate/postal] addresses (Peter Devoy <peter@3xe.co.uk>) |
| Список | pgsql-general |
On Mon, May 11, 2020 at 9:56 AM Peter Devoy <peter@3xe.co.uk> wrote:
I need to store addresses for properties (as in real estate) so in my
naivety I created a unique constraint like this:
ALTER TABLE properties
ADD CONSTRAINT is_unique_address
UNIQUE (
description, --e.g. Land north of Foo Cottage
address_identifier_general,
street,
postcode
);
Please can anyone recommend a way of approaching this? Perhaps empty strings
are pragmatic in this situation?
Don't add a unique table constraint (aside from an artificial primary key).
Then, if you can define a problem where you feel having a unique table constraint over the field is the correct solution - especially given the fact that you can have missing data in the relevant fields - you should post the problem and take suggestions on ways to solve it.
David J.
В списке pgsql-general по дате отправления: