Disallow NULLS NOT DISTINCT indexes for primary keys
authorDaniel Gustafsson <dgustafsson@postgresql.org>
Fri, 24 Feb 2023 10:09:50 +0000 (11:09 +0100)
committerDaniel Gustafsson <dgustafsson@postgresql.org>
Fri, 24 Feb 2023 10:09:50 +0000 (11:09 +0100)
commitd9595232579a3a9fadf4ce0b4cd58c1a3fc3b2f7
tree4227113f54ca0385fc9a00046b81c099f004808f
parent94851e4b905042de559d073b6590039ab4598c7c
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
src/backend/catalog/index.c
src/bin/pg_dump/pg_dump.c
src/test/regress/expected/create_index.out
src/test/regress/sql/create_index.sql