Re: Oracle porting sample instr function

From: Roberto Mello <roberto(dot)mello(at)gmail(dot)com>
To: Greg Smith <greg(at)2ndquadrant(dot)com>
Cc: pgsql-hackers(at)postgresql(dot)org
Subject: Re: Oracle porting sample instr function
Date: 2012-07-06 11:04:33
Message-ID: CAKz==bJ7oZi33-BJ548tuPTaYhrV+QpJtJQXEGTsHK48VkCtkg@mail.gmail.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-hackers

On Mon, Jul 2, 2012 at 8:51 PM, Greg Smith <greg(at)2ndquadrant(dot)com> wrote:
>

<snip>

> The INSTR implementation in the docs will instead search backwards from the
> end of the string if you tell it to start at 0, same as if you gave it a
> negative input. I think it's therefore possible to get the plpgsql version
> to return a value in cases Oracle would instead return 0. Seems like a
> straightforward thing to confirm and change the sample to do differently;
> just have to add an explicit test for a 0 value of beg_index.

I wrote that sample eons ago with the plpgsql-porting doc. I probably
overlooked the 0 behavior. Thanks for reporting Greg, and thanks Albe
for providing a patch.

Roberto

In response to

Browse pgsql-hackers by date

  From Date Subject
Next Message Dimitri Fontaine 2012-07-06 11:21:46 Re: Event Triggers reduced, v1
Previous Message Antonin Houska 2012-07-06 09:06:28 Re: obsolete copyright notice