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 1sJDtt-003QC9-2r for pgsql-admin@arkaria.postgresql.org; Mon, 17 Jun 2024 15:04:05 +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 1sJDtp-000S0n-TG for pgsql-admin@arkaria.postgresql.org; Mon, 17 Jun 2024 15:04:02 +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 1sJDtp-000RzA-Hu for pgsql-admin@lists.postgresql.org; Mon, 17 Jun 2024 15:04:02 +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 1sJDtn-001lMT-U6 for pgsql-admin@postgresql.org; Mon, 17 Jun 2024 15:04:01 +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 45HF3wq13179496; Mon, 17 Jun 2024 11:03:58 -0400 From: Tom Lane To: Alexander Lipatov cc: pgsql-admin@postgresql.org Subject: Re: Custom ordering operator for type xid In-reply-to: <2EA9BF93-EE2B-4B84-B21D-5EA86FA63913@mindbox.cloud> References: <2EA9BF93-EE2B-4B84-B21D-5EA86FA63913@mindbox.cloud> Comments: In-reply-to Alexander Lipatov message dated "Mon, 17 Jun 2024 13:49:53 +0300" MIME-Version: 1.0 Content-Type: text/plain; charset="us-ascii" Content-ID: <3179494.1718636638.1@sss.pgh.pa.us> Content-Transfer-Encoding: quoted-printable Date: Mon, 17 Jun 2024 11:03:58 -0400 Message-ID: <3179495.1718636638@sss.pgh.pa.us> List-Id: List-Help: List-Subscribe: List-Post: List-Owner: List-Archive: Archived-At: Precedence: bulk Alexander Lipatov writes: > **Question**: Is it safe to create custom ordering operators for the `xi= d` type and a default operator class with these operators? I wouldn't do it, mainly because the semantics of what you've written have nothing to do with the actual behavior of xids. (The real comparison behavior is "circular", which can't be modeled as a total order, which is why there's not a built-in opclass already.) What is that ORM doing with XIDs anyway, and is there a good reason not to run away screaming from such an ill-thought-out product? I don't believe for a minute that this is going to be the only semantic issue you'll run into with an ORM that thinks it knows how XIDs behave despite a clear lack of even the most minimal investigation into the question. regards, tom lane