Disallow NULLS NOT DISTINCT indexes for primary keys
Daniel Gustafsson <dgustafsson@postgresql.org>
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
| Path | Change | +/− |
|---|---|---|
| src/backend/catalog/index.c | modified | +13 −0 |
| src/bin/pg_dump/pg_dump.c | modified | +6 −1 |
| src/test/regress/expected/create_index.out | modified | +6 −0 |
| src/test/regress/sql/create_index.sql | modified | +6 −0 |
Discussion
- BUG #17720: pg_dump creates a dump with primary key that cannot be restored, when specifying 'using index ...' 22 messages · 2022-12-14 → 2023-02-23