complete-intro-to-sql icon indicating copy to clipboard operation
complete-intro-to-sql copied to clipboard

Bug in the description of the `UNIQUE` constraint in the Constraints section

Open alfonso-higuera opened this issue 1 year ago • 0 comments

In the Constraints section the following is stated:

UNIQUE is another constraint that dictates that this column must be unqiue amongst all other columns

I don't think this is accurate, or at least I feel this is easy to misinterpret. According to section 5.4.3. Unique Constraints of the PostgreSQL (version 14) manual

Unique constraints ensure that the data contained in a column, or a group of columns, is unique among all the rows in the table

So, to my understanding, the UNIQUE constraint does not constraint a column (or group of columns) relative to "all the other columns" but instead it constraint the values that a column (or group or columns) can have relative to the values in that column for all the rows in the table.

alfonso-higuera avatar Dec 27 '24 19:12 alfonso-higuera