Re: string_to_array, array_to_string function without separator - Mailing list pgsql-hackers

From Chapman Flack
Subject Re: string_to_array, array_to_string function without separator
Date
Msg-id 2c9413cf-acb3-0aa9-97f1-1fe9d3db671c@anastigmatix.net
Whole thread Raw
In response to Re: string_to_array, array_to_string function without separator  (Pavel Stehule <pavel.stehule@gmail.com>)
Responses Re: string_to_array, array_to_string function without separator
List pgsql-hackers
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:

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


pgsql-hackers by date:

Previous
From: Pavel Stehule
Date:
Subject: Re: string_to_array, array_to_string function without separator
Next
From: Robert Haas
Date:
Subject: Re: [HACKERS] PATCH: multivariate histograms and MCV lists