pg.ddx.io  pgsql-bugs@postgresql.org mailing list archive  
help / color / mirror / Atom feed
From: Alexey Bashtanov <bashtanov@imap.cc>
To: pgsql-bugs@postgresql.org
Subject: should all not-null constraints be inherited?
Date: Wed, 31 Mar 2021 16:12:40 +0100
Message-ID: <a9514aea-af19-8b29-1713-17874fffdea0@imap.cc> (raw)

Hello,

This is how one can create a parent with a non-nullable column and a 
child with the same column nullable:

create table t1(a int not null);
create table t2() inherits (t1);
alter table t2 alter column a drop not null;
insert into t2 select null;

pg_dump produces a dump that fails to restore, as the change by the 
alter command doesn't get addressed.
Reproduced in 10 and 14devel.

Should we fix ALTER TABLE or pg_dump?

Best, Alex





view thread (3+ messages)  latest in thread

Message-ID: <a9514aea-af19-8b29-1713-17874fffdea0@imap.cc>
Permalink:  ../a9514aea-af19-8b29-1713-17874fffdea0@imap.cc/
Also on:    postgresql.org/message-id/a9514aea-af19-8b29-1713-17874fffdea0@imap.cc

 · 

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: bashtanov@imap.cc
  Subject: Re: should all not-null constraints be inherited?
  In-Reply-To: <a9514aea-af19-8b29-1713-17874fffdea0@imap.cc>
  References: <a9514aea-af19-8b29-1713-17874fffdea0@imap.cc>

* 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