Re: Request to add feature to the Position function

From: Adrian Klaver <adrian(dot)klaver(at)aklaver(dot)com>
To: "David G(dot) Johnston" <david(dot)g(dot)johnston(at)gmail(dot)com>, Brian Dunavant <brian(at)omniti(dot)com>
Cc: Ron Ben <ronb910(at)walla(dot)co(dot)il>, "pgsql-general(at)postgresql(dot)org" <pgsql-general(at)postgresql(dot)org>
Subject: Re: Request to add feature to the Position function
Date: 2017-03-27 16:57:55
Message-ID: 3b1c6cbc-0cce-20b1-a9e2-6de9d4a0e296@aklaver.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-general

On 03/27/2017 09:15 AM, David G. Johnston wrote:
> On Mon, Mar 27, 2017 at 9:03 AM, Brian Dunavant <brian(at)omniti(dot)com
> <mailto:brian(at)omniti(dot)com>>wrote:
>
> That does not return the correct answer for the original poster's
> request.
>
> flpg=#
> ​​
> select position('om' in reverse('Tomomasaaaaaaaaaaa'));
> position
> ----------
> 15
> (1 row)
>
>
> ​Easy oversight to make - if you reverse the string being searched you
> must also reverse the string that you are looking for.
>
> That said the OP hasn't actually defined what they mean by "locate" when
> considered in a backward sense - some length adjustments might be needed
> to compensate for the length of the term being searched for.

I think there is also a RTL language involved, so we may need more
information to answer the question.

>
> Patches are welcomed. Given the lack of any links to previous requests
> of this nature I'd say its not exactly a highly in-demand capability.
>
> David J.
>

--
Adrian Klaver
adrian(dot)klaver(at)aklaver(dot)com

In response to

Browse pgsql-general by date

  From Date Subject
Next Message Jeff Janes 2017-03-27 17:07:54 Trigger based logging alternative to table_log
Previous Message David G. Johnston 2017-03-27 16:24:33 Re: Request to add feature to the Position function