Re: Cleaning up array_in()

From: Alexander Lakhin <exclusion(at)gmail(dot)com>
To: jian he <jian(dot)universality(at)gmail(dot)com>
Cc: Heikki Linnakangas <hlinnaka(at)iki(dot)fi>, Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us>, Nikhil Benesch <nikhil(dot)benesch(at)gmail(dot)com>, Nathan Bossart <nathandbossart(at)gmail(dot)com>, pgsql-hackers(at)lists(dot)postgresql(dot)org
Subject: Re: Cleaning up array_in()
Date: 2023-09-11 12:00:00
Message-ID: 548a24fa-3229-8192-c4e9-01d2cc4c612c@gmail.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
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

In response to

Responses

Browse pgsql-hackers by date

  From Date Subject
Next Message David Rowley 2023-09-11 12:00:10 Re: Speed up transaction completion faster after many relations are accessed in a transaction
Previous Message Jelte Fennema 2023-09-11 11:59:50 Re: proposal: psql: show current user in prompt