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

BUG #4709: dump/restore introduces wrong CHECK constraint for inherited table

From: "Andrey" <andrey(at)ulab(dot)ru>
To: pgsql-bugs(at)postgresql(dot)org
Subject: BUG #4709: dump/restore introduces wrong CHECK constraint for inherited table
Date: 2009-03-17 12:01:41
Message-ID: 200903171201.n2HC1fWk038022@wwwmaster.postgresql.org (view raw or flat)
Thread:
Lists: pgsql-bugs
The following bug has been logged online:

Bug reference:      4709
Logged by:          Andrey
Email address:      andrey(at)ulab(dot)ru
PostgreSQL version: 8.3.6
Operating system:   rhel-4-i386
Description:        dump/restore introduces wrong CHECK constraint for
inherited table
Details: 

Assume we have 2 tables with additionally added CHECK constraints:
CREATE TABLE t
(
id serial NOT NULL,
"type" integer NOT NULL,
CONSTRAINT pkey_t PRIMARY KEY (id)
) WITH (OIDS=FALSE);

CREATE TABLE t1
(
CONSTRAINT pkey_t1 PRIMARY KEY (id)
) INHERITS (t) WITH (OIDS=FALSE);

ALTER TABLE ONLY t ADD CONSTRAINT type_eq_zero CHECK (type = 0);
ALTER TABLE t1 ADD CONSTRAINT type_eq_one CHECK (type = 1);

As one can see, "type_eq_zero" constraint is applied to table "t" only and
it's not applied to "t1".

Then I do dump for entire database. After that I try to restore it and see
that after schema part of dump file is restored, table "t1" has both
"type_eq_zero" and "type_eq_one" constraints, which is completely different
situation that leads to failures when restoration process goes further and
tries to load data to the table.

Postgres version 8.3.6 under RHEL4 (32 bit)

To run dump I use: pg_dump -f <filename> -F p <databasename>
To restore: psql -f <filename> <databasename>

Responses

pgsql-bugs by date

Next:From: Tom LaneDate: 2009-03-17 12:36:41
Subject: Re: BUG #4709: dump/restore introduces wrong CHECK constraint for inherited table
Previous:From: Tom LaneDate: 2009-03-16 20:33:09
Subject: Re: BUG #4708: \d commands

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