Received: from malur.postgresql.org ([217.196.149.56]) by arkaria.postgresql.org with esmtps (TLS1.3:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.92) (envelope-from ) id 1p5qC8-0006vD-84 for pgsql-bugs@arkaria.postgresql.org; Thu, 15 Dec 2022 15:30:48 +0000 Received: from localhost ([127.0.0.1] helo=malur.postgresql.org) by malur.postgresql.org with esmtp (Exim 4.92) (envelope-from ) id 1p5qC5-0002iR-9q for pgsql-bugs@arkaria.postgresql.org; Thu, 15 Dec 2022 15:30:45 +0000 Received: from magus.postgresql.org ([2a02:c0:301:0:ffff::29]) by malur.postgresql.org with esmtps (TLS1.3:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.92) (envelope-from ) id 1p5qC5-0002gy-1g for pgsql-bugs@lists.postgresql.org; Thu, 15 Dec 2022 15:30:45 +0000 Received: from relay1-d.mail.gandi.net ([217.70.183.193]) by magus.postgresql.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.92) (envelope-from ) id 1p5qC2-0006to-TM for pgsql-bugs@lists.postgresql.org; Thu, 15 Dec 2022 15:30:44 +0000 Received: (Authenticated sender: vik@postgresfriends.org) by mail.gandi.net (Postfix) with ESMTPSA id 81AAB24000D; Thu, 15 Dec 2022 15:30:37 +0000 (UTC) Message-ID: <9344998b-e9aa-fdd8-9a7e-3f17811599fa@postgresfriends.org> Date: Thu, 15 Dec 2022 16:30:36 +0100 MIME-Version: 1.0 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:102.0) Gecko/20100101 Thunderbird/102.4.2 Subject: Re: BUG #17720: pg_dump creates a dump with primary key that cannot be restored, when specifying 'using index ...' Content-Language: en-US To: Daniel Gustafsson , Tom Lane Cc: Peter Eisentraut , "David G. Johnston" , "zedaardv@drizzle.com" , "pgsql-bugs@lists.postgresql.org" References: <17720-dab8ee0fa85d316d@postgresql.org> <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> From: Vik Fearing In-Reply-To: <9566C00C-6A3B-4CC7-8C7C-1A0477A5C752@yesql.se> Content-Type: text/plain; charset=UTF-8; format=flowed Content-Transfer-Encoding: 7bit List-Id: List-Help: List-Subscribe: List-Post: List-Owner: List-Archive: Archived-At: Precedence: bulk On 12/15/22 14:18, Daniel Gustafsson wrote: >> On 15 Dec 2022, at 00:27, Tom Lane wrote: >> >> Daniel Gustafsson 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 . 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