problem with transaction

From: "Guillermo Trutner" <gtrutner(at)siu(dot)edu(dot)ar>
To: <pgsql-general(at)postgresql(dot)org>
Subject: problem with transaction
Date: 2002-10-18 19:49:17
Message-ID: 00c301c276df$73524030$973c53a8@antarest08pf
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-general

I have two tables as follow:

-- Table: d_coning
CREATE TABLE "d_coning" (

"anio" int4 NOT NULL,

"codigo_con" int4 NOT NULL,

CONSTRAINT "d_coning_pkey" PRIMARY KEY ("anio", "codigo_con")

) WITH OIDS;

-- Table: d_recaud

CREATE TABLE "d_recaud" (

"anio" int4 NOT NULL,

"codigo_con" int4 NOT NULL,

CONSTRAINT "d_recaud_pkey" PRIMARY KEY ("anio"),

CONSTRAINT "<unnamed>" FOREIGN KEY ("anio", "codigo_con") REFERENCES "d_coning" ("anio", "codigo_con") ON DELETE NO ACTION ON UPDATE NO ACTION NOT DEFERRABLE INITIALLY IMMEDIATE

) WITH OIDS;

When I put the follow into a transaction:

-- Primero borro las tablas correspondientes a año

DELETE FROM d_recaud WHERE anio = 2000;

DELETE FROM d_coning WHERE anio = 2000;

-- Ahora las inserto nuevamente

INSERT INTO d_coning (anio, codigo_con)

SELECT anio, codigo_con

FROM d_coning_pipe

WHERE anio = 2000

;

INSERT INTO d_recaud (anio, codigo_con)

SELECT anio, codigo_con

FROM d_recaud_pipe

WHERE anio = 2000 ;

I get the following error:

An error has ocurred in pgAdmin II:frmSQLInput.cmdExecute_Click:

Number: -2147467259
Description: Error while executing query;
ERROR: <unnamed> referential integrity violation - key in d_coning still referenced from d_recaud

If someone has got this error, please tell me the solution.
Thanks.
Guillermo.

-o-~-o-*-o-~-o-*-o-~-o-
Lic. Guillermo Trutner
-o-~-o-*-o-~-o-*-o-~-o-

Responses

Browse pgsql-general by date

  From Date Subject
Next Message Stephan Szabo 2002-10-18 20:04:05 Re: problem with transaction
Previous Message Andrei Ivanov 2002-10-18 19:29:13 creating a new type in C