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 1l6tFb-0004wT-73 for pgsql-hackers@arkaria.postgresql.org; Tue, 02 Feb 2021 10:49:39 +0000 Received: from localhost ([127.0.0.1] helo=malur.postgresql.org) by malur.postgresql.org with esmtp (Exim 4.92) (envelope-from ) id 1l6tFZ-0006mL-Tk for pgsql-hackers@arkaria.postgresql.org; Tue, 02 Feb 2021 10:49:37 +0000 Received: from makus.postgresql.org ([2001:4800:3e1:1::229]) by malur.postgresql.org with esmtps (TLS1.3:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.92) (envelope-from ) id 1l6tFZ-0006mE-Md for pgsql-hackers@lists.postgresql.org; Tue, 02 Feb 2021 10:49:37 +0000 Received: from forward2-smtp.messagingengine.com ([66.111.4.226]) by makus.postgresql.org with esmtps (TLS1.3:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.92) (envelope-from ) id 1l6tFX-0006Vk-4q for pgsql-hackers@postgresql.org; Tue, 02 Feb 2021 10:49:36 +0000 Received: from compute1.internal (compute1.nyi.internal [10.202.2.41]) by mailforward.nyi.internal (Postfix) with ESMTP id 3DE3C1941049; Tue, 2 Feb 2021 05:49:34 -0500 (EST) Received: from mailfrontend2 ([10.202.2.163]) by compute1.internal (MEProxy); Tue, 02 Feb 2021 05:49:34 -0500 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d= messagingengine.com; h=cc:content-transfer-encoding:content-type :date:from:in-reply-to:message-id:mime-version:references :subject:to:x-me-proxy:x-me-proxy:x-me-sender:x-me-sender :x-sasl-enc; s=fm2; bh=RuhXt51bl+04VaMkJtkIRe54GlUu5At64BzJz8Nve pY=; b=TCwlD4VDMsOkvm5NE0CSJK3N4E0M6pZSK9ff7J3p7MVboW42F5XABfQmY nlIqj3EpjPBmGvQn7zvF8g+J5/senWhDCQmdXUySj7BFwAVa71It0bu2eb2Wqyg8 0h++7msuY0Joprk1rgRcFqwL5SnYAr5EuKa9ctxqB9lK8fnjDIBqBvQizcRYeFs/ XkPIOmc3VoWSLUKNS7m8EWA6gxnSEG0bMP5noql8WfwbCy0a7y5zUhcjDidZKI0v paazTP43temHb5GnpacjJl8BsW0NfEtI6jaukpHbjacUOyTY4EgAlavn6zxvhJ2k Pwm7/WNjp5aKwhonitWUVBBXhnL0A== X-ME-Sender: X-ME-Proxy-Cause: gggruggvucftvghtrhhoucdtuddrgeduledrgedtgddvtdcutefuodetggdotefrodftvf curfhrohhfihhlvgemucfhrghsthforghilhdpqfgfvfdpuffrtefokffrpgfnqfghnecu uegrihhlohhuthemuceftddtnecusecvtfgvtghiphhivghnthhsucdlqddutddtmdenuc fjughrpefuvfhfhfhokffffgggjggtgfesthejredttdefjeenucfhrhhomheprfgvthgv rhcugfhishgvnhhtrhgruhhtuceophgvthgvrhdrvghishgvnhhtrhgruhhtsedvnhguqh hurggurhgrnhhtrdgtohhmqeenucggtffrrghtthgvrhhnpedtveeghedtjedvvedvleej ueevjeejtdellefgkeelfeeikeejlefgkedtudeuvdenucffohhmrghinhepvdhnughquh grughrrghnthdrtghomhenucfkphepkeejrddujeejrdeiledrudegtdenucevlhhushht vghrufhiiigvpedtnecurfgrrhgrmhepmhgrihhlfhhrohhmpehpvghtvghrrdgvihhsvg hnthhrrghuthesvdhnughquhgrughrrghnthdrtghomh X-ME-Proxy: Received: from april.pezone.net (p57b1458c.dip0.t-ipconnect.de [87.177.69.140]) by mail.messagingengine.com (Postfix) with ESMTPA id 492DE1080057; Tue, 2 Feb 2021 05:49:33 -0500 (EST) Subject: Re: Add primary keys to system catalogs To: Tom Lane , Joel Jacobson References: <348f3158-bf7e-c5f0-f33b-9e552e3d5481@2ndquadrant.com> <266949.1610921277@sss.pgh.pa.us> <4b5a1272-b6ea-d2e0-9b8f-3bec20109eb5@2ndquadrant.com> <906053.1611249356@sss.pgh.pa.us> <7512e697-baad-4471-a3c0-93a0114ea07f@www.fastmail.com> <1154909.1611330153@sss.pgh.pa.us> Cc: pgsql-hackers From: Peter Eisentraut Organization: 2ndQuadrant Message-ID: <2bc9a79e-cc70-a4bb-9083-8007104105e2@2ndquadrant.com> Date: Tue, 2 Feb 2021 11:49:32 +0100 User-Agent: Mozilla/5.0 (Macintosh; Intel Mac OS X 10.14; rv:52.0) Gecko/20100101 Thunderbird/52.9.1 MIME-Version: 1.0 In-Reply-To: <1154909.1611330153@sss.pgh.pa.us> Content-Type: text/plain; charset=utf-8; format=flowed Content-Language: en-US Content-Transfer-Encoding: 7bit List-Id: List-Help: List-Subscribe: List-Post: List-Owner: List-Archive: Precedence: bulk On 2021-01-22 16:42, Tom Lane wrote: >> pg_depend >> pg_shdepend > Yeah, this is noted in the patch's own regression tests. > >> Wouldn't it be possible to add primary keys to these two as well? > Neither of the existing indexes is suitable, not being unique. > > We could imagine adding a unique index across the whole column set, > but that would be an awfully large price to pay for neatnik-ism. > Also, at least for pg_depend (less sure about pg_shdepend), some code > cleanup would be required, because I don't think that we try very > hard to avoid making duplicate dependency entries. On the whole > I feel this'd be counterproductive. I did attempt to make a six- or seven-column unique constraint on pg_depend a while ago. This fails pretty much immediately during initdb. None of the code that adds dependencies, in particular recordMultipleDependencies(), checks if the dependency is already there. I do wonder, however, under what circumstances code would be put into a situation where it would add the exact same dependency again, and also under what circumstances it would add a dependency between the same objects but a different deptype, and how that would work during recursive deletion. Now that we have the refobjversion column, the presence of duplicate dependencies might be even more dubious. I think that could be worth analyzing. -- Peter Eisentraut 2ndQuadrant, an EDB company https://www.2ndquadrant.com/