Re: doc: array_length produces null instead of 0

From: Bruce Momjian <bruce(at)momjian(dot)us>
To: "David G(dot) Johnston" <david(dot)g(dot)johnston(at)gmail(dot)com>
Cc: Aleksander Alekseev <aleksander(at)timescale(dot)com>, PostgreSQL Hackers <pgsql-hackers(at)lists(dot)postgresql(dot)org>
Subject: Re: doc: array_length produces null instead of 0
Date: 2022-07-09 00:24:52
Message-ID: YsjK1JO7E5rOegYn@momjian.us
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-hackers

On Tue, Jun 21, 2022 at 09:02:41AM -0700, David G. Johnston wrote:
> On Tue, Jun 21, 2022 at 6:33 AM Aleksander Alekseev <aleksander(at)timescale(dot)com>
> Maybe it's worth using `array_length(array[] :: int[], 1)` instead.
>
> I think subconsciously the cast looked ugly to me so I probably skipped adding
> it.  I do agree the example should be executable though, and most of the
> existing examples use integer[] (not the abbreviated form, int) so I'll plan to
> go with that.

Patch applied through PG 13, with adjustments suggested above. Our doc
formatting for pre-PG 13 was too different for me to risk backpatching
further back.

--
Bruce Momjian <bruce(at)momjian(dot)us> https://momjian.us
EDB https://enterprisedb.com

Indecision is a decision. Inaction is an action. Mark Batterson

In response to

Browse pgsql-hackers by date

  From Date Subject
Next Message Bruce Momjian 2022-07-09 01:11:43 Re: doc: Bring mention of unique index forced transaction wait behavior outside of the internal section
Previous Message Yura Sokolov 2022-07-09 00:02:53 Re: [PATCH] fix wait_event of pg_stat_activity in case of high amount of connections