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 18:19:38
Message-ID: CAFj8pRB1-An+7KNPwjvRnz2-qtXJ6nMaZFYqgk3xEYOqnHzZ9Q@mail.gmail.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-hackers

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

> On 3/15/19 12:59 PM, Pavel Stehule wrote:
> > for this proposal "char" != byte
> >
> > result[n] = substring(str FROM n FOR 1)
>
> I think that's what string_to_array(..., null) already does:
>

sure. My proposal is +/- just reduction about null parameter.

> SHOW server_encoding;
> server_encoding
> UTF8
>
> WITH
> t0(s) AS (SELECT text 'verlorn ist daz slüzzelîn'),
> t1(a) AS (SELECT string_to_array(s, null) FROM t0)
> SELECT
> char_length(s), octet_length(convert_to(s, 'UTF8')),
> array_length(a,1), a
> FROM
> t0, t1;
>
> char_length|octet_length|array_length|a
> 25|27|25|{v,e,r,l,o,r,n," ",i,s,t," ",d,a,z," ",s,l,ü,z,z,e,l,î,n}
>
>
> Regards,
> -Chap
>

In response to

Browse pgsql-hackers by date

  From Date Subject
Next Message Andrey Borodin 2019-03-15 18:25:27 Re: GiST VACUUM
Previous Message Tom Lane 2019-03-15 18:18:04 Re: hyrax vs. RelationBuildPartitionDesc