Re: array_reverse() - Mailing list pgsql-general

From Merlin Moncure
Subject Re: array_reverse()
Date
Msg-id b42b73150911020655p6aece63bpefc9ef62539c2a2d@mail.gmail.com
Whole thread Raw
In response to Re: array_reverse()  (Sam Mason <sam@samason.me.uk>)
Responses Re: array_reverse()  (Sam Mason <sam@samason.me.uk>)
List pgsql-general
On Mon, Nov 2, 2009 at 9:51 AM, Sam Mason <sam@samason.me.uk> wrote:
> On Mon, Nov 02, 2009 at 09:20:38AM -0500, Tom Lane wrote:
>> Craig Ringer <craig@postnewspapers.com.au> 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?
>
> Rotating the array by 180 degrees in every dimension would give the same
> answer for 1-dimensional arrays and give sensible answers for higher
> dimensional arrays.  For example:
>
>  1,2,3   ==  3,2,1
>
>  [1 2 3     [9 8 7
>   4 5 6  ==  6 5 4
>   7 8 9]     3 2 1]
>
> I think higher dimensionality would work, it's just a bit fiddly to
> draw.

do you think that's the typical case, or is it more common to want to
reverse a particular slice?  (I like your idea actually, because if
you need a slice you can slice notation one out...better than what I
posted above).

merlin

pgsql-general by date:

Previous
From: Tom Lane
Date:
Subject: Re: pk vs unique not null differences between 8.3.4 and 8.3.8
Next
From: Tom Lane
Date:
Subject: Re: array_reverse()