Re: string_to_array with empty input - Mailing list pgsql-general

From Justin
Subject Re: string_to_array with empty input
Date
Msg-id 49D195FC.6070403@emproshunts.com
Whole thread Raw
In response to Re: string_to_array with empty input  (Tom Lane <tgl@sss.pgh.pa.us>)
List pgsql-general
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.
>
> Does anyone want to argue for keeping it the same?  Or perhaps
> argue that a zero-element array is a more sensible result than
> a one-element array with one empty string?  (It doesn't seem
> like it to me, but maybe somebody thinks so.)
>
>             regards, tom lane
>

I  like the array to contain single zero length string.   A  string was
passed in  although empty,  its still a string not a NULL.

Returning an empty array implies nothing was passed to the function
although something was. That seems kinda odd to me also, give  back what
was sent in broken into an array.

I use this and split_part allot in our database to break apart  part numbers


pgsql-general by date:

Previous
From: Stuart Bishop
Date:
Subject: Re: pgstattuple triggered checkpoint failure and database outage?
Next
From: Tom Lane
Date:
Subject: Re: pgstattuple triggered checkpoint failure and database outage?