Re: Cleaning up array_in()

Nathan Bossart <nathandbossart@gmail.com>

From: Nathan Bossart <nathandbossart@gmail.com>
To: Tom Lane <tgl@sss.pgh.pa.us>
Cc: Alexander Lakhin <exclusion@gmail.com>, pgsql-hackers@lists.postgresql.org
Date: 2023-05-08T23:40:54Z
Lists: pgsql-hackers
On Tue, May 02, 2023 at 11:41:27AM -0400, Tom Lane wrote:
> It looks like back in the dim mists of the
> Berkeley era, there was an intentional attempt to allow
> non-rectangular array input, with the missing elements automatically
> filled out as NULLs.  Since that was undocumented, we concluded it was
> a bug and plastered on some code to check for rectangularity of the
> input.

Interesting.

> Although I view this as a bug fix, AFAICT the only effects are to
> accept input that should be rejected.  So again I don't advocate
> back-patching.  But should we sneak it into v16, or wait for v17?

I think it'd be okay to sneak it into v16, given it is technically a bug
fix.

> (This leaves ArrayGetOffset0() unused, but I'm unsure whether to
> remove that.)

Why's that?  Do you think it is likely to be used again in the future?
Otherwise, 0001 LGTM.

I haven't had a chance to look at 0002 closely yet.

-- 
Nathan Bossart
Amazon Web Services: https://aws.amazon.com



Commits

  1. Don't specify number of dimensions in cases where we don't know it.

  2. Improve readability and error detection of array_in().

  3. Add trailing commas to enum definitions