pg.ddx.io  pgsql-bugs@postgresql.org mailing list archive  
help / color / mirror / Atom feed
From: pinker <pinker@onet.eu>
To: pgsql-bugs@postgresql.org
Subject: Re: pg_dump - wrong order with inheritance
Date: Tue, 24 Nov 2015 08:34:47 -0700 (MST)
Message-ID: <1448379287033-5874925.post@n5.nabble.com> (raw)
In-Reply-To: <1655.1448289868@sss.pgh.pa.us>
References: <1448281678687-5874794.post@n5.nabble.com>
	<1655.1448289868@sss.pgh.pa.us>
List-Unsubscribe: <mailto:majordomo@postgresql.org?body=unsub%20pgsql-bugs>

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.

<pre>
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;

</pre>

and now:
pg_dump testdump | psql testdump02

<pre>
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"
</pre>

so pg_dump is trying to create table a03 this way:
<pre>
CREATE TABLE a03 (
    id integer,
    name text
)
INHERITS (a00);
</pre>

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



view thread (7+ messages)  latest in thread

Message-ID: <1448379287033-5874925.post@n5.nabble.com>
Permalink:  ../1448379287033-5874925.post@n5.nabble.com/
Also on:    postgresql.org/message-id/1448379287033-5874925.post@n5.nabble.com

 · 

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: pinker@onet.eu
  Subject: Re: pg_dump - wrong order with inheritance
  In-Reply-To: <1448379287033-5874925.post@n5.nabble.com>
  References: <1448281678687-5874794.post@n5.nabble.com> <1655.1448289868@sss.pgh.pa.us> <1448379287033-5874925.post@n5.nabble.com>

* 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