pg.ddx.io  pgsql-committers@postgresql.org mailing list archive  
help / color / mirror / Atom feed
From: Daniel Gustafsson <dgustafsson@postgresql.org>
To: pgsql-committers@lists.postgresql.org
Subject: pgsql: Disallow NULLS NOT DISTINCT indexes for primary keys
Date: Fri, 24 Feb 2023 10:22:24 +0000
Message-ID: <E1pVVDc-000STi-BN@gemulon.postgresql.org> (raw)

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

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(-)



Message-ID: <E1pVVDc-000STi-BN@gemulon.postgresql.org>
Permalink:  ../E1pVVDc-000STi-BN@gemulon.postgresql.org/
Also on:    postgresql.org/message-id/E1pVVDc-000STi-BN@gemulon.postgresql.org

 · 

reply

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Reply to all the recipients from your mail client; the link fills in
  the headers below: reply via email
  Some clients, webmail especially, drop In-Reply-To and References from
  a link, and the reply then starts a new thread: use the mbox below.

  To: pgsql-committers@postgresql.org
  Cc: dgustafsson@postgresql.org
  Subject: Re: pgsql: Disallow NULLS NOT DISTINCT indexes for primary keys
  In-Reply-To: <E1pVVDc-000STi-BN@gemulon.postgresql.org>
  References: <E1pVVDc-000STi-BN@gemulon.postgresql.org>

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

This inbox is served by DDX for PostgreSQL; see mirroring instructions
for how to clone and mirror all data and code used for this inbox