Add three-parameter forms of array_to_string and string_to_array, to allow

Tom Lane <tgl@sss.pgh.pa.us>

Commit: 33f43725fb5e133454a3e1d0a33bd7cbc75c3c59
Author: Tom Lane <tgl@sss.pgh.pa.us>
Date: 2010-08-10T21:51:00Z
Releases: 9.1.0
Add three-parameter forms of array_to_string and string_to_array, to allow
better handling of NULL elements within the arrays.  The third parameter
is a string that should be used to represent a NULL element, or should
be translated into a NULL element, respectively.  If the third parameter
is NULL it behaves the same as the two-parameter form.

There are two incompatible changes in the behavior of the two-parameter form
of string_to_array.  First, it will return an empty (zero-element) array
rather than NULL when the input string is of zero length.  Second, if the
field separator is NULL, the function splits the string into individual
characters, rather than returning NULL as before.  These two changes make
this form fully compatible with the behavior of the new three-parameter form.

Pavel Stehule, reviewed by Brendan Jurd

Files