Should array_length() Return NULL

From: "David E(dot) Wheeler" <david(at)justatheory(dot)com>
To: "pgsql-hackers(at)postgresql(dot)org Hackers" <pgsql-hackers(at)postgresql(dot)org>
Subject: Should array_length() Return NULL
Date: 2013-03-15 21:56:32
Message-ID: BDFA4E0A-4B50-4BF4-8126-91DC5214130D@justatheory.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-hackers

Hackers,

This surprised me:

david=# select array_length('{}'::text[], 1);
array_length
--------------
[null]

I had expecte dit to retur 0. I might expect NULL for a NULL param, but not one that's defined but has no elements.

Best,

David

Responses

Browse pgsql-hackers by date

  From Date Subject
Next Message Tom Lane 2013-03-15 22:00:21 Re: in-catalog Extension Scripts and Control parameters (templates?)
Previous Message Tom Lane 2013-03-15 21:47:30 Re: Re: Doc patch making firm recommendation for setting the value of commit_delay