Hi,
Attached is a patch to fix a very trivial issue of the documentation.
The documentation of PL/pgSQL provides sample codes of Oracle-compatible
instr functions. However, the behaviour is a little differet.
Oracle's instr raises an error when the forth argument value is less than
zero, but the sample code returns zero. This patch fixes this.
Regards,
--
Yugo Nagata <[email protected]>
diff --git a/doc/src/sgml/plpgsql.sgml b/doc/src/sgml/plpgsql.sgml
index 7d23ed4..5a67c38 100644
--- a/doc/src/sgml/plpgsql.sgml
+++ b/doc/src/sgml/plpgsql.sgml
@@ -5676,6 +5676,10 @@ DECLARE
length integer;
ss_length integer;
BEGIN
+ IF occur_index <= 0 THEN
+ RAISE 'argument ''%'' is out of range', occur_index USING ERRCODE = '22003';
+ END IF;
+
IF beg_index > 0 THEN
temp_str := substring(string FROM beg_index);
pos := position(string_to_search IN temp_str);