pg.ddx.io  pgsql-bugs@postgresql.org mailing list archive  
help / color / mirror / Atom feed
From: Vik Fearing <vik@postgresfriends.org>
To: Daniel Gustafsson <daniel@yesql.se>
To: Tom Lane <tgl@sss.pgh.pa.us>
Cc: Peter Eisentraut <peter.eisentraut@enterprisedb.com>
Cc: David G. Johnston <david.g.johnston@gmail.com>
Cc: zedaardv@drizzle.com <zedaardv@drizzle.com>
Cc: pgsql-bugs@lists.postgresql.org <pgsql-bugs@lists.postgresql.org>
Subject: Re: BUG #17720: pg_dump creates a dump with primary key that cannot be restored, when specifying 'using index ...'
Date: Thu, 15 Dec 2022 16:30:36 +0100
Message-ID: <9344998b-e9aa-fdd8-9a7e-3f17811599fa@postgresfriends.org> (raw)
In-Reply-To: <9566C00C-6A3B-4CC7-8C7C-1A0477A5C752@yesql.se>
References: <17720-dab8ee0fa85d316d@postgresql.org>
	<CAKFQuwam=1NoSNH=EJRUnuuD8JE_jM8tq22-SYqO1nxzoXFwzg@mail.gmail.com>
	<9C039DE3-EFBD-4D65-B4CF-90D8148B7B4C@yesql.se>
	<2684951.1671032222@sss.pgh.pa.us>
	<20CD10FD-A9C2-47D0-9A75-B86532BC058E@yesql.se>
	<3039077.1671060472@sss.pgh.pa.us>
	<9566C00C-6A3B-4CC7-8C7C-1A0477A5C752@yesql.se>

On 12/15/22 14:18, Daniel Gustafsson wrote:
>> On 15 Dec 2022, at 00:27, Tom Lane <tgl@sss.pgh.pa.us> wrote:
>>
>> Daniel Gustafsson <daniel@yesql.se> writes:
>>> The attached prohibits the use of NULLS NOT DISTINCT for backing primary key
>>> constraints but allow them for unique constraints.  Is this along the lines of
>>> what you had in mind?
>>
>> Needs more than zero comments in the code, and why bother testing
>> is_alter_table in index_check_primary_key?  We're disallowing
>> this case across-the-board, no matter how you get to it.
> 
> That was an, admittedly poor, attempt at self-documenting code.  Removed and
> comments added in the attached.

[reviewing patch...]

If the point in adding a primary key USING INDEX is to avoid building an 
index, then this restriction defeats that purpose.  We have no ALTER 
INDEX command to switch or drop the <unique null treatment>.

Since the primary key can't have any nulls anyway, I think we should 
just flip this, perhaps with a NOTICE like the rename does.
-- 
Vik Fearing






view thread (22+ messages)  latest in thread

Message-ID: <9344998b-e9aa-fdd8-9a7e-3f17811599fa@postgresfriends.org>
Permalink:  ../9344998b-e9aa-fdd8-9a7e-3f17811599fa@postgresfriends.org/
Also on:    postgresql.org/message-id/9344998b-e9aa-fdd8-9a7e-3f17811599fa@postgresfriends.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 using the --to and --cc options:
  reply via email

  To: pgsql-bugs@postgresql.org
  Cc: vik@postgresfriends.org, daniel@yesql.se, tgl@sss.pgh.pa.us, peter.eisentraut@enterprisedb.com, david.g.johnston@gmail.com, zedaardv@drizzle.com, pgsql-bugs@lists.postgresql.org
  Subject: Re: BUG #17720: pg_dump creates a dump with primary key that cannot be restored, when specifying 'using index ...'
  In-Reply-To: <9344998b-e9aa-fdd8-9a7e-3f17811599fa@postgresfriends.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