Disallow NULLS NOT DISTINCT indexes for primary keys

Daniel Gustafsson <dgustafsson@postgresql.org>

Commit: d9595232579a3a9fadf4ce0b4cd58c1a3fc3b2f7
Author: Daniel Gustafsson <dgustafsson@postgresql.org>
Date: 2023-02-24T10:09:50Z
Releases: 16.0
Disallow NULLS NOT DISTINCT indexes for primary keys

A unique index which is created with non-distinct NULLS cannot be
used for backing a primary key constraint.  Make sure to disallow
such table alterations and teach pg_dump to drop the non-distinct
NULLS clause on indexes where this has been set.

Bug: 17720
Reported-by: Reiner Peterke <zedaardv@drizzle.com>
Reviewed-by: Peter Eisentraut <peter.eisentraut@enterprisedb.com>
Reviewed-by: Tom Lane <tgl@sss.pgh.pa.us>
Discussion: https://postgr.es/m/17720-dab8ee0fa85d316d@postgresql.org

Files

Discussion