Checking FKs after COPY and disabled Triggers

From: Janning Vygen <vygen(at)gmx(dot)de>
To: pgsql-general(at)postgresql(dot)org
Subject: Checking FKs after COPY and disabled Triggers
Date: 2004-04-01 08:21:41
Message-ID: 200404011021.41547.vygen@gmx.de
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-general

hi PGurus,

i searched the archives and read the docs, because this problem shouldn't be
new. But i really don't know what to search for.

i am populating a database (v7.4.1) with COPY. Some triggers in the db schema
fire on inserts and do some additional data manipulations, which i dont want
to take place by running COPY because my data don't need those additional
manipulation. Therefor and for performance reasons, i disable all triggers
with commands like this (stolen from pg_dump output)

UPDATE pg_catalog.pg_class SET reltriggers = 0 WHERE oid =
'Customers'::pg_catalog.regclass;

of course i enable them afterwards. This does in fact diable Foreign Key
Constraints too, right? And that's nice because i think its much faster.

My problem: my COPY data files are build by perl scripts which might be buggy.
i would like to check that all FKs are correct after or while populating the
data.

1. Can i disable my triggers without disabling FK constraints? if yes, how?

2. If no to question 1 or lacks performance:
can i check my database for violating FKs if i populated the database with FK
constraints disabled? I guess there is a SQL query which consults some
pg_catalog tables and checks all fk integrity

Any help is very appreciated.

kind regards,
janning

Responses

Browse pgsql-general by date

  From Date Subject
Next Message Richard Huxton 2004-04-01 09:52:27 Re: select distinct w/order by
Previous Message Bruno LEVEQUE 2004-04-01 07:35:52 Re: Best open source db poll currently