Re: So what's an "empty" array anyway? - Mailing list pgsql-hackers

From Sam Mason
Subject Re: So what's an "empty" array anyway?
Date
Msg-id 20081112155017.GK2459@frubble.xen.chris-lamb.co.uk
Whole thread Raw
In response to Re: So what's an "empty" array anyway?  ("Robert Haas" <robertmhaas@gmail.com>)
List pgsql-hackers
On Wed, Nov 12, 2008 at 09:46:09AM -0500, Robert Haas wrote:
> The || operator is valid only if the dimensions
> of the two arrays are equal (in which case it appends them) or if the
> dimension of one of the arrays is one less than the other (in which
> case, if legal, it treats the array of lesser dimension as a new
> element to be added to the other array).

In most other languages these would be distinct operations; one to
append or concatenate two arrays of equal dimensionality and another to
add a new element on the end.  It's very rare that you don't know which
one you want to do when you're writing code and hence breaking the two
apart both simplifies the implementation of the array handling code and
reduces bugs in the calling code.
 Sam


pgsql-hackers by date:

Previous
From: "Jonah H. Harris"
Date:
Subject: Re: Enabling archive_mode without restart
Next
From: "Hitoshi Harada"
Date:
Subject: Re: Window functions review