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
--
Sent via pgsql-general mailing list (pgsql-general@xxxxxxxxxxxxxx)
To make changes to your subscription:
http://www.postgresql.org/mailpref/pgsql-general