Re: disable triggers using psql - Mailing list pgsql-general

From Geoffrey Myers
Subject Re: disable triggers using psql
Date
Msg-id 4D5DC2FC.20708@serioustechnology.com
Whole thread Raw
In response to Re: disable triggers using psql  ("Greg Sabino Mullane" <greg@turnstep.com>)
List pgsql-general
Greg Sabino Mullane wrote:
> -----BEGIN PGP SIGNED MESSAGE-----
> Hash: RIPEMD160
>
>
>> 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"
>
> Hmm..are we running a modern Postgres?

8.3.13

> Perhaps see if the following
> script works with a single error:
>
> BEGIN;
>
> CREATE TEMP TABLE abc (a INT PRIMARY KEY);
>
> CREATE TEMP TABLE def (b INT NOT NULL REFERENCES abc(a));
>
> SELECT 'Error:';
>
> INSERT INTO def(b) VALUES (1);
>
> SET session_replication_role = replica;
>
> SELECT 'No error:';
>
> INSERT INTO def(b) VALUES (2);
>
> SELECT * FROM def;
>
> ROLLBACK;

I get this:

BEGIN
psql:test.sql:3: NOTICE:  CREATE TABLE / PRIMARY KEY will create
implicit index "abc_pkey" for table "abc"
CREATE TABLE
CREATE TABLE
  ?column?
----------
  Error:
(1 row)

psql:test.sql:9: ERROR:  insert or update on table "def" violates
foreign key constraint "def_b_fkey"
DETAIL:  Key (b)=(1) is not present in table "abc".
psql:test.sql:11: ERROR:  current transaction is aborted, commands
ignored until end of transaction block
psql:test.sql:13: ERROR:  current transaction is aborted, commands
ignored until end of transaction block
psql:test.sql:15: ERROR:  current transaction is aborted, commands
ignored until end of transaction block
psql:test.sql:17: ERROR:  current transaction is aborted, commands
ignored until end of transaction block
ROLLBACK

>
>
> - --
> Greg Sabino Mullane greg@turnstep.com
> End Point Corporation http://www.endpoint.com/
> PGP Key: 0x14964AC8 201102171745
> http://biglumber.com/x/web?pk=2529DF6AB8F79407E94445B4BC9B906714964AC8
> -----BEGIN PGP SIGNATURE-----
>
> iEYEAREDAAYFAk1dpvQACgkQvJuQZxSWSsjvrgCgmiITSLnGyrBunVZTScc4HKvz
> Y3IAn1sYG4/BdM6XJpBAVMz6lU1WfUVH
> =XZcQ
> -----END PGP SIGNATURE-----
>
>
>


--
Geoffrey Myers
Myers Consulting Inc.
770.592.1651

pgsql-general by date:

Previous
From: John R Pierce
Date:
Subject: Re: PostgresPlus Windows Installation Error
Next
From: Geoffrey Myers
Date:
Subject: Re: disable triggers using psql