pg.ddx.io  pgsql-bugs@postgresql.org mailing list archive  
help / color / mirror / Atom feed
From: Tom Lane <tgl@sss.pgh.pa.us>
To: David G. Johnston <david.g.johnston@gmail.com>
Cc: jian he <jian.universality@gmail.com>
Cc: pgsql-bugs@lists.postgresql.org <pgsql-bugs@lists.postgresql.org>
Subject: Re: (record = record) inconsistent with record_eq(arg1, arg2)
Date: Mon, 31 Jul 2023 16:07:04 -0400
Message-ID: <2947561.1690834024@sss.pgh.pa.us> (raw)
In-Reply-To: <CAKFQuwYEw-f6RSP0xzUNNMus=OcyGX-6GSOPorb3YtRPPEiyxg@mail.gmail.com>
References: <CACJufxF6T4-vOqg1eu_JGrXszTUaHUmmjzCQUcuF6W56dhS+Vw@mail.gmail.com>
	<CAKFQuwYEw-f6RSP0xzUNNMus=OcyGX-6GSOPorb3YtRPPEiyxg@mail.gmail.com>

"David G. Johnston" <david.g.johnston@gmail.com> writes:
> On Monday, July 31, 2023, jian he <jian.universality@gmail.com> wrote:
>> select row(1,null::int) = (1,1::int); -- return null
>> select record_eq(row(1,null::int),(1,1::int)); --return false.

> This isn’t a bug though I can’t point to the exact code where the
> difference manifests.

Yeah, the difference in behavior is deliberate.  See

https://www.postgresql.org/docs/current/functions-comparisons.html#ROW-WISE-COMPARISON

which documents the behavior of ROW(...) = ROW(...), and

https://www.postgresql.org/docs/current/functions-comparisons.html#COMPOSITE-TYPE-COMPARISON

which documents the behavior of record comparisons that are written
in other ways, and explains the reason for the difference.  The
SQL standard governs the behavior of "ROW(...) = ROW(...)", but last
I looked they don't really have a notion of composite-valued scalars,
so the spec has nothing to say about what "row-valued-expression =
row-valued-expression" should do.  Even if it did, we would not
change this, because it's too important to have a total ordering
for composite columns.

			regards, tom lane





view thread (3+ messages)

Message-ID: <2947561.1690834024@sss.pgh.pa.us>
Permalink:  ../2947561.1690834024@sss.pgh.pa.us/
Also on:    postgresql.org/message-id/2947561.1690834024@sss.pgh.pa.us

 · 

reply

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-bugs@postgresql.org
  Cc: tgl@sss.pgh.pa.us, david.g.johnston@gmail.com, jian.universality@gmail.com, pgsql-bugs@lists.postgresql.org
  Subject: Re: (record = record) inconsistent with record_eq(arg1, arg2)
  In-Reply-To: <2947561.1690834024@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