On Mon, Sep 11, 2023 at 8:00 PM Alexander Lakhin <exclusion@gmail.com> wrote:
>
> I can confirm that all those anomalies are fixed now.
> But new version brings a warning when compiled with gcc:
> arrayfuncs.c:659:9: warning: variable 'prev_tok' is uninitialized when used here [-Wuninitialized]
> if (prev_tok == ATOK_DELIM || nest_level == 0)
> ^~~~~~~~
> arrayfuncs.c:628:3: note: variable 'prev_tok' is declared here
> ArrayToken prev_tok;
> ^
> 1 warning generated.
>
> Also it looks like an updated comment needs fixing/improving:
> /* No array dimensions, so first literal character should be oepn curl-braces */
> (should be an opening brace?)
>
fixed these 2 issues.
--query
SELECT ('{ ' || string_agg(chr((ascii('B') + round(random() * 25)) ::
integer),', ') || ' }')::text[]
FROM generate_series(1,1e6) \watch i=0.1 c=1
After applying the patch, the above query runs slightly faster.