Re: SQL-level pg_datum_image_equal

From: Matthias van de Meent <boekewurm+postgres(at)gmail(dot)com>
To: Alberto Piai <alberto(dot)piai(at)gmail(dot)com>
Cc: David Rowley <dgrowleyml(at)gmail(dot)com>, solai v <solai(dot)cdac(at)gmail(dot)com>, Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us>, jian he <jian(dot)universality(at)gmail(dot)com>, PostgreSQL Hackers <pgsql-hackers(at)lists(dot)postgresql(dot)org>, Heikki Linnakangas <hlinnaka(at)iki(dot)fi>
Subject: Re: SQL-level pg_datum_image_equal
Date: 2026-10-14 14:25:33
Message-ID: CAEze2Wi2-vzsRXm1U21DQDuvS=cWqE2GEVv9Uc0-jnPOOZLPHw@mail.gmail.com
Views: Whole Thread | Raw Message | Download mbox | Resend email
Thread:
Lists: pgsql-hackers

On Fri, 2 Oct 2026 at 01:34, Alberto Piai <alberto(dot)piai(at)gmail(dot)com> wrote:
>
> I wonder what would be the downsides of exposing this function: the
> notion of image equality is already user-visible through pg_catalog.*=
> (record_image_eq).

I've thought about it, but I couldn't think of any. Adding
pg_datum_image_equal actually means that users won't have to go
through expensive record (de)construction for binary equality, which
would be a very useful performance improvement.

> One risk of course is users assuming that some values are equal, and
> then being surprised when more updates happen than expected, in
> Matthias' use case of data synchronization tools.

What do you mean by "more updates than expected"?

> For pg_datum_image_equal(), we could write something along the lines of
>
> This function is intended for specialized purposes such as data
> synchronization tools. It is not generally useful for writing queries,
> as it might consider two values as different, even though a comparison
> with the equality operator would return true.

I don't think this is useful. The distinction is already made
sufficiently clear in the added docs, and because the function doesn't
map to indexable operators there's little chance people will
accidentally use this when they actually want their type's = operator.

Kind regards,

Matthias van de Meent
Databricks (https://www.databricks.com)

In response to

Browse pgsql-hackers by date

  From Date Subject
Next Message David Geier 2026-10-14 14:39:47 Re: Improving scalability of Parallel Bitmap Heap/Index Scan
Previous Message Aleksander Alekseev 2026-10-14 14:12:23 Re: serializable anomaly - duplicate primary keys