Re: [HACKERS] Fast REVERSE() function?

2008-09-08 Thread Chris Browne
[EMAIL PROTECTED] (hubert depesz lubaczewski) writes: > On Mon, Sep 08, 2008 at 11:20:18AM -0400, Chris Browne wrote: >> I've got a case where I need to reverse strings, and find that, oddly >> enough, there isn't a C-based reverse() function. >> A search turns up pl/pgsql and SQL implementations:

Re: [HACKERS] Fast REVERSE() function?

2008-09-08 Thread Pavel Stehule
2008/9/8 Andrew Dunstan <[EMAIL PROTECTED]>: > > > Mario Weilguni wrote: >>> >>> (Aside: presumably we could walk thru the string destructively, >>> in-place, swapping bytes; I think that would be theoretically >>> quickest...) >>> >> >> Hmmm... I guess it will not work für UTF-8 or any other multi

Re: [HACKERS] Fast REVERSE() function?

2008-09-08 Thread Andrew Dunstan
Mario Weilguni wrote: (Aside: presumably we could walk thru the string destructively, in-place, swapping bytes; I think that would be theoretically quickest...) Hmmm... I guess it will not work für UTF-8 or any other multibyte charset Yes, quite. Perl's reverse might work with UT

Re: [HACKERS] Fast REVERSE() function?

2008-09-08 Thread Pavel Stehule
Hello 2008/9/8 Mario Weilguni <[EMAIL PROTECTED]>: >> (Aside: presumably we could walk thru the string destructively, >> in-place, swapping bytes; I think that would be theoretically >> quickest...) > > Hmmm... I guess it will not work für UTF-8 or any other multibyte charset > it isn't problem,

Re: [HACKERS] Fast REVERSE() function?

2008-09-08 Thread hubert depesz lubaczewski
On Mon, Sep 08, 2008 at 11:20:18AM -0400, Chris Browne wrote: > I've got a case where I need to reverse strings, and find that, oddly > enough, there isn't a C-based reverse() function. > A search turns up pl/pgsql and SQL implementations: just for completenes - there is also pl/perl and c version

Re: [HACKERS] Fast REVERSE() function?

2008-09-08 Thread Mario Weilguni
> (Aside: presumably we could walk thru the string destructively, > in-place, swapping bytes; I think that would be theoretically > quickest...) Hmmm... I guess it will not work für UTF-8 or any other multibyte charset -- Sent via pgsql-hackers mailing list (pgsql-hackers@postgresql.org) To mak

[HACKERS] Fast REVERSE() function?

2008-09-08 Thread Chris Browne
I've got a case where I need to reverse strings, and find that, oddly enough, there isn't a C-based reverse() function. A search turns up pl/pgsql and SQL implementations: create or replace function reverse_string(text) returns text as $$ DECLARE reversed_string text; incoming alias for $1; BEGIN