Re: MULTISET and additional functions for ARRAY

Andres Freund <andres@anarazel.de>

From: Andres Freund <andres@anarazel.de>
To: pgsql-hackers@postgresql.org
Cc: Itagaki Takahiro <itagaki.takahiro@gmail.com>, Pavel Stehule <pavel.stehule@gmail.com>
Date: 2010-11-15T09:58:22Z
Lists: pgsql-hackers
On Monday 15 November 2010 09:47:15 Itagaki Takahiro wrote:
> On Mon, Nov 15, 2010 at 14:37, Pavel Stehule <pavel.stehule@gmail.com> 
wrote:
> > Maybe can be useful to implement a searching on sorted array.
> > You can hold a flag if multiset is sorted or not.
> 
> Are you suggesting to add an IS_SORTED bit to for each ArrayType value?
> It might be possible, but I'm not sure how much it is useful.
I actually wished for that several times and solved it by putting up 
is_sorted() constraints everywhere, but its a pain and restricts generallity.

(One was e.g. for implementing an efficent array_union() aggregate).

Andres