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

From jian he
Subject Re: Cleaning up array_in()
Date
Msg-id CACJufxEv1GQ600VvTesx-E3Xvy87ZguqAjjstcNu8nPvVSmeHQ@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 Sun, Sep 10, 2023 at 6:00 PM Alexander Lakhin <exclusion@gmail.com> wrote:
> Case 1:
> SELECT '{1,'::integer[];
> ERROR:  malformed array literal: "{1,"
> LINE 1: SELECT '{1,'::integer[];
>                 ^
> DETAIL:  Unexpected end of input.
>
> vs
>
> ERROR:  malformed array literal: "{1,"
> LINE 1: SELECT '{1,'::integer[];
>                 ^
>
> (no DETAIL)
>
> Case 2:
> SELECT '{{},}'::text[];
> ERROR:  malformed array literal: "{{},}"
> LINE 1: SELECT '{{},}'::text[];
>                 ^
> DETAIL:  Unexpected "}" character
>
> vs
>   text
> ------
>   {}
> (1 row)
>
> Case 3:
> select '{\{}'::text[];
>   text
> -------
>   {"{"}
> (1 row)
>
> vs
>   text
> ------
>   {""}
>
> Best regards,
> Alexander

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.

Attachment

pgsql-hackers by date:

Previous
From: Dilip Kumar
Date:
Subject: Re: [PoC] pg_upgrade: allow to upgrade publisher node
Next
From: bt23nguyent
Date:
Subject: Re: pg_logical_emit_message() misses a XLogFlush()