From: | Brendan Jurd <direvus(at)gmail(dot)com> |
---|---|
To: | Josh Berkus <josh(at)agliodbs(dot)com> |
Cc: | Greg Stark <stark(at)mit(dot)edu>, Merlin Moncure <mmoncure(at)gmail(dot)com>, Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us>, Andrew Dunstan <andrew(at)dunslane(dot)net>, Florian Pflug <fgp(at)phlo(dot)org>, Robert Haas <robertmhaas(at)gmail(dot)com>, pgsql-hackers(at)postgresql(dot)org |
Subject: | Re: [PATCH] Exorcise "zero-dimensional" arrays (Was: Re: Should array_length() Return NULL) |
Date: | 2013-06-11 22:09:03 |
Message-ID: | CADxJZo2-75LOuh7SPd=d=zrEAMzXsRnSQ31uTsgXFmZCJnR4PA@mail.gmail.com |
Views: | Raw Message | Whole Thread | Download mbox | Resend email |
Thread: | |
Lists: | pgsql-hackers |
On 12 June 2013 04:43, Josh Berkus <josh(at)agliodbs(dot)com> wrote:
> What's the status on this patch and current approach to ZDA?
Alright, it might be a good idea to have a quick recap.
Last time, on Arrays Of Our Lives ...
So I proposed and posted a patch aimed at deprecating zero-D arrays,
and replacing them with 1-D empty arrays.
That kicked off a long discussion, with some folks (Robert, Merlin,
Florian et al) vigorously opposing any change in the behaviour of the
array_(length|ndims|lower|upper) functions. To those folks, the
behaviour would have to be a lot worse than it currently is to justify
breaking compatibility with existing applications.
The idea of using a GUC to smooth over the compatibility break was
suggested, and firmly rejected.
The idea of creating an entirely new type with nicer behaviours came
up, but that wouldn't really fly because arrays have already hogged
all the best syntax.
Since compatibility breakage is so contentious, I suggested that we
forget about changing the array representation and just add new
functions with more sensible behaviours:
* cardinality(anyarray) to return the length of the first dimension,
zero if empty, and
* array_num_items(anyarray) to return the total number of element
positions per ArrayGetNItems, zero if empty.
There have been attempts to add a cardinality function in the past, as
it is required by the SQL spec, but these attempts have stalled when
trying to decide how it should handle multidim arrays. Having it
return the length of the first dimension is the more spec-compatible
way to go, but some folks argued that it should work as
ArrayGetNItems, because we don't already have a function for that at
the SQL level. Therefore I propose we add cardinality() per the spec,
and another function to expose ArrayGetNItems.
And that's about where we got to, when the whole discussion was put on
a time-out to make room for the beta.
I am withdrawing the original zero-D patch in favour of the proposed
new functions. If you have an opinion about that, please do chime in.
Depending on how that goes I may post a patch implementing my new
proposal in the next few days.
Cheers,
BJ
From | Date | Subject | |
---|---|---|---|
Next Message | Liming Hu | 2013-06-11 22:19:45 | Re: request a new feature in fuzzystrmatch |
Previous Message | Joe Conway | 2013-06-11 21:56:56 | Re: request a new feature in fuzzystrmatch |