Re: [NOVICE] Suspend Referential Integrity?

From: daq <daq(at)ugyvitelszolgaltato(dot)hu>
To: Pgsql-sql(at)postgresql(dot)org
Subject: Re: [NOVICE] Suspend Referential Integrity?
Date: 2005-08-09 13:58:57
Message-ID: 1022859781.20050809155857@ugyvitelszolgaltato.hu
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: 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(at)rpa(dot)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

Browse pgsql-sql by date

  From Date Subject
Next Message Timothy Smith 2005-08-09 22:31:50 unsubscribe
Previous Message Haris Saybasili 2005-08-08 18:41:22 trigger between to different database