Re: SQL-level pg_datum_image_equal

From: jian he <jian(dot)universality(at)gmail(dot)com>
To: Matthias van de Meent <boekewurm+postgres(at)gmail(dot)com>
Cc: PostgreSQL Hackers <pgsql-hackers(at)lists(dot)postgresql(dot)org>
Subject: Re: SQL-level pg_datum_image_equal
Date: 2025-12-20 13:14:46
Message-ID: CACJufxFV5KqmF86upFmX2tPzfKMWjWNf8+uYiYufLKatOsYXQw@mail.gmail.com
Views: Whole Thread | Raw Message | Download mbox | Resend email
Thread:
Lists: pgsql-hackers

On Thu, Dec 11, 2025 at 1:46 AM Matthias van de Meent
<boekewurm+postgres(at)gmail(dot)com> wrote:
>
> Hi,
>

>

> So, attached is a simple and to-the-point patch that adds the function
> mentioned in $subject, which will tell the user whether two values of
> the same type have an exactly equal binary representation, using
> datum_image_eq.
>

hi.

maybe Table 9.76
(https://www.postgresql.org/docs/current/functions-info.html#FUNCTIONS-INFO-CATALOG)
is the right place for this function.

corner case confused me, I think this is related to null handling,
maybe not related to this.
create type t1 as (a int, b text);
select pg_datum_image_equal('(,)'::t1, $$(,)$$::t1);
select pg_datum_image_equal('(,)'::t1, NULL::t1);
select '(,)'::t1 is null, NULL::t1 is null;

enforce_generic_type_consistency already resolved generic type.
see
select pg_datum_image_equal('1','1');
ERROR: could not determine polymorphic type because input has type unknown

so
+ if (!OidIsValid(typ))
+ {
+ ereport(ERROR,
+ (errcode(ERRCODE_FEATURE_NOT_SUPPORTED),
+ errmsg("could not determine type")));
+ }
this part should be elog(ERROR.....) ?

--
jian
https://www.enterprisedb.com/

In response to

Browse pgsql-hackers by date

  From Date Subject
Next Message Amit Langote 2025-12-20 14:12:03 Re: Batching in executor
Previous Message Kirill Reshke 2025-12-20 12:32:38 Re: eliminate xl_heap_visible to reduce WAL (and eventually set VM on-access)