I wrote: > Evidently, they consider that negative beg_index indicates > the last place where the target substring can *begin*, whereas > our code thinks it is the last place where the target can *end*.
> After a bit of fooling around with it, I produced code that agrees > with Oracle as far as I can tell, but it wouldn't be a bad idea > for someone else to test it some more. I spent some more time comparing this version's behavior with rextester's Oracle instance, and couldn't find any other discrepancies, so I pushed it. regards, tom lane