From: | Geoffrey Myers <lists(at)serioustechnology(dot)com> |
---|---|
To: | Greg Sabino Mullane <greg(at)turnstep(dot)com> |
Cc: | pgsql-general(at)postgresql(dot)org |
Subject: | Re: disable triggers using psql |
Date: | 2011-02-18 00:55:50 |
Message-ID: | 4D5DC396.30305@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
>
>
>> 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
--
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
From | Date | Subject | |
---|---|---|---|
Next Message | Greg Sabino Mullane | 2011-02-18 02:56:22 | Re: disable triggers using psql |
Previous Message | Geoffrey Myers | 2011-02-18 00:53:16 | Re: disable triggers using psql |