Skip site navigation (1) Skip section navigation (2)

Re: Oracle porting sample instr function

From: "Albe Laurenz" <laurenz(dot)albe(at)wien(dot)gv(dot)at>
To: "Greg Smith *EXTERN*" <greg(at)2ndquadrant(dot)com>,<pgsql-hackers(at)postgresql(dot)org>
Subject: Re: Oracle porting sample instr function
Date: 2012-07-03 12:42:30
Message-ID: (view raw, whole thread or download thread mbox)
Lists: pgsql-hackers
Greg Smith wrote:
> A web site doc comment from user skong today points out a small issue
> around the sample INSTR function given in plpgsql-porting.html that I
> can't confirm (none of those dirty Oracle instances here today), but
> sounds legit.
> A look at Oracle's documentation on the INSTR function at
> says that the 3rd input, position to start searching, cannot be zero.
> skong says that Oracle will just return a 0 if you give it that
> input.
> The INSTR implementation in the docs will instead search backwards
> the end of the string if you tell it to start at 0, same as if you
> it a negative input.  I think it's therefore possible to get the
> version to return a value in cases Oracle would instead return 0.
> 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

I can confirm that Oracle returns 0 if the third argument to
INSTR is 0.

Laurenz Albe

In response to


pgsql-hackers by date

Next:From: Robert HaasDate: 2012-07-03 12:45:40
Subject: Re: huge tlb support
Previous:From: Robert HaasDate: 2012-07-03 12:30:35
Subject: Re: xlog filename formatting functions in recovery

Privacy Policy | About PostgreSQL
Copyright © 1996-2018 The PostgreSQL Global Development Group