On Mon, Nov 2, 2009 at 9:20 AM, Tom Lane <[email protected]> wrote:
> Craig Ringer <[email protected]> writes:
>> Before I go ahead and try to write a decent quality version: is there
>> any chance an array_reverse() function (in C) would be accepted into Pg
>> mainline?
>
> What would it mean for a multi-dimensional array?
Couple of possibilities?:
*) Could raise an error for ndim != 1
*) could reverse top dimension only only (I like this the best), so that:
reverse(array[array[1,2], array[3,4]]) -> {{3,4},{1,2}};
*) maybe overload the above so that:
reverse(array[array[1,2], array[3,4]], array[1]) -> {{2,1},{3,4}};
reverse(array[array[1,2], array[3,4]], array[2]) -> {{1,2},{4,3}};
The second term would be int array of 1 to ndim -1 dimensions, so you
can re-arrange an array slice without restacking it.
merlin
--
Sent via pgsql-general mailing list ([email protected])
To make changes to your subscription:
http://www.postgresql.org/mailpref/pgsql-general