pg_dump --> restore loses constraints/triggers?

From: Christopher Murtagh <christopher(dot)murtagh(at)mcgill(dot)ca>
To: pgsql-general(at)postgresql(dot)org
Subject: pg_dump --> restore loses constraints/triggers?
Date: 2003-02-17 22:11:49
Message-ID: Pine.LNX.4.44.0302171702310.1756-100000@blues.wcg.mcgill.ca
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-general


Greetings,

We've seem to come into a problem with some of our referential integrity
checks, and I was wondering if anyone else had experienced this.

To upgrade our DB from 7.1 to 7.3 I did:

pg_dump --create dbname > backup_file.sql

Then created users, and \i backup_file.sql from the command prompt.

All the data seems to be there, but many foreign key constraints seem to
be broken. For example, we created this table:

CREATE TABLE ind (
ind_id INTEGER DEFAULT NEXTVAL(''"ind_id_seq"''::text),
bnr_id INTEGER PRIMARY KEY,
...(other columns)
);

and another table that makes reference to it:

CREATE TABLE grp_join_ind_clt (
grp_id INTEGER REFERENCES grp ON UPDATE CASCADE ON DELETE CASCADE,
bnr_id INTEGER REFERENCES ind ON UPDATE CASCADE ON DELETE CASCADE
);

Now, when we've restored, the first trigger above (on the table 'grp')
works, but not the one on 'ind'. Also, the contstraints were not added as
contstraints to the tables, but as CREATE CONSTRAINT TRIGGER "<unnamed>"
instead. Is this normal? Or should they be ALTER TABLE's? We're stumped
as to what happened, and to how to fix it. Any ideas/thoughts? Any info on
this would be much appreciated.

Thanks in advance.

Cheers,

Chris

--

Christopher Murtagh
Webmaster / Sysadmin
Web Communications Group
McGill University
Montreal, Quebec
Canada

Tel.: (514) 398-3122
Fax: (514) 398-2017

Responses

Browse pgsql-general by date

  From Date Subject
Next Message Tom Lane 2003-02-17 22:23:32 Re: Compatible UNION query for postgresql and MS SQL Server
Previous Message Andrew Sullivan 2003-02-17 21:56:58 Re: How do people do schema upgrades?