Re: string_to_array, array_to_string function without separator

From: Pavel Stehule <pavel(dot)stehule(at)gmail(dot)com>
To: Chapman Flack <chap(at)anastigmatix(dot)net>
Cc: Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us>, David Fetter <david(at)fetter(dot)org>, PostgreSQL Hackers <pgsql-hackers(at)postgresql(dot)org>
Subject: Re: string_to_array, array_to_string function without separator
Date: 2019-03-15 16:59:06
Message-ID: CAFj8pRC9YRt_jJowLa6yJdpvQCHMN1+gq_MuiPmp9_vHd_k_yA@mail.gmail.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-hackers

pá 15. 3. 2019 v 17:54 odesílatel Chapman Flack <chap(at)anastigmatix(dot)net>
napsal:

> On 3/15/19 12:26 PM, Pavel Stehule wrote:
> > you use string_to_array function without separator, then only one
> possible
> > semantic is there - separation by chars.
>
> Other languages can and do specify other semantics for the
> separator-omitted case: often (as in Python) it means to split
> around "runs of one or more characters the platform considers white
> space", as a convenience, given that it's a fairly commonly wanted
> meaning but can be tedious to spell out as an explicit separator.
>

for this proposal "char" != byte

result[n] = substring(str FROM n FOR 1)

> I admit I think a separator of '' would be more clear than null,
> so if I were designing string_to_array in a green field, I think
> I would swap the meanings of null and '' as the delimiter: null
> would mean "don't really split anything", and '' would mean "split
> everywhere you can find '' in the string", that is, everywhere.
>
> But the current behavior is already established....
>

yes

Pavel

>
> Regards,
> -Chap
>

In response to

Responses

Browse pgsql-hackers by date

  From Date Subject
Next Message Chapman Flack 2019-03-15 17:29:54 Re: string_to_array, array_to_string function without separator
Previous Message Chapman Flack 2019-03-15 16:54:26 Re: string_to_array, array_to_string function without separator