Commit 1226051
committed
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.jp1 parent c24a908 commit 1226051
1 file changed
+38
-44
lines changed| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
5561 | 5561 | | |
5562 | 5562 | | |
5563 | 5563 | | |
5564 | | - | |
| 5564 | + | |
5565 | 5565 | | |
5566 | 5566 | | |
5567 | | - | |
| 5567 | + | |
| 5568 | + | |
5568 | 5569 | | |
5569 | | - | |
5570 | | - | |
5571 | | - | |
| 5570 | + | |
| 5571 | + | |
| 5572 | + | |
| 5573 | + | |
| 5574 | + | |
| 5575 | + | |
5572 | 5576 | | |
5573 | 5577 | | |
5574 | 5578 | | |
5575 | | - | |
5576 | | - | |
5577 | 5579 | | |
5578 | | - | |
5579 | | - | |
| 5580 | + | |
5580 | 5581 | | |
5581 | 5582 | | |
5582 | 5583 | | |
5583 | 5584 | | |
5584 | | - | |
| 5585 | + | |
| 5586 | + | |
5585 | 5587 | | |
5586 | 5588 | | |
5587 | 5589 | | |
| |||
5590 | 5592 | | |
5591 | 5593 | | |
5592 | 5594 | | |
5593 | | - | |
| 5595 | + | |
5594 | 5596 | | |
5595 | | - | |
| 5597 | + | |
5596 | 5598 | | |
5597 | 5599 | | |
5598 | 5600 | | |
5599 | 5601 | | |
5600 | 5602 | | |
5601 | 5603 | | |
5602 | | - | |
5603 | | - | |
| 5604 | + | |
| 5605 | + | |
5604 | 5606 | | |
5605 | | - | |
| 5607 | + | |
5606 | 5608 | | |
5607 | | - | |
| 5609 | + | |
5608 | 5610 | | |
5609 | | - | |
5610 | | - | |
5611 | | - | |
| 5611 | + | |
5612 | 5612 | | |
5613 | 5613 | | |
5614 | 5614 | | |
| |||
5623 | 5623 | | |
5624 | 5624 | | |
5625 | 5625 | | |
5626 | | - | |
| 5626 | + | |
5627 | 5627 | | |
5628 | 5628 | | |
5629 | 5629 | | |
| |||
5635 | 5635 | | |
5636 | 5636 | | |
5637 | 5637 | | |
5638 | | - | |
5639 | | - | |
5640 | | - | |
| 5638 | + | |
| 5639 | + | |
| 5640 | + | |
| 5641 | + | |
5641 | 5642 | | |
| 5643 | + | |
| 5644 | + | |
5642 | 5645 | | |
5643 | | - | |
5644 | | - | |
5645 | | - | |
5646 | | - | |
5647 | | - | |
5648 | | - | |
5649 | | - | |
5650 | | - | |
5651 | 5646 | | |
| 5647 | + | |
| 5648 | + | |
| 5649 | + | |
| 5650 | + | |
| 5651 | + | |
5652 | 5652 | | |
5653 | 5653 | | |
5654 | | - | |
5655 | | - | |
5656 | | - | |
5657 | | - | |
5658 | | - | |
5659 | | - | |
5660 | | - | |
| 5654 | + | |
| 5655 | + | |
| 5656 | + | |
5661 | 5657 | | |
5662 | | - | |
| 5658 | + | |
5663 | 5659 | | |
5664 | | - | |
| 5660 | + | |
5665 | 5661 | | |
5666 | | - | |
5667 | | - | |
5668 | | - | |
| 5662 | + | |
5669 | 5663 | | |
5670 | | - | |
5671 | 5664 | | |
5672 | 5665 | | |
5673 | 5666 | | |
| |||
5682 | 5675 | | |
5683 | 5676 | | |
5684 | 5677 | | |
| 5678 | + | |
5685 | 5679 | | |
5686 | 5680 | | |
5687 | 5681 | | |
| |||
0 commit comments