Commit 3c1e9fd
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 70d6226 commit 3c1e9fd
1 file changed
+38
-44
lines changed| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
5647 | 5647 | | |
5648 | 5648 | | |
5649 | 5649 | | |
5650 | | - | |
| 5650 | + | |
5651 | 5651 | | |
5652 | 5652 | | |
5653 | | - | |
| 5653 | + | |
| 5654 | + | |
5654 | 5655 | | |
5655 | | - | |
5656 | | - | |
5657 | | - | |
| 5656 | + | |
| 5657 | + | |
| 5658 | + | |
| 5659 | + | |
| 5660 | + | |
| 5661 | + | |
5658 | 5662 | | |
5659 | 5663 | | |
5660 | 5664 | | |
5661 | | - | |
5662 | | - | |
5663 | 5665 | | |
5664 | | - | |
5665 | | - | |
| 5666 | + | |
5666 | 5667 | | |
5667 | 5668 | | |
5668 | 5669 | | |
5669 | 5670 | | |
5670 | | - | |
| 5671 | + | |
| 5672 | + | |
5671 | 5673 | | |
5672 | 5674 | | |
5673 | 5675 | | |
| |||
5676 | 5678 | | |
5677 | 5679 | | |
5678 | 5680 | | |
5679 | | - | |
| 5681 | + | |
5680 | 5682 | | |
5681 | | - | |
| 5683 | + | |
5682 | 5684 | | |
5683 | 5685 | | |
5684 | 5686 | | |
5685 | 5687 | | |
5686 | 5688 | | |
5687 | 5689 | | |
5688 | | - | |
5689 | | - | |
| 5690 | + | |
| 5691 | + | |
5690 | 5692 | | |
5691 | | - | |
| 5693 | + | |
5692 | 5694 | | |
5693 | | - | |
| 5695 | + | |
5694 | 5696 | | |
5695 | | - | |
5696 | | - | |
5697 | | - | |
| 5697 | + | |
5698 | 5698 | | |
5699 | 5699 | | |
5700 | 5700 | | |
| |||
5709 | 5709 | | |
5710 | 5710 | | |
5711 | 5711 | | |
5712 | | - | |
| 5712 | + | |
5713 | 5713 | | |
5714 | 5714 | | |
5715 | 5715 | | |
| |||
5721 | 5721 | | |
5722 | 5722 | | |
5723 | 5723 | | |
5724 | | - | |
5725 | | - | |
5726 | | - | |
| 5724 | + | |
| 5725 | + | |
| 5726 | + | |
| 5727 | + | |
5727 | 5728 | | |
| 5729 | + | |
| 5730 | + | |
5728 | 5731 | | |
5729 | | - | |
5730 | | - | |
5731 | | - | |
5732 | | - | |
5733 | | - | |
5734 | | - | |
5735 | | - | |
5736 | | - | |
5737 | 5732 | | |
| 5733 | + | |
| 5734 | + | |
| 5735 | + | |
| 5736 | + | |
| 5737 | + | |
5738 | 5738 | | |
5739 | 5739 | | |
5740 | | - | |
5741 | | - | |
5742 | | - | |
5743 | | - | |
5744 | | - | |
5745 | | - | |
5746 | | - | |
| 5740 | + | |
| 5741 | + | |
| 5742 | + | |
5747 | 5743 | | |
5748 | | - | |
| 5744 | + | |
5749 | 5745 | | |
5750 | | - | |
| 5746 | + | |
5751 | 5747 | | |
5752 | | - | |
5753 | | - | |
5754 | | - | |
| 5748 | + | |
5755 | 5749 | | |
5756 | | - | |
5757 | 5750 | | |
5758 | 5751 | | |
5759 | 5752 | | |
| |||
5768 | 5761 | | |
5769 | 5762 | | |
5770 | 5763 | | |
| 5764 | + | |
5771 | 5765 | | |
5772 | 5766 | | |
5773 | 5767 | | |
| |||
0 commit comments