pg_dump table ordering bug [8.0.1]

From: Andreas Lange <anlan(at)ida(dot)liu(dot)se>
To: pgsql-bugs(at)postgresql(dot)org
Subject: pg_dump table ordering bug [8.0.1]
Date: 2005-02-06 17:20:10
Message-ID: 420651CA.3080803@ida.liu.se
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-bugs

Hi!

Our upgrade from 7.4.6 to 8.0.1 only had one small glitch. Two tables
got dumped in the wrong order (before their dependecies) and had to get
their contents added manually after the restore. I've atleast isolated
the part where things go wrong.

Two files are attached, related as follows (all binaries from 8.0.1):
> psql -f db-9-spec.sql
> pg_dump -n debug database > db-9-dump.sql
[drop schema debug cascade]
> psql -f db-9-dump.sql

psql:db-9-dump.sql:302: ERROR: new row for relation "form_a_int"
violates check constraint "form_a_int_qid_check"
CONTEXT: COPY form_a_int, line 1: "1 2 1109 5"
psql:db-9-dump.sql:311: ERROR: new row for relation "form_a_text"
violates check constraint "form_a_text_qid_check"
CONTEXT: COPY form_a_text, line 1: "1 1 1109 foo"

The tables have both check and reference constraints. The errors are
from check constraints but the reference constraints would have kicked
in next as the referenced data is below this table in the dump file...

ida=# \d debug.form_a_int
Table "debug.form_a_int"
Column | Type | Modifiers
-----------+---------+-----------
finstance | integer | not null
qid | integer | not null
uid | integer | not null
a_int | integer |
Indexes:
"form_a_int_pkey" primary key, btree (finstance, qid, uid)
Check constraints:
"form_a_int_check" CHECK (debug.match_q_instance(finstance, qid))
"form_a_int_qid_check" CHECK (debug.get_atype(qid) = 'INT'::text)
Foreign-key constraints:
"form_a_int_qid_fkey" FOREIGN KEY (qid) REFERENCES debug.form_q(qid)
ON UPDATE CASCADE ON DELETE CASCADE
"form_a_int_finstance_fkey" FOREIGN KEY (finstance) REFERENCES
debug.form_instance(finstance) ON UPDATE CASCADE ON DELETE CASCADE

And the dump data order is:
-- Data for Name: form_a_int;
-- Data for Name: form_instance;
-- Data for Name: form_q;

Regards,
Andreas (Not a subscriber of this list)

Attachment Content-Type Size
db-9-spec.sql text/plain 4.9 KB
db-9-dump.sql text/plain 11.4 KB

Responses

Browse pgsql-bugs by date

  From Date Subject
Next Message Manlio Perillo 2005-02-06 18:12:08 BUG #1465: UTF-8 BOM
Previous Message Vojtech Rysanek 2005-02-06 11:57:48 BUG #1464: Borland C++ problem