From: Tom Lane <tgl@sss.pgh.pa.us>
To: Tommy Pavlicek <tommypav122@gmail.com>
Cc: Dagfinn Ilmari Mannsåker <ilmari@ilmari.org>
Cc: pgsql-hackers@lists.postgresql.org, Tomas Vondra <tomas.vondra@enterprisedb.com>
Cc: jian.universality@gmail.com
Subject: Re: [PATCH] Extend ALTER OPERATOR to support adding commutator, negator, hashes, and merges
Date: Tue, 10 Oct 2023 16:32:07 -0400
Message-ID: <447166.1696969927@sss.pgh.pa.us> (raw)
In-Reply-To: <CAEhP-W8MjoA0yDCipp=FgZvoQA-OVjQws3-XO6bpCWXunO8t8A@mail.gmail.com>
References: <CAEhP-W-vGVzf4udhR5M8Bdv88UYnPrhoSkj3ieR3QNrsGQoqdg@mail.gmail.com>
<4077062.1687452468@sss.pgh.pa.us>
<87r0q3qvxd.fsf@wibble.ilmari.org>
<4082750.1687455374@sss.pgh.pa.us>
<CAEhP-W_xGQVmiEJE_x0x5bbDSwsmaN1TQEawNadiMvQj2XK2Sg@mail.gmail.com>
<15382.1687519306@sss.pgh.pa.us>
<CAEhP-W-bY5CTXgrsH_J=NyKJpqMOgUPqMQ9-oTtx2N+zND1ZuA@mail.gmail.com>
<1092363.1695932314@sss.pgh.pa.us>
<CAEhP-W8MjoA0yDCipp=FgZvoQA-OVjQws3-XO6bpCWXunO8t8A@mail.gmail.com>
Tommy Pavlicek <tommypav122@gmail.com> 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
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-hackers@postgresql.org
Cc: tgl@sss.pgh.pa.us, tommypav122@gmail.com, ilmari@ilmari.org, tomas.vondra@enterprisedb.com, jian.universality@gmail.com
Subject: Re: [PATCH] Extend ALTER OPERATOR to support adding commutator, negator, hashes, and merges
In-Reply-To: <447166.1696969927@sss.pgh.pa.us>
* 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