Commit 5b4f8f4
committed
Fix handling of empty arrays in array_fill().
array_fill(..., array[0]) produced an empty array, which is probably
what users expect, but it was a one-dimensional zero-length array
which is not our standard representation of empty arrays. Also, for
no very good reason, it rejected empty input arrays; that case should
be allowed and produce an empty output array.
In passing, remove the restriction that the input array(s) have lower
bound 1. That seems rather pointless, and it would have needed extra
complexity to make the check deal with empty input arrays.
Per bug #14487 from Andrew Gierth. It's been broken all along, so
back-patch to all supported branches.
Discussion: https://postgr.es/m/20170105152156.10135.64195@wrigleys.postgresql.org1 parent f64554b commit 5b4f8f4
File tree
3 files changed
+42
-19
lines changed- src
- backend/utils/adt
- test/regress
- expected
- sql
3 files changed
+42
-19
lines changed| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
5734 | 5734 | | |
5735 | 5735 | | |
5736 | 5736 | | |
5737 | | - | |
| 5737 | + | |
5738 | 5738 | | |
5739 | 5739 | | |
5740 | 5740 | | |
5741 | 5741 | | |
5742 | 5742 | | |
5743 | | - | |
5744 | | - | |
5745 | | - | |
5746 | | - | |
5747 | | - | |
5748 | | - | |
5749 | 5743 | | |
5750 | 5744 | | |
5751 | 5745 | | |
5752 | 5746 | | |
5753 | 5747 | | |
5754 | 5748 | | |
5755 | | - | |
| 5749 | + | |
5756 | 5750 | | |
5757 | 5751 | | |
5758 | 5752 | | |
| |||
5766 | 5760 | | |
5767 | 5761 | | |
5768 | 5762 | | |
5769 | | - | |
| 5763 | + | |
5770 | 5764 | | |
5771 | 5765 | | |
5772 | 5766 | | |
5773 | 5767 | | |
5774 | 5768 | | |
5775 | | - | |
5776 | | - | |
5777 | | - | |
5778 | | - | |
5779 | | - | |
5780 | | - | |
5781 | 5769 | | |
5782 | 5770 | | |
5783 | 5771 | | |
5784 | 5772 | | |
5785 | 5773 | | |
5786 | | - | |
| 5774 | + | |
5787 | 5775 | | |
5788 | 5776 | | |
5789 | 5777 | | |
| |||
5801 | 5789 | | |
5802 | 5790 | | |
5803 | 5791 | | |
| 5792 | + | |
| 5793 | + | |
5804 | 5794 | | |
5805 | | - | |
| 5795 | + | |
5806 | 5796 | | |
5807 | 5797 | | |
5808 | | - | |
5809 | | - | |
5810 | 5798 | | |
5811 | 5799 | | |
5812 | 5800 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
1553 | 1553 | | |
1554 | 1554 | | |
1555 | 1555 | | |
| 1556 | + | |
| 1557 | + | |
| 1558 | + | |
| 1559 | + | |
| 1560 | + | |
| 1561 | + | |
| 1562 | + | |
| 1563 | + | |
| 1564 | + | |
| 1565 | + | |
| 1566 | + | |
| 1567 | + | |
| 1568 | + | |
| 1569 | + | |
| 1570 | + | |
| 1571 | + | |
| 1572 | + | |
| 1573 | + | |
| 1574 | + | |
| 1575 | + | |
| 1576 | + | |
1556 | 1577 | | |
1557 | 1578 | | |
1558 | 1579 | | |
1559 | 1580 | | |
1560 | 1581 | | |
| 1582 | + | |
| 1583 | + | |
| 1584 | + | |
1561 | 1585 | | |
1562 | 1586 | | |
1563 | 1587 | | |
1564 | 1588 | | |
1565 | 1589 | | |
| 1590 | + | |
| 1591 | + | |
| 1592 | + | |
1566 | 1593 | | |
1567 | 1594 | | |
1568 | 1595 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
482 | 482 | | |
483 | 483 | | |
484 | 484 | | |
| 485 | + | |
| 486 | + | |
| 487 | + | |
| 488 | + | |
| 489 | + | |
| 490 | + | |
485 | 491 | | |
486 | 492 | | |
487 | 493 | | |
| 494 | + | |
488 | 495 | | |
489 | 496 | | |
| 497 | + | |
490 | 498 | | |
491 | 499 | | |
492 | 500 | | |
| |||
0 commit comments