Received: from malur.postgresql.org ([217.196.149.56]) by arkaria.postgresql.org with esmtp (Exim 4.80) (envelope-from ) id 1a1FcL-0001bE-R4 for pgsql-bugs@arkaria.postgresql.org; Tue, 24 Nov 2015 15:34:53 +0000 Received: from localhost ([127.0.0.1] helo=postgresql.org) by malur.postgresql.org with smtp (Exim 4.84) (envelope-from ) id 1a1FcL-0007g5-8s for pgsql-bugs@arkaria.postgresql.org; Tue, 24 Nov 2015 15:34:53 +0000 Received: from magus.postgresql.org ([2a02:c0:301:0:ffff::29]) by malur.postgresql.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_CBC_SHA384:256) (Exim 4.84) (envelope-from ) id 1a1FcK-0007fz-Ue for pgsql-bugs@postgresql.org; Tue, 24 Nov 2015 15:34:52 +0000 Received: from mbob.nabble.com ([162.253.133.15]) by magus.postgresql.org with esmtp (Exim 4.84) (envelope-from ) id 1a1FcH-0007us-OM for pgsql-bugs@postgresql.org; Tue, 24 Nov 2015 15:34:52 +0000 Received: from msam.nabble.com (unknown [162.253.133.85]) by mbob.nabble.com (Postfix) with ESMTP id 4AC861ACBA5B for ; Tue, 24 Nov 2015 07:21:42 -0800 (PST) Date: Tue, 24 Nov 2015 08:34:47 -0700 (MST) From: pinker To: pgsql-bugs@postgresql.org Message-ID: <1448379287033-5874925.post@n5.nabble.com> In-Reply-To: <1655.1448289868@sss.pgh.pa.us> References: <1448281678687-5874794.post@n5.nabble.com> <1655.1448289868@sss.pgh.pa.us> Subject: Re: pg_dump - wrong order with inheritance MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Transfer-Encoding: 7bit X-Pg-Spam-Score: -1.9 (-) 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 Tom Lane-2 wrote > FWIW, the reason I'm doubtful of your wrong-dump-order diagnosis is > that it's pretty hard to see how a not-null violation would arise > that way. The subsequent complaints may only be consequences of > that one. i've just prepared test case and did some debugging. It turned out that the issue isn't dump order but wrong ddl generated by pg_dump.
CREATE TABLE a00
(
  id   INTEGER NOT NULL,
  name TEXT    NOT NULL,
  CONSTRAINT a00_pkey PRIMARY KEY (id)
)
WITH (
OIDS =FALSE
);

CREATE TABLE a03
(
  id   INTEGER NOT NULL,
  name TEXT    NOT NULL,
  CONSTRAINT a03_pkey PRIMARY KEY (id)
)

WITH (
OIDS =FALSE
);

ALTER TABLE a03
INHERIT a00;

ALTER TABLE a03
ALTER COLUMN name DROP NOT NULL;

and now: pg_dump testdump | psql testdump02
COPY 0
ERROR:  null value in column "name" violates not-null constraint
DETAIL:  Failing row contains (1, null).
CONTEXT:  COPY a03, line 1: "1  \N"
so pg_dump is trying to create table a03 this way:
CREATE TABLE a03 (
    id integer,
    name text
)
INHERITS (a00);
and don't takes into account that column name has changed. -- View this message in context: http://postgresql.nabble.com/pg-dump-wrong-order-with-inheritance-tp5874794p5874925.html Sent from the PostgreSQL - bugs mailing list archive at Nabble.com. -- Sent via pgsql-bugs mailing list (pgsql-bugs@postgresql.org) To make changes to your subscription: http://www.postgresql.org/mailpref/pgsql-bugs