Skip site navigation (1) Skip section navigation (2)

Bug #719: Restoring inherited data destroys parent table data.

From: pgsql-bugs(at)postgresql(dot)org
To: pgsql-bugs(at)postgresql(dot)org
Subject: Bug #719: Restoring inherited data destroys parent table data.
Date: 2002-07-25 10:15:26
Message-ID: 20020725101526.75C1847595F@postgresql.org (view raw or flat)
Thread:
Lists: pgsql-bugs
Rob Olsthoorn (rolsthoorn(at)irdetoaccess(dot)com) reports a bug with a severity of 1
The lower the number the more severe it is.

Short Description
Restoring inherited data destroys parent table data.

Long Description
Happens at least in version 7.2

When restoring a database dump in a clean database, the data of all parents of inherited tables also get the data of the child tables included in the select.

The only workaround I found for this problem is to create the child tables as duplicates of the parent tables and restore only the data.

See a full the code example below.

Sample Code
> createdb db
> psql db
db=# create table a (a int);
db=# create table b () inherits (a);
db=# insert into a values (1);
db=# insert into a values (2);
db=# insert into b values (1);
db=# insert into b values (12);
db=# select * from a;
 a
---
 1
 2
(2 rows)
db=# \q
> pg_dump -D -t a -t b db > db.dump
> dropdb db
> createdb db
> psql -f db.dump db
> psql db
db=# select * from a;
 a
---
 1
 2
 2
 1
(4 rows)
db=# 

No file was uploaded with this report


Responses

pgsql-bugs by date

Next:From: Tom LaneDate: 2002-07-25 15:11:09
Subject: Re: Bug #719: Restoring inherited data destroys parent table data.
Previous:From: Ivan DolininDate: 2002-07-25 06:33:29
Subject: Can't solve this problem

Privacy Policy | About PostgreSQL
Copyright © 1996-2014 The PostgreSQL Global Development Group