On 7/1/16 2:52 PM, Tom Lane wrote:
> + /* if caller tries to specify zero-length array, make it empty */
> + if (nelems <= 0)
> + return construct_empty_array(elmtype);
> +
> /* compute required space */
> nbytes = 0;
> hasnulls = false;
>
> But that might introduce new problems too, if any callers expect the
> array dimensions to be exactly what they asked for.
You mean ndims? What if instead of an empty array it returned an array
where *dims was just all zeros (and correctly set *lbs)? array_eq would
still need to account for that, but I think we don't have a choice about
that unless we expressly forbid arrays where any of the elements of
*dims were 0 (which I suspect we should probably do anyway... I don't
see how you can do anything with a 2x0x3 array...)
--
Jim Nasby, Data Architect, Blue Treble Consulting, Austin TX
Experts in Analytics, Data Architecture and PostgreSQL
Data in Trouble? Get it in Treble! http://BlueTreble.com
855-TREBLE2 (855-873-2532) mobile: 512-569-9461