Search Postgresql Archives

Re: disable triggers using psql

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



I may be off-track here but triggers do not enforce referential integrity -
constraints do.  If you need to disable triggers you can do so via the ALTER
TABLE command.

The reason I think pg_restore works for you is because when a table is built
using pg_restore all the data is loaded into all tables BEFORE any
constraints are created.  I believe that if you did a data-only dump from
pg_dump you would have the same integrity problems.

You can manually get similar behavior by dropping table/column constraints
and then re-creating them (and indexes) after the reload is complete.
Primary Keys should remain permanently but since you do not want to violate
those anyway the problem is not relevant.

The only other option to consider is to make all the relevant constraints
deferrable - though this may not always be possible.

David J


-----Original Message-----
From: pgsql-general-owner@xxxxxxxxxxxxxx
[mailto:pgsql-general-owner@xxxxxxxxxxxxxx] On Behalf Of Geoffrey Myers
Sent: Wednesday, February 16, 2011 9:51 AM
To: pgsql-general
Subject:  disable triggers using psql

So, we have a text dump that we used to clean up our data, now we need to
reload it into the new database.  Problem is, we have some data integrity
issues that cause records to fail to load.  Before we ran into the data
conversion issue we were using 'pg_restore disable_triggers' to get around
the data integrity issue.

Is there a way to resolve this issue with the psql loading approach?

--
Until later, Geoffrey

"I predict future happiness for America if they can prevent the government
from wasting the labors of the people under the pretense of taking care of
them."
- Thomas Jefferson

--
Sent via pgsql-general mailing list (pgsql-general@xxxxxxxxxxxxxx) To make
changes to your subscription:
http://www.postgresql.org/mailpref/pgsql-general


-- 
Sent via pgsql-general mailing list (pgsql-general@xxxxxxxxxxxxxx)
To make changes to your subscription:
http://www.postgresql.org/mailpref/pgsql-general


[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Index of Archives]     [Postgresql Jobs]     [Postgresql Admin]     [Postgresql Performance]     [Linux Clusters]     [PHP Home]     [PHP on Windows]     [Kernel Newbies]     [PHP Classes]     [PHP Books]     [PHP Databases]     [Postgresql & PHP]     [Yosemite]
  Powered by Linux