pgsql: Disallow NULLS NOT DISTINCT indexes for primary keys

From: Daniel Gustafsson <dgustafsson(at)postgresql(dot)org>
To: pgsql-committers(at)lists(dot)postgresql(dot)org
Subject: pgsql: Disallow NULLS NOT DISTINCT indexes for primary keys
Date: 2023-02-24 10:22:24
Message-ID: E1pVVDc-000STi-BN@gemulon.postgresql.org
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-committers

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(at)drizzle(dot)com>
Reviewed-by: Peter Eisentraut <peter(dot)eisentraut(at)enterprisedb(dot)com>
Reviewed-by: Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us>
Discussion: https://postgr.es/m/17720-dab8ee0fa85d316d@postgresql.org

Branch
------
master

Details
-------
https://git.postgresql.org/pg/commitdiff/d9595232579a3a9fadf4ce0b4cd58c1a3fc3b2f7

Modified Files
--------------
src/backend/catalog/index.c | 13 +++++++++++++
src/bin/pg_dump/pg_dump.c | 7 ++++++-
src/test/regress/expected/create_index.out | 6 ++++++
src/test/regress/sql/create_index.sql | 6 ++++++
4 files changed, 31 insertions(+), 1 deletion(-)

Browse pgsql-committers by date

  From Date Subject
Next Message Peter Eisentraut 2023-02-24 13:55:18 pgsql: Fix comment indentation and whitespace
Previous Message Daniel Gustafsson 2023-02-24 07:57:12 pgsql: pg_dump: Remove move "blob" terminology