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-14 08:14:01
Message-ID: CACJufxE6JFUeL=v4wGLY67TE1fAS3MAu_20VDARgzeHeetEgUQ@mail.gmail.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-hackers

On Thu, Sep 14, 2023 at 2:00 PM Alexander Lakhin <exclusion(at)gmail(dot)com> wrote:
>
>
> I didn't mean to remove the prefix "array_in-", but in fact I was confused
> by the "{function_name}-" syntax, and now when I've looked at it closely, I
> see that that syntax was quite popular ("date_in- ", "single_decode- ", ...)
> back in 1997 (see 9d8ae7977). But nowadays it is out of fashion, with most
> of such debugging prints were gone with 7a877dfd2 and the next-to-last one
> with 50861cd68. Moreover, as the latter commit shows, such debugging output
> can be eliminated completely without remorse. (And I couldn't find mentions
> of ARRAYDEBUG in pgsql-bugs, pgsql-hackers archives, so probably no one used
> that debugging facility since it's introduction.)
> As of now, the output still weird (I mean the excessive right parenthesis):
> DEBUG: ndim 1 ( 2 -1 -1 -1 -1 -1); lBound info: 1 1 1 1 1 1) for {0,0}
>

hi.
similar to NUMERIC_DEBUG. I made the following adjustments.
if unnecessary, removing this part seems also fine, in GDB, you can
print it out directly.

/* ----------
* Uncomment the following to get a dump of a array's ndim, dim, lBound.
* ----------
#define ARRAYDEBUG
*/
#ifdef ARRAYDEBUG
{
StringInfoData buf;

initStringInfo(&buf);

appendStringInfo(&buf, "array_in- ndim %d, dim info(", ndim);
for (int i = 0; i < MAXDIM; i++)
appendStringInfo(&buf, " %d", dim[i]);
appendStringInfo(&buf, "); lBound info(");
for (int i = 0; i < MAXDIM; i++)
appendStringInfo(&buf, " %d", lBound[i]);
appendStringInfo(&buf, ") for %s", string);
elog(DEBUG1, "%s", buf.data);
pfree(buf.data);
}
#endif

other than this, no other changes.

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

In response to

Responses

Browse pgsql-hackers by date

  From Date Subject
Next Message Amit Langote 2023-09-14 08:14:51 Re: remaining sql/json patches
Previous Message Michael Paquier 2023-09-14 07:56:03 Re: Quoting filename in using facing log messages