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 1qCNaQ-0004dm-Di for pgsql-hackers@arkaria.postgresql.org; Thu, 22 Jun 2023 16:55:11 +0000 Received: from localhost ([127.0.0.1] helo=malur.postgresql.org) by malur.postgresql.org with esmtp (Exim 4.92) (envelope-from ) id 1qCNaP-0008OI-66 for pgsql-hackers@arkaria.postgresql.org; Thu, 22 Jun 2023 16:55:09 +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 1qCNaO-0008O8-Al for pgsql-hackers@lists.postgresql.org; Thu, 22 Jun 2023 16:55:08 +0000 Received: from wout2-smtp.messagingengine.com ([64.147.123.25]) by magus.postgresql.org with esmtps (TLS1.3) tls TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384 (Exim 4.94.2) (envelope-from ) id 1qCNaG-0043Dr-0P for pgsql-hackers@lists.postgresql.org; Thu, 22 Jun 2023 16:55:07 +0000 Received: from compute1.internal (compute1.nyi.internal [10.202.2.41]) by mailout.west.internal (Postfix) with ESMTP id E7475320093A; Thu, 22 Jun 2023 12:54:57 -0400 (EDT) Received: from mailfrontend1 ([10.202.2.162]) by compute1.internal (MEProxy); Thu, 22 Jun 2023 12:54:58 -0400 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=ilmari.org; h=cc :cc:content-type:content-type:date:date:from:from:in-reply-to :in-reply-to:message-id:mime-version:references:reply-to:sender :subject:subject:to:to; s=fm3; t=1687452897; x=1687539297; bh=Se WTTgH5PIVg1tpi9g+DmPM1JyLCSV0vKNV01A8WSGY=; b=dCXYBP5N8ISwuN/4UT kvu2b07vmUXNVDGLRYJNccKogutuZ/Hl0wwkAsViAz6safDWhTCfCxNUdf+DqWJ2 OzhW2529DBnp6O4RobWC+A/eNd/HdWRX3kLm4tA5D4g6YkVrutZ8D4F/JjnjalsI MaUW1ZzTl0yWdNkjRiFwlOwO1YnCN8wjuMBr73Cs/AnETjzqG23PFkshGYge9giw RjDPvWtYbydUwiKvaA5/uFiYtHIQYnGnCrg5sAixkCaA7MqIWyzzSMHvL629rlcI Ia+nXW3tHoXxs9XwJgT/m/dhOxCC9CbmP1X4TfiKQlvKddI7sJq+jOixJffnZfnf I7yA== DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d= messagingengine.com; h=cc:cc:content-type:content-type:date:date :feedback-id:feedback-id:from:from:in-reply-to:in-reply-to :message-id:mime-version:references:reply-to:sender:subject :subject:to:to:x-me-proxy:x-me-proxy:x-me-sender:x-me-sender :x-sasl-enc; s=fm2; t=1687452897; x=1687539297; bh=SeWTTgH5PIVg1 tpi9g+DmPM1JyLCSV0vKNV01A8WSGY=; b=hq5OAlWnyAxq8wJnem4pGwyU5w2x9 +h9Q7iB57BtUJNHs+Vodj6aW9pWUmY1vu8LVn7cftpKdEgHmg/AAXXcLAfujGYXX Btrr9Of2BTF62sea+37vFtxBy0UeiNIYR4i8wwx1jKSGcwUUh2+yo6ABBCRWrcHN Ba3eCqh/rid09Kp5xAYAXyLcFttK3swFxAM7Yr8h1L8AVRYoDnDNzkrtOVX42Pus 1V5opR+YwvQY7glyDaZbOp0406Ahd468WgIg/xlqS1royVM83zdbhDMB8Bn04mNy SZ3Cpzezdy2G5XQ6yQcLnQitpO363P/p7r/ZleaNcrVUxFTfYLL3JlF3A== X-ME-Sender: X-ME-Received: X-ME-Proxy-Cause: gggruggvucftvghtrhhoucdtuddrgedvhedrgeeguddguddtiecutefuodetggdotefrod ftvfcurfhrohhfihhlvgemucfhrghsthforghilhdpqfgfvfdpuffrtefokffrpgfnqfgh necuuegrihhlohhuthemuceftddtnecusecvtfgvtghiphhivghnthhsucdlqddutddtmd enucfjughrpefhvfevufhfffgjkfgfgggtsehttdertddtreejnecuhfhrohhmpeffrghg fhhinhhnucfklhhmrghrihcuofgrnhhnshonkhgvrhcuoehilhhmrghrihesihhlmhgrrh hirdhorhhgqeenucggtffrrghtthgvrhhnpeekleejueefhfffkefhkedtfeeluedvieei hfehfeeffeeggeduffduheejjeeigfenucevlhhushhtvghrufhiiigvpedtnecurfgrrh grmhepmhgrihhlfhhrohhmpehilhhmrghrihesihhlmhgrrhhirdhorhhg X-ME-Proxy: Feedback-ID: i1ff147bf:Fastmail Received: by mail.messagingengine.com (Postfix) with ESMTPA; Thu, 22 Jun 2023 12:54:56 -0400 (EDT) From: =?utf-8?Q?Dagfinn_Ilmari_Manns=C3=A5ker?= To: Tom Lane Cc: Tommy Pavlicek , pgsql-hackers@lists.postgresql.org, Tomas Vondra Subject: Re: [PATCH] Extend ALTER OPERATOR to support adding commutator, negator, hashes, and merges References: <4077062.1687452468@sss.pgh.pa.us> Date: Thu, 22 Jun 2023 17:54:54 +0100 In-Reply-To: <4077062.1687452468@sss.pgh.pa.us> (Tom Lane's message of "Thu, 22 Jun 2023 12:47:48 -0400") Message-ID: <87r0q3qvxd.fsf@wibble.ilmari.org> User-Agent: Gnus/5.13 (Gnus v5.13) Emacs/27.1 (gnu/linux) MIME-Version: 1.0 Content-Type: text/plain List-Id: List-Help: List-Subscribe: List-Post: List-Owner: List-Archive: Archived-At: Precedence: bulk Tom Lane writes: > Tommy Pavlicek writes: > >> Additionally, I wasn't sure whether it was preferred to fail or succeed on >> ALTERs that have no effect, such as adding hashes on an operator that >> already allows them or disabling hashes on one that does not. I chose to >> raise an error when this happens, on the thinking it was more explicit and >> made the code simpler, even though the end result would be what the user >> wanted. > > You could argue that both ways I guess. We definitely need to raise error > if the command tries to change an existing nondefault setting, since that > might break things as per previous discussion. But perhaps rejecting > an attempt to set the existing setting is overly nanny-ish. Personally > I think I'd lean to "don't throw an error if we don't have to", but I'm > not strongly set on that position. > > (Don't we have existing precedents that apply here? I can't offhand > think of any existing ALTER commands that would reject no-op requests, > but maybe that's not a direct precedent.) Since it only supports adding these operations if they don't already exist, should it not be ALTER OPERATOR ADD , not SET ? That makes it natural to add an IF NOT EXISTS clause, like ALTER TABLE ADD COLUMN has, to make it a no-op instead of an error. > regards, tom lane - ilmari