Re: Cleaning up array_in() - Mailing list pgsql-hackers

From jian he
Subject Re: Cleaning up array_in()
Date
Msg-id CACJufxGU80rKcFw0-4QfHiNTr2h8Aqpvw3WyYfHuertLMUq_-Q@mail.gmail.com
Whole thread Raw
In response to Re: Cleaning up array_in()  (Alexander Lakhin <exclusion@gmail.com>)
Responses Re: Cleaning up array_in()
List pgsql-hackers
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.

Attachment

pgsql-hackers by date:

Previous
From: Tatsuo Ishii
Date:
Subject: Re: Row pattern recognition
Next
From: "Hayato Kuroda (Fujitsu)"
Date:
Subject: RE: pg_upgrade and logical replication