patch: to_string, to_array functions
Pavel Stehule <pavel.stehule@gmail.com>
From: Pavel Stehule <pavel.stehule@gmail.com>
To: PostgreSQL Hackers <pgsql-hackers@postgresql.org>
Date: 2010-05-05T18:42:01Z
Lists: pgsql-hackers
Attachments
- to_array.diff (application/octet-stream) patch
Hello
attached patch contains to_string and to_array functions. These
functions are equivalent of array_to_string and string_to_array
function with maybe more correct NULL handling.
postgres=# select to_array('1,2,3,4,,6',',');
to_array
------------------
{1,2,3,4,NULL,6}
(1 row)
postgres=# select to_array('1,2,3,4,,6',',','***');
to_array
----------------
{1,2,3,4,"",6}
(1 row)
postgres=# select to_string(array[1,2,3,4,NULL,6],',');
to_string
------------
1,2,3,4,,6
(1 row)
postgres=# select to_string(array[1,2,3,4,NULL,6],',','***');
to_string
---------------
1,2,3,4,***,6
(1 row)
Regards
Pavel Stehule