Re: array_length(anyarray)

Поиск
Список
Период
Сортировка
От Marko Tiikkaja
Тема Re: array_length(anyarray)
Дата
Msg-id 52DBBA5C.3030307@joh.to
обсуждение исходный текст
Ответ на Re: array_length(anyarray)  (Dean Rasheed <dean.a.rasheed@gmail.com>)
Ответы Re: array_length(anyarray)  (Dean Rasheed <dean.a.rasheed@gmail.com>)
Re: array_length(anyarray)  (Dean Rasheed <dean.a.rasheed@gmail.com>)
Список pgsql-hackers

On 1/19/14, 9:12 AM, Dean Rasheed wrote:
> On 18 January 2014 03:07, Marko Tiikkaja <marko@joh.to> wrote:
>> Here's the patch as promised.  Thoughts?
>>
>
> A couple of points:
>
> The answer for empty (zero dimensional) arrays is wrong --- you need
> special case handling for this case to return 0.

How embarrassing.  I don't know why I removed that check or how I didn't
catch the clearly wrong answer in the test output.

> In fact why not
> simply use ArrayGetNItems()?

Even better.  Changed.

> In the docs, in the table of array functions, I think it would
> probably be useful to make the entry for array_length say "see also
> cardinality", otherwise people might just stop reading there. I
> suspect that in over 90% of cases, cardinality will be the more
> appropriate function to use rather than array_length.

I don't see this as a huge improvement, but even worse, I don't see a
way to naturally fit it into the description.


New version attached, without the doc change.


Regards,
Marko Tiikkaja

Вложения

В списке pgsql-hackers по дате отправления:

Предыдущее
От: Emre Hasegeli
Дата:
Сообщение: Re: GiST support for inet datatypes
Следующее
От: David Rowley
Дата:
Сообщение: Re: [PATCH] Negative Transition Aggregate Functions (WIP)