Re: [NOVICE] Suspend Referential Integrity? - Mailing list pgsql-sql

From daq
Subject Re: [NOVICE] Suspend Referential Integrity?
Date
Msg-id 1022859781.20050809155857@ugyvitelszolgaltato.hu
Whole thread Raw
List pgsql-sql
JJ> I'm trying to port a database from Oracle to PostgreSQL.  I used a perl script,
JJ> ora2pg to extract the info from Oracle.  

JJ> The table data was extracted in alphabetical order.  When I attempt to load it,
JJ> I get referential integrity violations (eg. I attempt to load CUSTOMER, but
JJ> CUSTOMOER depends on the SOURCE table, which hasn't been loaded yet).

JJ> Is there a way to temporarily suspend RI checking so I can load the data and
JJ> then fix it later?

JJ> =================================================================
JJ> | Jim Jarrett,Madison, WI       94 Passat GLX                   |
JJ> | mailto:jarrett@rpa.net         81 Rabbit Convertible 16v      |
JJ> |                                                               |
JJ> |    Any problem can be solved with the proper application of   |
JJ> |   Force, Heat, Chemicals, or Money.                           |
JJ> ================================================================

JJ> ---------------------------(end of broadcast)---------------------------
JJ> TIP 6: explain analyze is your friend

You can switch off all triggers on a table.

update pg_class set reltriggers=0 where relname='your_table_name';

To switch back:

update pg_class set reltriggers=(select count(*) from pg_triggers
where pg_class.oid=tgrelid) where relname='your_table_name';

DAQ



pgsql-sql by date:

Previous
From: Mischa Sandberg
Date:
Subject: Re: sum but not grouped by?
Next
From: Timothy Smith
Date:
Subject: unsubscribe