Re: Oracle porting sample instr function - Mailing list pgsql-hackers

From Roberto Mello
Subject Re: Oracle porting sample instr function
Date
Msg-id CAKz==bJ7oZi33-BJ548tuPTaYhrV+QpJtJQXEGTsHK48VkCtkg@mail.gmail.com
Whole thread Raw
In response to Oracle porting sample instr function  (Greg Smith <greg@2ndquadrant.com>)
List pgsql-hackers
On Mon, Jul 2, 2012 at 8:51 PM, Greg Smith <greg@2ndquadrant.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


pgsql-hackers by date:

Previous
From: Oleg Bartunov
Date:
Subject: Re: Incorrect behaviour when using a GiST index on points
Next
From: Dimitri Fontaine
Date:
Subject: Re: Event Triggers reduced, v1