Re: Custom ordering operator for type xid

From: Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us>
To: Alexander Lipatov <lipatov(at)mindbox(dot)cloud>
Cc: pgsql-admin(at)postgresql(dot)org
Subject: Re: Custom ordering operator for type xid
Date: 2024-06-17 15:03:58
Message-ID: 3179495.1718636638@sss.pgh.pa.us
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-admin

Alexander Lipatov <lipatov(at)mindbox(dot)cloud> writes:
> **Question**: Is it safe to create custom ordering operators for the `xid` 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

In response to

Responses

Browse pgsql-admin by date

  From Date Subject
Next Message Rui DeSousa 2024-06-17 15:33:17 Re: Custom ordering operator for type xid
Previous Message Laurenz Albe 2024-06-17 14:39:41 Re: Urgent: Segmentation Fault in PostgreSQL postmaster Process