Re: pg_dump - wrong order with inheritance

From: pinker <pinker(at)onet(dot)eu>
To: pgsql-bugs(at)postgresql(dot)org
Subject: Re: pg_dump - wrong order with inheritance
Date: 2015-11-24 15:34:47
Message-ID: 1448379287033-5874925.post@n5.nabble.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-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.

In response to

Responses

Browse pgsql-bugs by date

  From Date Subject
Next Message Tom Lane 2015-11-24 16:43:48 Re: pg_dump - wrong order with inheritance
Previous Message Michael Paquier 2015-11-24 14:22:58 Re: Confusing error message with too-large file in pg_basebackup