Re: cardinality()

From: Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us>
To: Andrew Dunstan <andrew(at)dunslane(dot)net>
Cc: Grzegorz Jaskiewicz <gj(at)pointblue(dot)com(dot)pl>, PostgreSQL-development Hackers <pgsql-hackers(at)postgresql(dot)org>
Subject: Re: cardinality()
Date: 2009-03-01 16:49:20
Message-ID: 12505.1235926160@sss.pgh.pa.us
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-hackers

Andrew Dunstan <andrew(at)dunslane(dot)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

In response to

Responses

Browse pgsql-hackers by date

  From Date Subject
Next Message Tom Lane 2009-03-01 17:40:16 Re: cardinality()
Previous Message Andrew Dunstan 2009-03-01 15:30:46 Re: cardinality()