pg.ddx.io pgsql-docs@postgresql.org mailing list archive
help / color / mirror / Atom feedArray functions, array_length behavior given an empty array
4+ messages / 3 participants
[nested] [flat]
* Array functions, array_length behavior given an empty array
@ 2021-11-08 11:01 PG Doc comments form <noreply@postgresql.org>
2021-11-08 16:38 ` Re: Array functions, array_length behavior given an empty array Pavel Stehule <pavel.stehule@gmail.com>
0 siblings, 1 reply; 4+ messages in thread
From: PG Doc comments form @ 2021-11-08 11:01 UTC (permalink / raw)
To: pgsql-docs@lists.postgresql.org; +Cc: oleg.rekin@gmail.com
The following documentation comment has been logged on the website:
Page: https://www.postgresql.org/docs/13/functions-array.html
Description:
For whom it may concern,
I'd like to propose an extension for `array_length` function description.
Currently, it does not cover the case of an empty array:
https://www.postgresql.org/docs/13/functions-array.html
Table 9.52. Array Functions. Row 5
The description reads as `Returns the length of the requested array
dimension.`
For me, an expected result for an empty array would be `0`, but it is
`NULL`.
Tested on `PostgreSQL 13.4` with query `SELECT
ARRAY_LENGTH(ARRAY[]::CHARACTER VARYING[],1);`
I believe, such case deserves to be mentioned in the description and/or in
examples.
With best regards,
Oleg Rekin
^ permalink raw reply [nested|flat] 4+ messages in thread
* Re: Array functions, array_length behavior given an empty array
2021-11-08 11:01 Array functions, array_length behavior given an empty array PG Doc comments form <noreply@postgresql.org>
@ 2021-11-08 16:38 ` Pavel Stehule <pavel.stehule@gmail.com>
2021-11-08 17:11 ` Re: Array functions, array_length behavior given an empty array David G. Johnston <david.g.johnston@gmail.com>
0 siblings, 1 reply; 4+ messages in thread
From: Pavel Stehule @ 2021-11-08 16:38 UTC (permalink / raw)
To: oleg.rekin@gmail.com, Pg Docs <pgsql-docs@lists.postgresql.org>
Hi
po 8. 11. 2021 v 13:48 odesílatel PG Doc comments form <
noreply@postgresql.org> napsal:
> The following documentation comment has been logged on the website:
>
> Page: https://www.postgresql.org/docs/13/functions-array.html
> Description:
>
> For whom it may concern,
>
> I'd like to propose an extension for `array_length` function description.
>
> Currently, it does not cover the case of an empty array:
>
> https://www.postgresql.org/docs/13/functions-array.html
> Table 9.52. Array Functions. Row 5
>
> The description reads as `Returns the length of the requested array
> dimension.`
>
> For me, an expected result for an empty array would be `0`, but it is
> `NULL`.
> Tested on `PostgreSQL 13.4` with query `SELECT
> ARRAY_LENGTH(ARRAY[]::CHARACTER VARYING[],1);`
>
> I believe, such case deserves to be mentioned in the description and/or in
> examples.
>
you can read related discussion
https://pgsql-hackers.postgresql.narkive.com/lZJQ64dp/array-length-anyarray
Use instead function cardinality
Regards
Pavel Stehule
>
> With best regards,
> Oleg Rekin
>
^ permalink raw reply [nested|flat] 4+ messages in thread
* Re: Array functions, array_length behavior given an empty array
2021-11-08 11:01 Array functions, array_length behavior given an empty array PG Doc comments form <noreply@postgresql.org>
2021-11-08 16:38 ` Re: Array functions, array_length behavior given an empty array Pavel Stehule <pavel.stehule@gmail.com>
@ 2021-11-08 17:11 ` David G. Johnston <david.g.johnston@gmail.com>
2021-11-08 17:21 ` Re: Array functions, array_length behavior given an empty array Pavel Stehule <pavel.stehule@gmail.com>
0 siblings, 1 reply; 4+ messages in thread
From: David G. Johnston @ 2021-11-08 17:11 UTC (permalink / raw)
To: Pavel Stehule <pavel.stehule@gmail.com>; +Cc: oleg.rekin@gmail.com <oleg.rekin@gmail.com>; Pg Docs <pgsql-docs@lists.postgresql.org>
On Monday, November 8, 2021, Pavel Stehule <pavel.stehule@gmail.com> wrote:
> Hi
>
> po 8. 11. 2021 v 13:48 odesílatel PG Doc comments form <
> noreply@postgresql.org> napsal:
>
>> The following documentation comment has been logged on the website:
>>
>> I believe, such case deserves to be mentioned in the description and/or in
>> examples.
>>
>
> you can read related discussion https://pgsql-hackers.
> postgresql.narkive.com/lZJQ64dp/array-length-anyarray
>
> Use instead function cardinality
>
I believe the OP has a point that we could do better with the documentation
though. Especially now that we’ve performed the function table
reformatting.
David J.
^ permalink raw reply [nested|flat] 4+ messages in thread
* Re: Array functions, array_length behavior given an empty array
2021-11-08 11:01 Array functions, array_length behavior given an empty array PG Doc comments form <noreply@postgresql.org>
2021-11-08 16:38 ` Re: Array functions, array_length behavior given an empty array Pavel Stehule <pavel.stehule@gmail.com>
2021-11-08 17:11 ` Re: Array functions, array_length behavior given an empty array David G. Johnston <david.g.johnston@gmail.com>
@ 2021-11-08 17:21 ` Pavel Stehule <pavel.stehule@gmail.com>
0 siblings, 0 replies; 4+ messages in thread
From: Pavel Stehule @ 2021-11-08 17:21 UTC (permalink / raw)
To: David G. Johnston <david.g.johnston@gmail.com>; +Cc: oleg.rekin@gmail.com <oleg.rekin@gmail.com>; Pg Docs <pgsql-docs@lists.postgresql.org>
po 8. 11. 2021 v 18:11 odesílatel David G. Johnston <
david.g.johnston@gmail.com> napsal:
> On Monday, November 8, 2021, Pavel Stehule <pavel.stehule@gmail.com>
> wrote:
>
>> Hi
>>
>> po 8. 11. 2021 v 13:48 odesílatel PG Doc comments form <
>> noreply@postgresql.org> napsal:
>>
>>> The following documentation comment has been logged on the website:
>>>
>>> I believe, such case deserves to be mentioned in the description and/or
>>> in
>>> examples.
>>>
>>
>> you can read related discussion
>> https://pgsql-hackers.postgresql.narkive.com/lZJQ64dp/array-length-anyarray
>>
>> Use instead function cardinality
>>
>
> I believe the OP has a point that we could do better with the
> documentation though. Especially now that we’ve performed the function
> table reformatting.
>
+1
Pavel
> David J.
>
^ permalink raw reply [nested|flat] 4+ messages in thread
end of thread, other threads:[~2021-11-08 17:21 UTC | newest]
Thread overview: 4+ messages (download: mbox mbox.gz follow: Atom feed)
-- links below jump to the message on this page --
2021-11-08 11:01 Array functions, array_length behavior given an empty array PG Doc comments form <noreply@postgresql.org>
2021-11-08 16:38 ` Pavel Stehule <pavel.stehule@gmail.com>
2021-11-08 17:11 ` David G. Johnston <david.g.johnston@gmail.com>
2021-11-08 17:21 ` Pavel Stehule <pavel.stehule@gmail.com>
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