Re: disable triggers using psql

Поиск
Список
Период
Сортировка
От David Johnston
Тема Re: disable triggers using psql
Дата
Msg-id 03d201cbcdeb$6d438020$47ca8060$@yahoo.com
обсуждение исходный текст
Ответ на disable triggers using psql  (Geoffrey Myers <lists@serioustechnology.com>)
Ответы Re: disable triggers using psql  (Andrew Sullivan <ajs@crankycanuck.ca>)
Список pgsql-general
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@postgresql.org
[mailto:pgsql-general-owner@postgresql.org] On Behalf Of Geoffrey Myers
Sent: Wednesday, February 16, 2011 9:51 AM
To: pgsql-general
Subject: [GENERAL] 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@postgresql.org) To make
changes to your subscription:
http://www.postgresql.org/mailpref/pgsql-general


В списке pgsql-general по дате отправления:

Предыдущее
От: Andrew Sullivan
Дата:
Сообщение: Re: disable triggers using psql
Следующее
От: Vick Khera
Дата:
Сообщение: Re: finding bogus UTF-8