Re: multiset patch review

Поиск
Список
Период
Сортировка
От Itagaki Takahiro
Тема Re: multiset patch review
Дата
Msg-id AANLkTi=HC3dJapgLqGSGbHeXVWNZnqvYXBYWswjm_Txm@mail.gmail.com
обсуждение исходный текст
Ответ на Re: multiset patch review  (Peter Eisentraut <peter_e@gmx.net>)
Список pgsql-hackers
On Wed, Jan 12, 2011 at 15:21, Peter Eisentraut <peter_e@gmx.net> wrote:
> You may want to read this thread about the cardinality function are you
> trying to add:
>
> http://archives.postgresql.org/pgsql-hackers/2009-02/msg01388.php

Since our archive is split per month, this might be more readable:
http://postgresql.1045698.n5.nabble.com/cardinality-td2003172.html

We've discussed what number should cardinality() returns:#1. The total number of elements. (It's currently
implemented.)#2.The length of the first dimension.    It's as same as array_length(array, 1) .
 

I prefer #1 because we have no easy way to retrieve the number.
array_dims() returns similar numbers, but calculate the total
number is a bit complex.

If we will support array of arrays (jugged array), cardinality()
can return the number of elements in the most outer array.
It's similar definition in multi-dimensional arrays in C#,
that has both array of arrays and multi-dimensional arrays.

http://msdn.microsoft.com/library/system.array.length(v=VS.100).aspx

We can compare those SQL functions and C# array methods: * cardinality(array) <--> array.Length * array_length(array.
dim)<--> array.GetLength(dim)
 


> Also, what happened to the idea of a separate MULTISET type?

I don't have any plans to implement dedicated MULTISET type for now
because almost all functions and operators can work also for arrays.
If we have a true MULTISET data type, we can overload them with
MULTISET arguments.

One exception might be collect() aggregate function because
we might need to change the result type from array to multiset.   collect(anyelement) => anyarray for now
Note that fusion() won't be an issue because we can overload it:   fusion(anyarray) => anyarray and (anymultiset) =>
anymultiset

-- 
Itagaki Takahiro


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

Предыдущее
От: Fujii Masao
Дата:
Сообщение: Re: Streaming base backups
Следующее
От: Joel Jacobson
Дата:
Сообщение: Re: pg_depend explained