Received: from malur.postgresql.org ([217.196.149.56]) by arkaria.postgresql.org with esmtp (Exim 4.84_2) (envelope-from ) id 1dotFj-00009S-NC for pgsql-bugs@arkaria.postgresql.org; Mon, 04 Sep 2017 15:25:31 +0000 Received: from localhost ([127.0.0.1] helo=postgresql.org) by malur.postgresql.org with smtp (Exim 4.84_2) (envelope-from ) id 1dotFj-0001TZ-9g for pgsql-bugs@arkaria.postgresql.org; Mon, 04 Sep 2017 15:25:31 +0000 Received: from makus.postgresql.org ([2001:4800:1501:1::229]) by malur.postgresql.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_CBC_SHA384:256) (Exim 4.84_2) (envelope-from ) id 1dotF1-000055-4g for pgsql-bugs@postgresql.org; Mon, 04 Sep 2017 15:24:47 +0000 Received: from sss.pgh.pa.us ([66.207.139.130]) by makus.postgresql.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_CBC_SHA384:256) (Exim 4.84_2) (envelope-from ) id 1dotEu-0004Fu-Tp for pgsql-bugs@postgresql.org; Mon, 04 Sep 2017 15:24:45 +0000 Received: from sss1.sss.pgh.pa.us (localhost [127.0.0.1]) by sss.pgh.pa.us (8.14.4/8.14.4) with ESMTP id v84FOdFg031332; Mon, 4 Sep 2017 11:24:39 -0400 From: Tom Lane To: Piotr S cc: pgsql-bugs@postgresql.org Subject: Re: pg_dump and pg_restore on inherited tables problem In-reply-to: References: Comments: In-reply-to Piotr S message dated "Mon, 04 Sep 2017 11:00:42 +0200" MIME-Version: 1.0 Content-Type: text/plain; charset="us-ascii" Content-ID: <31330.1504538679.1@sss.pgh.pa.us> Date: Mon, 04 Sep 2017 11:24:39 -0400 Message-ID: <31331.1504538679@sss.pgh.pa.us> List-Archive: List-Help: List-ID: List-Owner: List-Post: List-Subscribe: List-Unsubscribe: X-Mailing-List: pgsql-bugs Precedence: bulk Sender: pgsql-bugs-owner@postgresql.org Piotr S writes: > Hello, i think there is a problem with some specify situation when source > database was set different default value between main and inherited table. The problem here is that your child table doesn't have a not-null constraint on the inh_level column, while the parent does. That's a logically inconsistent situation, and it's not really pg_dump's fault that it fails to reproduce it exactly. We've fixed that problem in v10: now, the child table inherits the not-null constraint when you do the ALTER ADD PRIMARY KEY. So your setup script fails to insert the inconsistent data: d1=# INSERT INTO test_otw(id, description) VALUES (1, 'some test row'); ERROR: null value in column "inh_level" violates not-null constraint DETAIL: Failing row contains (1, null, some test row). regards, tom lane -- Sent via pgsql-bugs mailing list (pgsql-bugs@postgresql.org) To make changes to your subscription: http://www.postgresql.org/mailpref/pgsql-bugs