Re: [HACKERS] string_to_array with empty input

From: Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us>
To: Robert Haas <robertmhaas(at)gmail(dot)com>
Cc: Greg Stark <stark(at)enterprisedb(dot)com>, Sam Mason <sam(at)samason(dot)me(dot)uk>, pgsql-general(at)postgresql(dot)org, pgsql-hackers(at)postgresql(dot)org
Subject: Re: [HACKERS] string_to_array with empty input
Date: 2009-04-01 16:02:18
Message-ID: 6569.1238601738@sss.pgh.pa.us
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-general pgsql-hackers

Robert Haas <robertmhaas(at)gmail(dot)com> writes:
> On Tue, Mar 31, 2009 at 10:44 AM, Greg Stark <stark(at)enterprisedb(dot)com> wrote:
>> On Tue, Mar 31, 2009 at 3:42 PM, Sam Mason <sam(at)samason(dot)me(dot)uk> wrote:
>>> string_to_array('',',')::INT[] => invalid input syntax for integer: ""
>>
>> Oof. That's a good point.

> +1. I find this argument much more compelling than anything else
> that's been offered up so far.

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

In response to

Responses

Browse pgsql-general by date

  From Date Subject
Next Message Patrick Desjardins 2009-04-01 16:32:03 Re: [GENERAL] ERROR: XX001: could not read block 2354 of relation…
Previous Message Emanuel Calvo Franco 2009-04-01 15:57:42 Re: [GENERAL] ERROR: XX001: could not read block 2354 of relation…

Browse pgsql-hackers by date

  From Date Subject
Next Message Robert Haas 2009-04-01 16:50:55 Re: 8.4 open items list
Previous Message Tom Lane 2009-04-01 15:22:30 Re: Patch to speed up pg_dump