diff options
author | Tom Lane <tgl@sss.pgh.pa.us> | 2018-01-10 17:13:29 -0500 |
---|---|---|
committer | Tom Lane <tgl@sss.pgh.pa.us> | 2018-01-10 17:13:47 -0500 |
commit | 3c1e9fd23269849e32c73683a8457fb3095309e3 (patch) | |
tree | 2a1881694849e107feb9ca345b86c15992436325 /contrib/postgres_fdw/postgres_fdw.c | |
parent | 70d6226e4fba26765877fc3c2ec6c468d3ff4084 (diff) | |
download | postgresql-3c1e9fd23269849e32c73683a8457fb3095309e3.tar.gz postgresql-3c1e9fd23269849e32c73683a8457fb3095309e3.zip |
Fix sample INSTR() functions in the plpgsql documentation.
These functions are stated to be Oracle-compatible, but they weren't.
Yugo Nagata noticed that while our code returns zero for a zero or
negative fourth parameter (occur_index), Oracle throws an error.
Further testing by me showed that there was also a discrepancy in the
interpretation of a negative third parameter (beg_index): Oracle thinks
that a 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*.
Adjust the sample code to behave like Oracle in both these respects.
Also change it to be a CDATA[] section, simplifying copying-and-pasting
out of the documentation source file. And fix minor problems in the
introductory comment, which wasn't very complete or accurate.
Back-patch to all supported branches. Although this patch only touches
documentation, we should probably call it out as a bug fix in the next
minor release notes, since users who have adopted the functions will
likely want to update their versions.
Yugo Nagata and Tom Lane
Discussion: https://postgr.es/m/20171229191705.c0b43a8c.nagata@sraoss.co.jp
Diffstat (limited to 'contrib/postgres_fdw/postgres_fdw.c')
0 files changed, 0 insertions, 0 deletions