<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
<html>
<head>
<meta content="text/html;charset=ISO-8859-1" http-equiv="Content-Type">
<title></title>
</head>
<body bgcolor="#ffffff" text="#000000">
Tom Lane wrote:
<blockquote cite="mid:6569(dot)1238601738(at)sss(dot)pgh(dot)pa(dot)us" type="cite">
<pre wrap="">Robert Haas <a class="moz-txt-link-rfc2396E" href="mailto:robertmhaas(at)gmail(dot)com"><robertmhaas(at)gmail(dot)com></a> writes:
</pre>
<blockquote type="cite">
<pre wrap="">On Tue, Mar 31, 2009 at 10:44 AM, Greg Stark <a class="moz-txt-link-rfc2396E" href="mailto:stark(at)enterprisedb(dot)com"><stark(at)enterprisedb(dot)com></a> wrote:
</pre>
<blockquote type="cite">
<pre wrap="">On Tue, Mar 31, 2009 at 3:42 PM, Sam Mason <a class="moz-txt-link-rfc2396E" href="mailto:sam(at)samason(dot)me(dot)uk"><sam(at)samason(dot)me(dot)uk></a> wrote:
</pre>
<blockquote type="cite">
<pre wrap="">string_to_array('',',')::INT[] => invalid input syntax for integer: ""
</pre>
</blockquote>
<pre wrap="">Oof. That's a good point.
</pre>
</blockquote>
</blockquote>
<pre wrap=""><!---->
</pre>
<blockquote type="cite">
<pre wrap="">+1. I find this argument much more compelling than anything else
that's been offered up so far.
</pre>
</blockquote>
<pre wrap=""><!---->
Yeah. It seems to me that if you consider only the case where the array
elements are text, there's a weak preference for considering '' to be a
single empty string; but as soon as you think about any other datatype,
there's a strong preference to consider it a zero-element list. So I
too have come around to favor the latter interpretation. Do we have
any remaining holdouts?
regards, tom lane
</pre>
</blockquote>
<br>
I'm still a hold out, We are taking a string putting it into a array
based on a delimiter. That is very simple and straight forward. Yet
many argue if we want to cast this into another data type the function
should deal with in limited cases. <br>
<br>
string_to_array('',',')::INT[] works as proposed <br>
<br>
But <br>
string_to_array(',,,', ',' )::INT[] Fails <br>
or<br>
string_to_array('1,2,,4', ',' )::INT[] Fails .<br>
<br>
<br>
I'm trying to understand the difference between a empty string to a
string with many blank entries between the delimiter. <br>
Consider
',,,,,,' = '' once the delimiter is removed . Yet Seven zero length
entries were passed. How is that going to
be handled???? <br>
<br>
In one case it works and yet other cases it fails. This is
inconsistent behavior. Unless all zero length strings are removed or
are treated as NULLs I can't see how casting to another type is going
to work.<br>
<br>
If zero length strings are treated as NULLs this creates idea that zero
length strings are = to NULLs. <br>
<br>
The input is a string and the output is text[], casting to another
data type is error prone and should be handled by the programmer. <br>
</body>
</html>