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 21:51:39
Message-ID: 4D5D986B.60204@serioustechnology.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-general

Greg Sabino Mullane wrote:
> -----BEGIN PGP SIGNED MESSAGE-----
> Hash: RIPEMD160
>
>
>>>> set local session_replication_role = replica;
>>>>
>>>> But that does not seem provide the expected relief.
>>> How exactly did this fail? This should absolutely disable all
>>> triggers for you, unless you've mucked with the triggers
>>> and set them to replica.
>
>> I received the following error:
>>
>> ERROR: insert or update on table "customer" violates foreign key
>> constraint "$1"
>
> Try removing the 'local'; you may be spanning multiple transactions.
> If this is a script you are feeding directly to psql, you can
> also add a BEGIN; at the top or just use the -1 argument.

I thought we had tried this before, but with an embedded BEGIN. I get
the same result, although I used the -1 switch instead of the BEGIN/COMMIT:

psql:backup.txt:2077303: ERROR: insert or update on table "customer"
violates foreign key constraint "$1"
DETAIL: Key (country,state)=(US,GA) is not present in table "state".
psql:backup.txt:2077311: ERROR: current transaction is aborted,
commands ignored until end of transaction block
.
.

Just to clarify, I added this to the dump:

set session_replication_role = replica;

and ran the command:

psql -1 -p $TARGETPORT -f $BACKUP -d $DB

>
> - --
> Greg Sabino Mullane greg(at)turnstep(dot)com
> End Point Corporation http://www.endpoint.com/
> PGP Key: 0x14964AC8 201102171551
> http://biglumber.com/x/web?pk=2529DF6AB8F79407E94445B4BC9B906714964AC8
> -----BEGIN PGP SIGNATURE-----
>
> iEYEAREDAAYFAk1diwUACgkQvJuQZxSWSshcPgCdGuHIe4bINl/BmoKW89YmQscD
> IdAAnA8bwbzmMKssCga9G0dpSh1GopzD
> =khQx
> -----END PGP SIGNATURE-----
>
>
>

--
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 Greg Sabino Mullane 2011-02-17 22:53:56 Re: disable triggers using psql
Previous Message Geoffrey Myers 2011-02-17 21:32:30 Re: disable triggers using psql