Re: Some array semantics issues

From: Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us>
To: David Fetter <david(at)fetter(dot)org>
Cc: Greg Stark <gsstark(at)mit(dot)edu>, pgsql-hackers(at)postgresql(dot)org
Subject: Re: Some array semantics issues
Date: 2005-11-16 21:22:52
Message-ID: 11013.1132176172@sss.pgh.pa.us
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-hackers

David Fetter <david(at)fetter(dot)org> writes:
> On Wed, Nov 16, 2005 at 03:03:53PM -0500, Greg Stark wrote:
>> It occurs to me that it would also make sense to have an operator
>> that considered the arrays in an order-insensitive comparison.

> That sounds more like the SQL:2003 MULTISET, which is essentially
> unordered. Any plans for these?

Seems to me it would be really expensive to try to make such a
comparison directly with the present array representation. The
only sensible way to do it would be to sort the elements of the
two arrays (using the comparison operator of the element data type)
and then compare the results. So you don't actually need a variant
equality operator, you just need a generic array_sort() function,
and then go "array_sort(x) = array_sort(y)". Such a function might
have other uses besides this, too.

regards, tom lane

In response to

Browse pgsql-hackers by date

  From Date Subject
Next Message Rick Gigger 2005-11-16 21:29:13 Re: MERGE vs REPLACE
Previous Message David Fetter 2005-11-16 21:08:05 Re: Some array semantics issues