diff options
author | Robert Haas | 2012-07-04 21:19:23 +0000 |
---|---|---|
committer | Robert Haas | 2012-07-04 21:19:23 +0000 |
commit | 0fc32c00d74404a9a535e0e1b8d9437dfd8075db (patch) | |
tree | d08ec15ec9af8275f8077578ad0bad753612a4d6 /doc/src | |
parent | 72dd6291f216440f6bb61a8733729a37c7e3b2d2 (diff) |
Fix sample INSTR function to return 0 if third arg is 0.
Albe Laurenz, per a report by Greg Smith that our sample function
doesn't quite match Oracle's behavior.
Diffstat (limited to 'doc/src')
-rw-r--r-- | doc/src/sgml/plpgsql.sgml | 8 |
1 files changed, 6 insertions, 2 deletions
diff --git a/doc/src/sgml/plpgsql.sgml b/doc/src/sgml/plpgsql.sgml index ba2c57b6871..4840f6ea9c6 100644 --- a/doc/src/sgml/plpgsql.sgml +++ b/doc/src/sgml/plpgsql.sgml @@ -5115,7 +5115,7 @@ BEGIN ELSE RETURN pos + beg_index - 1; END IF; - ELSE + ELSIF beg_index < 0 THEN ss_length := char_length(string_to_search); length := char_length(string); beg := length + beg_index - ss_length + 2; @@ -5132,6 +5132,8 @@ BEGIN END LOOP; RETURN 0; + ELSE + RETURN 0; END IF; END; $$ LANGUAGE plpgsql STRICT IMMUTABLE; @@ -5170,7 +5172,7 @@ BEGIN ELSE RETURN beg; END IF; - ELSE + ELSIF beg_index < 0 THEN ss_length := char_length(string_to_search); length := char_length(string); beg := length + beg_index - ss_length + 2; @@ -5191,6 +5193,8 @@ BEGIN END LOOP; RETURN 0; + ELSE + RETURN 0; END IF; END; $$ LANGUAGE plpgsql STRICT IMMUTABLE; |