On Wed, Aug 11, 2010 at 12:37 AM, Peter Geoghegan <peter.geoghega...@gmail.com> wrote: > On 10 August 2010 19:48, David E. Wheeler <da...@kineticode.com> wrote: >> On Aug 10, 2010, at 11:46 AM, Thom Brown wrote: >> >>> I, personally, would expect an empty array output given an empty >>> input, and a null output for a null input. >> >> +1 > > Agreed. After all, the result isn't indeterminate - it's an empty > array. Some people might think that it's useful for the result to be > NULL, but they'd probably also think that it's useful for an empty > string to be NULL. >
For what it's worth there are two reasonable return values for string_to_array(''). It could be [] or it could be ['']. There are applications where the former makes the most sense and there are applications where the latter makes the most sense. Ideally you really want string_to_array(array_to_string(x, ':'),':') to return x. There's no safe return value to pick for the cases where x=[''] and x=[] that will make this work. -- greg -- Sent via pgsql-hackers mailing list (pgsql-hackers@postgresql.org) To make changes to your subscription: http://www.postgresql.org/mailpref/pgsql-hackers