pg.ddx.io  pgsql-bugs@postgresql.org mailing list archive  
help / color / mirror / Atom feed
From: Bruce Momjian <bruce@momjian.us>
To: Laurenz Albe <laurenz.albe@cybertec.at>
Cc: Tom Lane <tgl@sss.pgh.pa.us>
Cc: Bruno Bonfils <asyd@asyd.net>
Cc: PostgreSQL-development <pgsql-hackers@postgresql.org>
Cc: Alexey Bashtanov <alexey@brandwatch.com>
Subject: Re: About #13489, array dimensions and CREATE TABLE ... LIKE
Date: Tue, 21 Nov 2023 09:20:43 -0500
Message-ID: <ZVy8u6A3j6OxdbA0@momjian.us> (raw)
In-Reply-To: <9334a884530a0aa56f3a1e7fd24e995c415dab25.camel@cybertec.at>
References: <ZD+14YZ4IUue8Rhi@gendo.asyd.net>
	<ZPuN20z3HcBXdKow@momjian.us>
	<ZVwI_ozT8z9MCnIZ@momjian.us>
	<1402391.1700532261@sss.pgh.pa.us>
	<ZVwQ6Fyh2SghkXja@momjian.us>
	<1403260.1700532781@sss.pgh.pa.us>
	<9334a884530a0aa56f3a1e7fd24e995c415dab25.camel@cybertec.at>

On Tue, Nov 21, 2023 at 09:33:18AM +0100, Laurenz Albe wrote:
> On Mon, 2023-11-20 at 21:13 -0500, Tom Lane wrote:
> > Bruce Momjian <bruce@momjian.us> writes:
> > > On Mon, Nov 20, 2023 at 09:04:21PM -0500, Tom Lane wrote:
> > > > Bruce Momjian <bruce@momjian.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.

Agreed, I see:

	https://www.postgresql.org/docs/current/arrays.html

	However, the current implementation ignores any supplied array
	size limits, i.e., the behavior is the same as for arrays of
	unspecified length.

	The current implementation does not enforce the declared number
	of dimensions either.

So both size limits and dimensions would be ignored.

> 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.

The CHECK constraint idea is very good.

-- 
  Bruce Momjian  <bruce@momjian.us>        https://momjian.us
  EDB                                      https://enterprisedb.com

  Only you can decide what is important to you.





view thread (7+ messages)

Message-ID: <ZVy8u6A3j6OxdbA0@momjian.us>
Permalink:  ../ZVy8u6A3j6OxdbA0@momjian.us/
Also on:    postgresql.org/message-id/ZVy8u6A3j6OxdbA0@momjian.us

 · 

reply

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Reply to all the recipients from your mail client; the link fills in
  the headers below: reply via email
  Some clients, webmail especially, drop In-Reply-To and References from
  a link, and the reply then starts a new thread: use the mbox below.

  To: pgsql-bugs@postgresql.org
  Cc: bruce@momjian.us, laurenz.albe@cybertec.at, tgl@sss.pgh.pa.us, asyd@asyd.net, pgsql-hackers@postgresql.org, alexey@brandwatch.com
  Subject: Re: About #13489, array dimensions and CREATE TABLE ... LIKE
  In-Reply-To: <ZVy8u6A3j6OxdbA0@momjian.us>
  References: <ZD+14YZ4IUue8Rhi@gendo.asyd.net> <ZPuN20z3HcBXdKow@momjian.us> <ZVwI_ozT8z9MCnIZ@momjian.us> <1402391.1700532261@sss.pgh.pa.us> <ZVwQ6Fyh2SghkXja@momjian.us> <1403260.1700532781@sss.pgh.pa.us> <9334a884530a0aa56f3a1e7fd24e995c415dab25.camel@cybertec.at> <ZVy8u6A3j6OxdbA0@momjian.us>

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

This inbox is served by DDX for PostgreSQL; see mirroring instructions
for how to clone and mirror all data and code used for this inbox