pgsql: Add three-parameter forms of array_to_string and string_to_array,

From: tgl(at)postgresql(dot)org (Tom Lane)
To: pgsql-committers(at)postgresql(dot)org
Subject: pgsql: Add three-parameter forms of array_to_string and string_to_array,
Date: 2010-08-10 21:51:00
Message-ID: 20100810215100.EB5197541D7@cvs.postgresql.org
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-committers

Log Message:
-----------
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

Modified Files:
--------------
pgsql/doc/src/sgml:
func.sgml (r1.525 -> r1.526)
(http://anoncvs.postgresql.org/cvsweb.cgi/pgsql/doc/src/sgml/func.sgml?r1=1.525&r2=1.526)
pgsql/src/backend/utils/adt:
array_userfuncs.c (r1.35 -> r1.36)
(http://anoncvs.postgresql.org/cvsweb.cgi/pgsql/src/backend/utils/adt/array_userfuncs.c?r1=1.35&r2=1.36)
varlena.c (r1.178 -> r1.179)
(http://anoncvs.postgresql.org/cvsweb.cgi/pgsql/src/backend/utils/adt/varlena.c?r1=1.178&r2=1.179)
pgsql/src/include/catalog:
catversion.h (r1.593 -> r1.594)
(http://anoncvs.postgresql.org/cvsweb.cgi/pgsql/src/include/catalog/catversion.h?r1=1.593&r2=1.594)
pg_proc.h (r1.577 -> r1.578)
(http://anoncvs.postgresql.org/cvsweb.cgi/pgsql/src/include/catalog/pg_proc.h?r1=1.577&r2=1.578)
pgsql/src/include/utils:
array.h (r1.77 -> r1.78)
(http://anoncvs.postgresql.org/cvsweb.cgi/pgsql/src/include/utils/array.h?r1=1.77&r2=1.78)
builtins.h (r1.353 -> r1.354)
(http://anoncvs.postgresql.org/cvsweb.cgi/pgsql/src/include/utils/builtins.h?r1=1.353&r2=1.354)
pgsql/src/test/regress/expected:
arrays.out (r1.50 -> r1.51)
(http://anoncvs.postgresql.org/cvsweb.cgi/pgsql/src/test/regress/expected/arrays.out?r1=1.50&r2=1.51)
pgsql/src/test/regress/sql:
arrays.sql (r1.37 -> r1.38)
(http://anoncvs.postgresql.org/cvsweb.cgi/pgsql/src/test/regress/sql/arrays.sql?r1=1.37&r2=1.38)

Browse pgsql-committers by date

  From Date Subject
Next Message Tom Lane 2010-08-10 23:02:00 pgsql: Remove the arbitrary (and undocumented) limit on the number of
Previous Message Peter Eisentraut 2010-08-10 20:42:02 pgsql: Add some links to tables