Re: cardinality() - Mailing list pgsql-hackers

From Tom Lane
Subject Re: cardinality()
Date
Msg-id 12505.1235926160@sss.pgh.pa.us
Whole thread Raw
In response to Re: cardinality()  (Andrew Dunstan <andrew@dunslane.net>)
Responses Re: cardinality()  (Tom Lane <tgl@sss.pgh.pa.us>)
List pgsql-hackers
Andrew Dunstan <andrew@dunslane.net> writes:
> Grzegorz Jaskiewicz wrote:
>> On 1 Mar 2009, at 00:52, Andrew Dunstan wrote:
>>> We seem to have acquired a cardinality() function with almost no 
>>> discussion, and it has semantics that are a bit surprising to me. I 
>>> should have thought cardinality(array) would be the total number of 
>.> elements in the array. Instead, it seems it is a synonym for 
>>> array_length(array,1). Is that *really* what the standard says?

>> Standart just says something like:
>> cardinality (a collection):
>> - The number of elements in that collection.

The standard doesn't have multi-dimensional arrays, so it's entirely
possible that somewhere in it there is wording that makes cardinality()
equivalent to the length of the first dimension.  But I concur with
Andrew that this is flat wrong when extended to m-d arrays.
        regards, tom lane


pgsql-hackers by date:

Previous
From: Andrew Dunstan
Date:
Subject: Re: cardinality()
Next
From: Tom Lane
Date:
Subject: Re: cardinality()