public inbox for [email protected]  
help / color / mirror / Atom feed
From: Justin Pryzby <[email protected]>
To: Robert Haas <[email protected]>
Cc: Alvaro Herrera <[email protected]>
Cc: Kyotaro Horiguchi <[email protected]>
Cc: [email protected]
Cc: Alexander Lakhin <[email protected]>
Cc: Dmitry Koval <[email protected]>
Subject: Re: pg17 issues with not-null contraints
Date: Fri, 3 May 2024 09:05:19 -0500
Message-ID: <ZjTvH99NPNF1QY6n@pryzbyj2023> (raw)
In-Reply-To: <ZjE-CqULOywtc2dd@pryzbyj2023>
References: <ZiE3NoY6DdvlvFl9@pryzbyj2023>
	<[email protected]>
	<ZiFPsoYEsCjNwHnk@pryzbyj2023>
	<CA+TgmoZY6zqv7vA+MUBc=1YugbMDjia3Ze9n5JD2X34NhehPUQ@mail.gmail.com>
	<ZjE-CqULOywtc2dd@pryzbyj2023>

On another thread [0], Alexander Lakhin pointed out, indirectly, that
partitions created using LIKE+ATTACH now have different not-null constraints
from partitions created using PARTITION OF.

postgres=# CREATE TABLE t (i int PRIMARY KEY) PARTITION BY RANGE (i);
postgres=# CREATE TABLE t1 PARTITION OF t DEFAULT ;
postgres=# \d+ t1
...
Partition of: t DEFAULT
No partition constraint
Indexes:
    "t1_pkey" PRIMARY KEY, btree (i)
Access method: heap

But if it's created with LIKE:
postgres=# CREATE TABLE t1 (LIKE t);
postgres=# ALTER TABLE t ATTACH PARTITION t1 DEFAULT ;

..one also sees:

Not-null constraints:
    "t1_i_not_null" NOT NULL "i"

It looks like ATTACH may have an issue with constraints implied by pkey.

[0] https://www.postgresql.org/message-id/8034d1c6-5f0e-e858-9af9-45d5e246515e%40gmail.com

-- 
Justin






view thread (6+ messages)

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 using the --to and --cc options:
  reply via email

  To: [email protected]
  Cc: [email protected], [email protected], [email protected], [email protected], [email protected], [email protected], [email protected]
  Subject: Re: pg17 issues with not-null contraints
  In-Reply-To: <ZjTvH99NPNF1QY6n@pryzbyj2023>

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

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