Re: disable triggers using psql

From: Geoffrey Myers <lists(at)serioustechnology(dot)com>
To: pgsql-general(at)postgresql(dot)org
Subject: Re: disable triggers using psql
Date: 2011-02-17 11:59:37
Message-ID: 4D5D0DA9.5050408@serioustechnology.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-general

Andrew Sullivan wrote:
> On Wed, Feb 16, 2011 at 10:08:53AM -0500, David Johnston wrote:
>> 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.
>
> Unless something very big changed when I wasn't looking, the
> constraints are actually implemented as triggers under the hood. But
> you're right that it'd be cleaner to drop the constraints and re-add
> them than to fool with system triggers.

We were trying to accomplish this without having to hack the dump to
much. We attempted adding:

set local session_replication_role = replica;

But that does not seem provide the expected relief.

We've got 15 databases we need to convert to UTF-8 and we are trying to
get this done the fastest way possible.

>
>> 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.
>
> Yes.
>
> A
>

--
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

In response to

Responses

Browse pgsql-general by date

  From Date Subject
Next Message John DeSoi 2011-02-17 13:04:20 Re: disable triggers using psql
Previous Message prabakaran.a 2011-02-17 10:35:40 database instance creation