Oracle porting sample instr function

Поиск
Список
Период
Сортировка
От Greg Smith
Тема Oracle porting sample instr function
Дата
Msg-id 4FF24202.1000008@2ndquadrant.com
обсуждение исходный текст
Ответы Re: Oracle porting sample instr function  ("Albe Laurenz" <laurenz.albe@wien.gv.at>)
Re: Oracle porting sample instr function  (Roberto Mello <roberto.mello@gmail.com>)
Список pgsql-hackers
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 it 
sounds legit.

A look at Oracle's documentation on the INSTR function at 
http://docs.oracle.com/cd/B28359_01/olap.111/b28126/dml_functions_1103.htm 
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 invalid 
input.

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.



В списке pgsql-hackers по дате отправления:

Предыдущее
От: Tom Lane
Дата:
Сообщение: Re: Patch: add conversion from pg_wchar to multibyte
Следующее
От: Tom Lane
Дата:
Сообщение: Re: Patch: add conversion from pg_wchar to multibyte