Re: Cleaning up array_in()
Alexander Law <exclusion@gmail.com>
From: Alexander Lakhin <exclusion@gmail.com>
To: jian he <jian.universality@gmail.com>
Cc: Heikki Linnakangas <hlinnaka@iki.fi>, Tom Lane <tgl@sss.pgh.pa.us>,
Nikhil Benesch <nikhil.benesch@gmail.com>,
Nathan Bossart <nathandbossart@gmail.com>, pgsql-hackers@lists.postgresql.org
Date: 2023-09-11T12:00:00Z
Lists: pgsql-hackers
11.09.2023 08:26, jian he wrote:
> hi.
> Thanks for reviewing it.
>
>> DETAIL: Unexpected end of input.
> In many cases, ending errors will happen, so I consolidate it.
>
> SELECT '{{},}'::text[];
> solved by tracking current token type and previous token type.
>
> select '{\{}'::text[];
> solved by update dstendptr.
>
> attached.
Thank you!
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?)
(I haven't look at the code closely.)
Best regards,
Alexander
Commits
-
Don't specify number of dimensions in cases where we don't know it.
- 8d5573b92e66 17.0 landed
-
Improve readability and error detection of array_in().
- 83472de606db 17.0 landed
-
Add trailing commas to enum definitions
- 611806cd726f 17.0 cited