From: | Florian Pflug <fgp(at)phlo(dot)org> |
---|---|
To: | Dean Rasheed <dean(dot)a(dot)rasheed(at)gmail(dot)com> |
Cc: | Pavel Stehule <pavel(dot)stehule(at)gmail(dot)com>, David Fetter <david(at)fetter(dot)org>, Marko Tiikkaja <marko(at)joh(dot)to>, PostGreSql hackers <pgsql-hackers(at)postgresql(dot)org> |
Subject: | Re: array_length(anyarray) |
Date: | 2014-01-09 16:44:07 |
Message-ID: | 938B40F2-5CB2-4740-A557-532E1090AC2E@phlo.org |
Views: | Raw Message | Whole Thread | Download mbox | Resend email |
Thread: | |
Lists: | pgsql-hackers |
On Jan9, 2014, at 14:57 , Dean Rasheed <dean(dot)a(dot)rasheed(at)gmail(dot)com> wrote:
> On 19 December 2013 08:05, Pavel Stehule <pavel(dot)stehule(at)gmail(dot)com> wrote:
>> length should be irrelevant to fact so array starts from 1, 0 or anything
>> else
>
> Yes, this should just return the number of elements, and 0 for an empty array.
+1. Anything that complains about arrays whose lower bound isn't 1 really
needs a *way* less generic name than array_length().
>
> How it should behave for multi-dimensional arrays is less clear, but
> I'd argue that it should return the total number of elements, i.e.
> cardinality('{{1,2},{3,4}}'::int[][]) = 4. That would make it
> consistent with the choices we've already made for unnest() and
> ordinality:
> - cardinality(foo) = (select count(*) from unnest(foo)).
> - unnest with ordinality would always result in ordinals in the range
> [1, cardinality].
+1
best regards,
Florian Pflug
From | Date | Subject | |
---|---|---|---|
Next Message | Robert Haas | 2014-01-09 16:50:12 | Re: |
Previous Message | Florian Pflug | 2014-01-09 16:40:29 | Re: [PATCH] Negative Transition Aggregate Functions (WIP) |