Commit 10bcd41
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 38a2379 commit 10bcd41
1 file changed
+38
-44
lines changed| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
5531 | 5531 | | |
5532 | 5532 | | |
5533 | 5533 | | |
5534 | | - | |
| 5534 | + | |
5535 | 5535 | | |
5536 | 5536 | | |
5537 | | - | |
| 5537 | + | |
| 5538 | + | |
5538 | 5539 | | |
5539 | | - | |
5540 | | - | |
5541 | | - | |
| 5540 | + | |
| 5541 | + | |
| 5542 | + | |
| 5543 | + | |
| 5544 | + | |
| 5545 | + | |
5542 | 5546 | | |
5543 | 5547 | | |
5544 | 5548 | | |
5545 | | - | |
5546 | | - | |
5547 | 5549 | | |
5548 | | - | |
5549 | | - | |
| 5550 | + | |
5550 | 5551 | | |
5551 | 5552 | | |
5552 | 5553 | | |
5553 | 5554 | | |
5554 | | - | |
| 5555 | + | |
| 5556 | + | |
5555 | 5557 | | |
5556 | 5558 | | |
5557 | 5559 | | |
| |||
5560 | 5562 | | |
5561 | 5563 | | |
5562 | 5564 | | |
5563 | | - | |
| 5565 | + | |
5564 | 5566 | | |
5565 | | - | |
| 5567 | + | |
5566 | 5568 | | |
5567 | 5569 | | |
5568 | 5570 | | |
5569 | 5571 | | |
5570 | 5572 | | |
5571 | 5573 | | |
5572 | | - | |
5573 | | - | |
| 5574 | + | |
| 5575 | + | |
5574 | 5576 | | |
5575 | | - | |
| 5577 | + | |
5576 | 5578 | | |
5577 | | - | |
| 5579 | + | |
5578 | 5580 | | |
5579 | | - | |
5580 | | - | |
5581 | | - | |
| 5581 | + | |
5582 | 5582 | | |
5583 | 5583 | | |
5584 | 5584 | | |
| |||
5593 | 5593 | | |
5594 | 5594 | | |
5595 | 5595 | | |
5596 | | - | |
| 5596 | + | |
5597 | 5597 | | |
5598 | 5598 | | |
5599 | 5599 | | |
| |||
5605 | 5605 | | |
5606 | 5606 | | |
5607 | 5607 | | |
5608 | | - | |
5609 | | - | |
5610 | | - | |
| 5608 | + | |
| 5609 | + | |
| 5610 | + | |
| 5611 | + | |
5611 | 5612 | | |
| 5613 | + | |
| 5614 | + | |
5612 | 5615 | | |
5613 | | - | |
5614 | | - | |
5615 | | - | |
5616 | | - | |
5617 | | - | |
5618 | | - | |
5619 | | - | |
5620 | | - | |
5621 | 5616 | | |
| 5617 | + | |
| 5618 | + | |
| 5619 | + | |
| 5620 | + | |
| 5621 | + | |
5622 | 5622 | | |
5623 | 5623 | | |
5624 | | - | |
5625 | | - | |
5626 | | - | |
5627 | | - | |
5628 | | - | |
5629 | | - | |
5630 | | - | |
| 5624 | + | |
| 5625 | + | |
| 5626 | + | |
5631 | 5627 | | |
5632 | | - | |
| 5628 | + | |
5633 | 5629 | | |
5634 | | - | |
| 5630 | + | |
5635 | 5631 | | |
5636 | | - | |
5637 | | - | |
5638 | | - | |
| 5632 | + | |
5639 | 5633 | | |
5640 | | - | |
5641 | 5634 | | |
5642 | 5635 | | |
5643 | 5636 | | |
| |||
5652 | 5645 | | |
5653 | 5646 | | |
5654 | 5647 | | |
| 5648 | + | |
5655 | 5649 | | |
5656 | 5650 | | |
5657 | 5651 | | |
| |||
0 commit comments