On Tue, Mar 31, 2009 at 05:08:45PM +0100, Greg Stark wrote:
> Both interpretations are clearly consistent but it depends on whether
> you think it's a bunch of text strings concatenated together or if
> it's a list of objects.
>
> The example of string_to_array('',',')::int[] is relevant to this
>
This thread being cross posted has made it a bit
confusing
Greg Stark wrote:
Nobody has ever suggested filtering out empty elements or dealing
specially with spaces or anything else like that. If you're talking
about that then you've missed the original question.
"Does anyone want t
On Tue, Mar 31, 2009 at 6:44 PM, justin wrote:
>
> Consider this. I have intelligent part numbers that need to be split apart
> to simplify searching and do math with.
>
> string_to_array(' F-2500-50 ', '-' ) ::int[]
Yeah, that's what I've said about three times. If you're building a
parser an
Greg Stark wrote:
On Tue, Mar 31, 2009 at 5:48 PM, justin wrote:
But consider this fails also
select string_to_array('1, , 3', ',' )::int[] => ERROR: invalid input
syntax for integer: " "
yet this works
select string_to_array('1, 2, 3',',')::int[]
Sure, and the an
On Tue, Mar 31, 2009 at 5:48 PM, justin wrote:
>
> But consider this fails also
>
> select string_to_array('1, , 3', ',' )::int[] => ERROR: invalid input
> syntax for integer: " "
>
> yet this works
>
> select string_to_array('1, 2, 3',',')::int[]
Sure, and the analogous pair string_to_array('
Sam Mason wrote:
I'd expect 3,2,1 and 1.
That's also a disingenuous example; what would you expect back from:
select count_elements(string_to_array('butter,,milk',','))
I think the semantics you want is what you'd get from:
array_filter_blanks(string_to_array($1,$2))
where I defined "arr
On Tue, Mar 31, 2009 at 4:34 PM, Sam Mason wrote:
>
> That's also a disingenuous example; what would you expect back from:
>
> select count_elements(string_to_array('butter,,milk',','))
>
> I think the semantics you want is what you'd get from:
>
> array_filter_blanks(string_to_array($1,$2))
>
>
On Tue, Mar 31, 2009 at 03:43:37PM +0100, Greg Stark wrote:
> On Tue, Mar 31, 2009 at 7:45 AM, Brendan Jurd wrote:
> > My first thought was that it should be a zero-element array, because
> > then the string_to_array() behaviour would conform to the notion that
> > it returns an array with 1 eleme
On Tue, Mar 31, 2009 at 3:42 PM, Sam Mason wrote:
>
> string_to_array('',',')::INT[] => invalid input syntax for integer: ""
Oof. That's a good point.
--
greg
--
Sent via pgsql-general mailing list (pgsql-general@postgresql.org)
To make changes to your subscription:
http://www.postgresql.o
On Tue, Mar 31, 2009 at 7:45 AM, Brendan Jurd wrote:
> My first thought was that it should be a zero-element array, because
> then the string_to_array() behaviour would conform to the notion that
> it returns an array with 1 element per string fragment bounded by the
> delimiter.
>
> However, I no
Sorry for top-posting--blame apple.
Hm my first instinct was indeed to make it a zero-length array. I was
thinking of the input as a "list" and surely there are no elements in
a list which empty. I had to think a while until a length-1 array made
sense.
I suppose the thinking was string_t
Tom Lane wrote:
I agree this seems less than consistent though, especially seeing
that you *don't* get a null for a zero-length separator, which if
anything is a more poorly defined case.
I doubt it'd be a good idea to back-patch a change for this,
but I could see altering the definition for 8.4
Steve Crawford writes:
> I have a query that converts a string to an array with the
> string_to_array function. Sometimes the input is an empty string (not a
> null, but a string of zero-length). I had expected the result to be a
> one-element array with an empty string as the first and only el
13 matches
Mail list logo