Re: About #13489, array dimensions and CREATE TABLE ... LIKE

From: Laurenz Albe <laurenz(dot)albe(at)cybertec(dot)at>
To: Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us>, Bruce Momjian <bruce(at)momjian(dot)us>
Cc: Bruno Bonfils <asyd(at)asyd(dot)net>, PostgreSQL-development <pgsql-hackers(at)postgresql(dot)org>, Alexey Bashtanov <alexey(at)brandwatch(dot)com>
Subject: Re: About #13489, array dimensions and CREATE TABLE ... LIKE
Date: 2023-11-21 08:33:18
Message-ID: 9334a884530a0aa56f3a1e7fd24e995c415dab25.camel@cybertec.at
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-bugs pgsql-hackers

On Mon, 2023-11-20 at 21:13 -0500, Tom Lane wrote:
> Bruce Momjian <bruce(at)momjian(dot)us> writes:
> > On Mon, Nov 20, 2023 at 09:04:21PM -0500, Tom Lane wrote:
> > > Bruce Momjian <bruce(at)momjian(dot)us> writes:
> > > > An alternate approach would
> > > > be to remove pg_attribute.attndims so we don't even try to preserve
> > > > dimensionality.
>
> > > I could get behind that, perhaps. It looks like we're not using the
> > > field in any meaningful way, and we could simplify TupleDescInitEntry
> > > and perhaps some other APIs.
>
> > So should I work on that patch or do you want to try? I think we should
> > do something.
>
> Let's wait for some other opinions, first ...

Looking at the code, I get the impression that we wouldn't lose anything
without "pg_attribute.attndims", so +1 for removing it.

This would call for some documentation. We should remove most of the
documentation about the non-existing difference between declaring a column
"integer[]", "integer[][]" or "integer[3][3]" and just describe the first
variant in detail, perhaps mentioning that the other notations are
accepted for backward compatibility.

I also think that it would be helpful to emphasize that while dimensionality
does not matter to a column definition, it matters for individual array values.
Perhaps it would make sense to recommend a check constraint if one wants
to make sure that an array column should contain only a certain kind of array.

Yours,
Laurenz Albe

In response to

Responses

Browse pgsql-bugs by date

  From Date Subject
Next Message Filip Sedlák 2023-11-21 10:32:42 Re: B-tree Index corruption
Previous Message Peter Smith 2023-11-21 08:00:36 Re: BUG #18203: Logical Replication initial sync failure

Browse pgsql-hackers by date

  From Date Subject
Next Message Dilip Kumar 2023-11-21 08:33:46 Re: SLRU optimization - configurable buffer pool and partitioning the SLRU lock
Previous Message shveta malik 2023-11-21 08:32:19 Re: Synchronizing slots from primary to standby