Request to add feature to the Position function

From: Ron Ben <ronb910(at)walla(dot)co(dot)il>
To: pgsql-general(at)postgresql(dot)org
Subject: Request to add feature to the Position function
Date: 2017-03-27 15:05:27
Message-ID: ~00258D92A374E6152001107@walla.co.il
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-general

<div dir='rtl'><div>
<div>Hi,</div>
<div>position(<tt>substring</tt> in <tt>string</tt>)</div>
<div>as listed here:</div>
<div><a href="https://www.postgresql.org/docs/9.1/static/functions-string.html">https://www.postgresql.org/docs/9.1/static/functions-string.html</a></div>
<div>locates sub string in a string.</div>
<div>&nbsp;</div>
<div>It doesn't support locateing the substring from the back.</div>
<div>&nbsp;</div>
<div>For example:</div>
<div>&nbsp;</div>
<div>position('om' in 'Tomomas')</div>
<div>gives&nbsp;2</div>
<div>&nbsp;</div>
<div>But if I want to locate the first occurance from the back of the string it's impossible/</div>
<div>&nbsp;</div>
<div>My suggestion is to create a function&nbsp;</div>
<div>position(<tt>substring</tt> in <tt>string,order</tt>)</div>
<div>where order can be: begin, end</div>
<div>&nbsp;</div>
<div>and it will find the string according to this parameter.</div>
<div>This is pretty easy to implement and should be a part of the PostgreSQL tools.</div>
<div>&nbsp;</div>
<div>similar fuctionality exists in&nbsp;trim function where user can specify leading or taling parameter</div>
</div></div>

Attachment Content-Type Size
unknown_filename text/html 1.1 KB

Responses

Browse pgsql-general by date

  From Date Subject
Next Message Adrian Klaver 2017-03-27 15:43:44 Re: Request to add feature to the Position function
Previous Message Jiri Sadek 2017-03-27 15:01:37 Re: migration to 9.6 array_accum memory issues