Inherited tables and pg_dump

From: Ingo van Lil <inguin(at)gmx(dot)de>
To: pgsql-bugs(at)postgresql(dot)org
Subject: Inherited tables and pg_dump
Date: 2002-05-22 23:48:54
Message-ID: 20020523014854.A16769@marvin.csn.tu-chemnitz.de
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-bugs

Ahoy there,

I'm the database admin of the Chemnitz Student's Network. Today we
noticed a bug in pg_dump that makes it impossible for us to use it to
create valid backups of our database. We're currently running pgsql
7.1.3, but I was able to reproduce the bug with the latest version,
7.1.2.
We've got a table that inherits another one, and we had to add a new
column to the mother table (and thus to the son, too). Now, if we dump
the database, the columns of the INSERT resp. COPY commands for the data
of the son table are in wrong order. A short sample to reproduce the
behaviour (excuse the unimaginative identifiers):

CREATE TABLE mother (i1 integer, c1 char);
CREATE TABLE son (c2 char) INHERITS (test1);
ALTER TABLE mother ADD i2 integer;

INSERT INTO son (i1, c1, c2, i2) VALUES (1, 'a', 'b', 2);
INSERT INTO son (i1, c1, c2, i2) VALUES (3, 'c', 'd', 4);

A (shortened) dump of this database looks like this:

CREATE TABLE "mother" (
"i1" integer,
"c1" character(1),
"i2" integer
);

CREATE TABLE "son" (
"c2" character(1)
)
INHERITS ("mother");

COPY "son" FROM stdin;
1 a b 2
3 c d 4
\.

As you can see, the columns aren't dropped in the order they are
expected to be, so you can't restore that dump using psql.

Cheers,
Ingo

Responses

Browse pgsql-bugs by date

  From Date Subject
Next Message Tom Lane 2002-05-23 02:33:21 Re: Inherited tables and pg_dump
Previous Message pgsql-bugs 2002-05-22 20:40:01 Bug #673: Postgresql under cygwin leaking handles