Re: Cleaning up array_in()

From: jian he <jian(dot)universality(at)gmail(dot)com>
To: Alexander Lakhin <exclusion(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-13 08:55:23
Message-ID: CACJufxESheCbLHOwGVCFWvtr4wVL0yKemfLs1_4LtNWP9oTqdQ@mail.gmail.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-hackers

On Wed, Sep 13, 2023 at 2:00 PM Alexander Lakhin <exclusion(at)gmail(dot)com> wrote:
>
>
> Now I see only a few wrinkles.
> 1) A minor asymmetry in providing details appeared:
> select E'{"a"a}'::text[];
> ERROR: malformed array literal: "{"a"a}"
> LINE 1: select E'{"a"a}'::text[];
> ^
> DETAIL: Unexpected array element.
>
> select E'{a"a"}'::text[];
> ERROR: malformed array literal: "{a"a"}"
> LINE 1: select E'{a"a"}'::text[];
> ^
> (no DETAIL)
>
> Old behavior:
> select E'{a"a"}'::text[];
> ERROR: malformed array literal: "{a"a"}"
> LINE 1: select E'{a"a"}'::text[];
> ^
> DETAIL: Unexpected array element.
>
> select E'{"a"a}'::text[];
> ERROR: malformed array literal: "{"a"a}"
> LINE 1: select E'{"a"a}'::text[];
> ^
> DETAIL: Unexpected array element.

fixed and added these two query to the test.

> 2) CPPFLAGS="-DARRAYDEBUG" ./configure ... breaks "make check", maybe change elog(NOTICE) to elog(DEBUG1)?
> 2a) a message logged there lacks some delimiter before "lBound info":
> NOTICE: array_in- ndim 1 ( 3 -1 -1 -1 -1 -1lBound info 1 1 1 1 1 1) for {red,green,blue}
> what about changing the format to "ndim 1 ( 3 -1 -1 -1 -1 -1; lBound info: 1 1 1 1 1 1)"?

fixed. Use elog(DEBUG1) now.

> 3) It seems that new comments need polishing, in particular:
> /* initialize dim, lBound. useful for ReadArrayDimensions ReadArrayStr */
> ->?
> /* Initialize dim, lBound for ReadArrayDimensions, ReadArrayStr */
>
> Otherwise, we determine the dimensions from the in curly-braces
> ->?
> Otherwise, we determine the dimensions from the curly braces.
>
> Best regards,
> Alexander

comments updates. please check the attached.

Attachment Content-Type Size
v8-0003-Re-indent-ArrayCount.patch application/x-patch 10.7 KB
v8-0005-Determine-array-dimensions-and-parse-the-elements.patch application/x-patch 38.0 KB
v8-0004-Extract-loop-to-read-array-dimensions-to-subrouti.patch application/x-patch 8.2 KB
v8-0001-Simplify-and-speed-up-ReadArrayStr.patch application/x-patch 8.1 KB
v8-0002-Rewrite-ArrayCount-to-make-dimensionality-checks-.patch application/x-patch 20.5 KB
v8-0006-refactor-ReadDimensionInt.patch application/x-patch 5.5 KB
v8-0007-refactor-ReadArrayStr.patch application/x-patch 7.8 KB

In response to

Responses

Browse pgsql-hackers by date

  From Date Subject
Next Message Maxim Orlov 2023-09-13 08:57:52 Re: ALTER COLUMN ... SET EXPRESSION to alter stored generated column's expression
Previous Message Junwang Zhao 2023-09-13 08:46:31 Re: [dynahash] do not refill the hashkey after hash_search