Re: [HACKERS] string_to_array with empty input

From: "Leif B(dot) Kristensen" <leif(at)solumslekt(dot)org>
To: pgsql-general(at)postgresql(dot)org
Subject: Re: [HACKERS] string_to_array with empty input
Date: 2009-04-02 00:53:26
Message-ID: 200904020253.27067.leif@solumslekt.org
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-general pgsql-hackers

On Thursday 2. April 2009, Steve Crawford wrote:
>Currently string_to_array(null, ',') yields a null result -
>indistinguishable from string_to_array('',','). Wrapping in coalesce
>does not help distinguish true null input from empty-string input. I'm
>not sure at the moment what other cases exist where non-null input
>generates null output.

Somehow this reminds me of the old "division by zero" problem.

IMO, the proper way to handle this kind of anomaly would be to test if
the length of the string is non-zero before submitting it to the
string_to_array() function.
--
Leif Biberg Kristensen | Registered Linux User #338009
Me And My Database: http://solumslekt.org/blog/

In response to

Responses

Browse pgsql-general by date

  From Date Subject
Next Message Aleksey Tsalolikhin 2009-04-02 01:07:34 possible small contribution to the PostgreSQL manual? Example for two-phase commit section.
Previous Message Steve Crawford 2009-04-02 00:31:30 Re: [HACKERS] string_to_array with empty input

Browse pgsql-hackers by date

  From Date Subject
Next Message Tom Lane 2009-04-02 01:37:01 Re: tuplestore API problem
Previous Message Steve Crawford 2009-04-02 00:31:30 Re: [HACKERS] string_to_array with empty input