Re: string_to_array with an empty input string - Mailing list pgsql-hackers

From David E. Wheeler
Subject Re: string_to_array with an empty input string
Date
Msg-id B4E292C8-E210-4244-B019-8F6A05AD1F7A@kineticode.com
Whole thread Raw
In response to Re: string_to_array with an empty input string  (Tom Lane <tgl@sss.pgh.pa.us>)
List pgsql-hackers
On Aug 11, 2010, at 9:36 AM, Tom Lane wrote:

>> 
>> I believe those are all "", rather than '"' + undef + '"'.
> 
> If you believe my previous opinion that the design center for these
> functions is arrays of numbers, then a zero-entry text[] array is what
> you want, because you can successfully cast it to a zero-entry array of
> integers or floats or whatever.  Returning a single empty string will
> make those cases fail.  So at the moment I'm on the side of the fence
> that says zero-entry array is the best answer.

Seems to be precedent for that:

% perl -E 'say scalar @{[ split ",", ""]}'
0

Best,

David



pgsql-hackers by date:

Previous
From: Peter Geoghegan
Date:
Subject: Re: string_to_array with an empty input string
Next
From: "David E. Wheeler"
Date:
Subject: Re: string_to_array with an empty input string