Re: BUG #18190: PL/pgSQL does not document comparison operations on RECORD (or ROW) types

From: "David G(dot) Johnston" <david(dot)g(dot)johnston(at)gmail(dot)com>
To: "kop(at)karlpinc(dot)com" <kop(at)karlpinc(dot)com>, "pgsql-bugs(at)lists(dot)postgresql(dot)org" <pgsql-bugs(at)lists(dot)postgresql(dot)org>
Subject: Re: BUG #18190: PL/pgSQL does not document comparison operations on RECORD (or ROW) types
Date: 2023-11-12 01:13:35
Message-ID: CAKFQuwa53Li4gL-orx6Cwt47rB6OvKzzppHHJubH7wvhZc9jSA@mail.gmail.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-bugs

On Friday, November 10, 2023, PG Bug reporting form <noreply(at)postgresql(dot)org>
wrote:

> The following bug has been logged on the website:
>
> Bug reference: 18190
> Logged by: Karl Pinc
> Email address: kop(at)karlpinc(dot)com
> PostgreSQL version: 15.4
> Operating system: Linux
> Description:
>
> Nothing is said about how to compare entire RECORD type variables, or ROW
> type variables.

There is, in the chapters with the word compare in their titles.

https://www.postgresql.org/docs/current/functions-comparison.html#FUNCTIONS-COMPARISON

https://www.postgresql.org/docs/current/functions-comparisons.html#FUNCTIONS-COMPARISONS

This leads to surprising behavior in the code below.

You couldn’t make something less difficult to read? Like a self-contained
select that shows true when you expected false? Or even a DO block with no
dynamic SQL?

IF problem IS NOT NULL THEN

As noted in the docs, “not (composite is null)” is not equivalent to
“composite is not null”; you usually want the former.

> If the issue is documentation, the PL/pgSQL docs should link to the
> composite type docs, or the expression docs, or type conversion, or where
> ever the current documentation is that I can't find or that needs to be
> written.
>
>
The behavior involved is in no way specific to pl/pgsql; it doesn’t seem
warranted to choose to link to SQL documentation from pl/pgsql generally.
The writer of such code can reference the SQL docs for any SQL they need to
write.

David J.

In response to

Responses

Browse pgsql-bugs by date

  From Date Subject
Next Message Karl O. Pinc 2023-11-12 15:22:44 Re: BUG #18190: PL/pgSQL does not document comparison operations on RECORD (or ROW) types
Previous Message Tom Lane 2023-11-11 23:43:26 Re: AW: BUG #18189: Value partitioned tables: Upd ERROR: more than one row returned by a subquery used as an expression