Lists: | pgsql-committers |
---|
From: | Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us> |
---|---|
To: | pgsql-committers(at)postgresql(dot)org |
Subject: | pgsql: Fix handling of empty arrays in array_fill(). |
Date: | 2017-01-05 16:34:11 |
Message-ID: | [email protected] |
Views: | Whole Thread | Raw Message | Download mbox | Resend email |
Lists: | pgsql-committers |
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/[email protected]
Branch
------
REL9_5_STABLE
Modified Files
--------------
src/backend/utils/adt/arrayfuncs.c | 26 +++++++-------------------
src/test/regress/expected/arrays.out | 27 +++++++++++++++++++++++++++
src/test/regress/sql/arrays.sql | 8 ++++++++
3 files changed, 42 insertions(+), 19 deletions(-)