Received: from malur.postgresql.org ([217.196.149.56]) by arkaria.postgresql.org with esmtps (TLS1.3) tls TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384 (Exim 4.94.2) (envelope-from ) id 1qqJOv-009DdU-Ls for pgsql-hackers@arkaria.postgresql.org; Tue, 10 Oct 2023 20:32:21 +0000 Received: from localhost ([127.0.0.1] helo=malur.postgresql.org) by malur.postgresql.org with esmtp (Exim 4.94.2) (envelope-from ) id 1qqJOs-00ANh0-VJ for pgsql-hackers@arkaria.postgresql.org; Tue, 10 Oct 2023 20:32:19 +0000 Received: from makus.postgresql.org ([2001:4800:3e1:1::229]) by malur.postgresql.org with esmtps (TLS1.3) tls TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384 (Exim 4.94.2) (envelope-from ) id 1qqJOs-00ANgh-Ko for pgsql-hackers@lists.postgresql.org; Tue, 10 Oct 2023 20:32:19 +0000 Received: from sss.pgh.pa.us ([68.162.161.243]) by makus.postgresql.org with esmtps (TLS1.3) tls TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384 (Exim 4.94.2) (envelope-from ) id 1qqJOm-0010X2-HE for pgsql-hackers@lists.postgresql.org; Tue, 10 Oct 2023 20:32:18 +0000 Received: from sss1.sss.pgh.pa.us (localhost [127.0.0.1]) by sss.pgh.pa.us (8.15.2/8.15.2) with ESMTP id 39AKW7hw447167; Tue, 10 Oct 2023 16:32:07 -0400 From: Tom Lane To: Tommy Pavlicek cc: =?UTF-8?Q?Dagfinn_Ilmari_Manns=C3=A5ker?= , pgsql-hackers@lists.postgresql.org, Tomas Vondra , jian.universality@gmail.com Subject: Re: [PATCH] Extend ALTER OPERATOR to support adding commutator, negator, hashes, and merges In-reply-to: References: <4077062.1687452468@sss.pgh.pa.us> <87r0q3qvxd.fsf@wibble.ilmari.org> <4082750.1687455374@sss.pgh.pa.us> <15382.1687519306@sss.pgh.pa.us> <1092363.1695932314@sss.pgh.pa.us> Comments: In-reply-to Tommy Pavlicek message dated "Tue, 10 Oct 2023 21:12:50 +0100" MIME-Version: 1.0 Content-Type: text/plain; charset="us-ascii" Content-ID: <447165.1696969927.1@sss.pgh.pa.us> Date: Tue, 10 Oct 2023 16:32:07 -0400 Message-ID: <447166.1696969927@sss.pgh.pa.us> List-Id: List-Help: List-Subscribe: List-Post: List-Owner: List-Archive: Archived-At: Precedence: bulk Tommy Pavlicek writes: > I did notice one further potential bug. When creating an operator and > adding a commutator, PostgreSQL only links the commutator back to the > operator if the commutator has no commutator of its own, but the > create operation succeeds regardless of whether this linkage happens. > In other words, if A and B are a pair of commutators and one creates > another operator, C, with A as its commutator, then C will link to A, > but A will still link to B (and B to A). It's not clear to me if this > in itself is a problem, but unless I've misunderstood something > operator C must be the same as B so it implies an error by the user > and there could also be issues if A was deleted since C would continue > to refer to the deleted A. Yeah, it'd make sense to tighten that up. Per the discussion so far, we should not allow an operator's commutator/negator links to change once set, so overwriting the existing link with a different value would be wrong. But allowing creation of the new operator to proceed with a different outcome than expected isn't good either. I think we should start throwing an error for that. regards, tom lane