Re: array_length(anyarray)

Поиск
Список
Период
Сортировка
От Pavel Stehule
Тема Re: array_length(anyarray)
Дата
Msg-id CAFj8pRACMZxGeKsPQqYogrbK48JQ5g3gT5gMELwHoLH8CH-EGw@mail.gmail.com
обсуждение исходный текст
Ответ на Re: array_length(anyarray)  (Marko Tiikkaja <marko@joh.to>)
Список pgsql-hackers



2014/1/12 Marko Tiikkaja <marko@joh.to>
On 1/9/14, 2:57 PM, Dean Rasheed wrote:
Yes, this should just return the number of elements, and 0 for an empty array.

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].

Ignoring my proposal, this seems like the most reasonable option.  I'll send an updated patch along these lines.

+1

Pavel
 


Regards,
Marko Tiikkaja

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

Предыдущее
От: Pavel Stehule
Дата:
Сообщение: have to do move ready for commit patch from previous commitfest?
Следующее
От: Marko Tiikkaja
Дата:
Сообщение: plpgsql.consistent_into