Re: INSERT UNIQUE row? - Mailing list pgsql-general

From Christophe Pettus
Subject Re: INSERT UNIQUE row?
Date
Msg-id 6669E40E-A427-4121-96FC-E4D90BFA6806@thebuild.com
Whole thread Raw
In response to INSERT UNIQUE row?  (pf@pfortin.com)
List pgsql-general
A UNIQUE index can have any number of columns, so you can create an index with all of the appropriate columns listed.
Thisis different from having a UNIQUE index on each individual column.  In the former case, all of the columns together
mustbe unique; in the latter case, as you mention, each index is evaluated separately. 

> On Jul 9, 2023, at 15:58, pf@pfortin.com wrote:
>
> Hi,
>
> Trying to figure out how to insert new property addresses into an
> existing table.
>
> Can a UNIQUE constraint be applied to an entire row?  Adding UNIQUE to
> each column won't work in such a case since there are multiple properties
> * on the same street
> * in the same town
> * with the same number on different streets
> * etc...
>
> Each row is only unique as an entity; but the columns are not...
>
> Is this covered in the docs?
>
> Thanks,
> Pierre
>
>
>




pgsql-general by date:

Previous
From: pf@pfortin.com
Date:
Subject: INSERT UNIQUE row?
Next
From: "David G. Johnston"
Date:
Subject: Re: INSERT UNIQUE row?