Search Postgresql Archives

Re: array_reverse()

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



On Mon, Nov 2, 2009 at 9:20 AM, Tom Lane <tgl@xxxxxxxxxxxxx> wrote:
> Craig Ringer <craig@xxxxxxxxxxxxxxxxxxxxx> 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 (pgsql-general@xxxxxxxxxxxxxx)
To make changes to your subscription:
http://www.postgresql.org/mailpref/pgsql-general

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Index of Archives]     [Postgresql Jobs]     [Postgresql Admin]     [Postgresql Performance]     [Linux Clusters]     [PHP Home]     [PHP on Windows]     [Kernel Newbies]     [PHP Classes]     [PHP Books]     [PHP Databases]     [Postgresql & PHP]     [Yosemite]
  Powered by Linux