Re: "reverse()" on strings

From: Jeff Boes <jboes(at)nexcerpt(dot)com>
To: pgsql-sql(at)postgresql(dot)org
Subject: Re: "reverse()" on strings
Date: 2002-08-26 20:56:46
Message-ID: ake4lb$20ed$1@news.hub.org
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-sql

On Mon, 26 Aug 2002 16:13:44 -0400, h012 wrote:

> CREATE INDEX extension_idx ON file (reverse(name));
> -- but I didn't find a function called "reverse"
>
> CREATE INDEX extension_idx ON file (regex_match( '.*(\.[^\.]*)$' );
> -- but I didn't find a function called "regex_match" which would return
> string matched in brackets ()
>

You probably want to do a

$ createlang plperl

and then something like this:

CREATE FUNCTION fn_strrev(text) returns text as '
return reverse($_[0])
' language 'plperl' with (iscachable);

The same approach can be used to provide a regex match with Perl syntax,
but I don't have an example of that coded up and at hand.

--
Jeff Boes vox 269.226.9550 ext 24
Database Engineer fax 269.349.9076
Nexcerpt, Inc. http://www.nexcerpt.com
...Nexcerpt... Extend your Expertise

In response to

Responses

Browse pgsql-sql by date

  From Date Subject
Next Message Josh Berkus 2002-08-26 21:11:01 Re: "reverse()" on strings
Previous Message h012 2002-08-26 20:12:42 "reverse()" on strings