From: | Pavel Stehule <pavel(dot)stehule(at)gmail(dot)com> |
---|---|
To: | Chapman Flack <chap(at)anastigmatix(dot)net> |
Cc: | 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:00:54 |
Message-ID: | CAFj8pRCXZZLmwnP6qet+1p7=wwkiGNxNSZ7NP=SYXY2+sK7qFQ@mail.gmail.com |
Views: | Raw Message | Whole Thread | Download mbox | Resend email |
Thread: | |
Lists: | pgsql-hackers |
pá 15. 3. 2019 v 16:59 odesílatel Chapman Flack <chap(at)anastigmatix(dot)net>
napsal:
> On 3/15/19 11:46 AM, Pavel Stehule wrote:
> > pá 15. 3. 2019 v 15:03 odesílatel David Fetter <david(at)fetter(dot)org>
> napsal:
> >> Whatever optimizations you have in mind for this, could they also work
> >> for string_to_array() and array_to_string() when they get an empty
> >> string handed to them?
> >
> > my idea is use string_to_array('AHOJ') --> {A,H,O,J}
> >
> > empty input means empty result --> {}
>
> I thought the question was maybe about an empty /delimiter/ string.
>
> It seems that string_to_array already has this behavior if NULL is
> passed as the delimiter:
>
> > select string_to_array('AHOJ', null);
> string_to_array
> -----------------
> {A,H,O,J}
>
> and array_to_string has the proposed behavior if passed an
> empty string as the delimiter (as one would naturally expect)
> ... but not null for a delimiter (that just makes the result null).
>
> So the proposal seems roughly equivalent to making string_to_array's
> second parameter optional default null, and array_to_string's second
> parameter optional default ''.
>
> Does that sound right?
>
yes
Pavel
> Regards,
> -Chap
>
From | Date | Subject | |
---|---|---|---|
Next Message | Michael Kefeder | 2019-03-15 16:01:49 | GTIN14 support for contrib/isn |
Previous Message | Gunther | 2019-03-15 15:59:48 | Re: Facing issue in using special characters |