doc: array_length produces null instead of 0

From: "David G(dot) Johnston" <david(dot)g(dot)johnston(at)gmail(dot)com>
To: PostgreSQL Hackers <pgsql-hackers(at)lists(dot)postgresql(dot)org>
Subject: doc: array_length produces null instead of 0
Date: 2022-06-10 00:30:27
Message-ID: CAKFQuwaoBmRuWdMLzLHDCFDJDX3wvfQ7egAF0bpik_BFgG1KWg@mail.gmail.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-hackers

Hi,

Per discussion here:

https://www.postgresql.org/message-id/163636931138.8076.5140809232053731248%40wrigleys.postgresql.org

We can now easily document the array_length behavior of returning null
instead of zero for an empty array/dimension.

I added an example to the json_array_length function to demonstrate that it
does return 0 as one would expect, but contrary to the SQL array behavior.

I did not bother to add examples to the other half dozen or so "_length"
functions that all produce 0 as expected. Just the surprising case and the
adjacent one.

David J.

Attachment Content-Type Size
0001-doc-array_length-produces-null-instead-of-0.patch application/octet-stream 1.4 KB

Responses

Browse pgsql-hackers by date

  From Date Subject
Next Message Peter Geoghegan 2022-06-10 00:32:23 Re: Collation version tracking for macOS
Previous Message Thomas Munro 2022-06-10 00:18:06 Re: Collation version tracking for macOS