From: | BenLaKnet <benlaknet(at)icqmail(dot)com> |
---|---|
To: | pgsql-sql(at)postgresql(dot)org |
Subject: | [pg-sql] - Problem with duplicate table (PostgreSQL 7.2.3 |
Date: | 2003-08-08 08:13:59 |
Message-ID: | 3F335BC7.7070800@icqmail.com |
Views: | Raw Message | Whole Thread | Download mbox | Resend email |
Thread: | |
Lists: | pgsql-sql |
I have to duplicate a table to save different instances of datas.
Structure de la table "spectacle"
-------------------------------------------------------- */
CREATE TABLE "spectacle" (
id_spectacle SERIAL,
"id_membre_adherent" INTEGER NOT NULL,
"id_genre_festival" INTEGER,
"id_festival" INTEGER,
"nom" VARCHAR(255),
"compagnie_interprete" VARCHAR(255),
"vitaculture" INTEGER NOT NULL,
"regionales" INTEGER NOT NULL,
"presentation" TEXT,
"genre_precision" VARCHAR(255),
"duree" VARCHAR(255),
"photo1" VARCHAR(255),
"photo1_credit" VARCHAR(255),
"photo2" VARCHAR(255),
"photo2_credit" VARCHAR(255),
"salle" TEXT,
"tarifs" TEXT,
"id_traitement" INTEGER DEFAULT 1,
"distribution" TEXT,
"type_public" VARCHAR(255),
PRIMARY KEY("id_spectacle"),
FOREIGN KEY ("id_festival") REFERENCES "festival"("id_festival")
ON DELETE RESTRICT
ON UPDATE RESTRICT
NOT DEFERRABLE,
FOREIGN KEY ("id_genre_festival") REFERENCES
"genre_festival"("id_genre_festival")
ON DELETE RESTRICT
ON UPDATE RESTRICT
NOT DEFERRABLE,
FOREIGN KEY ("id_membre_adherent") REFERENCES
"membre_adherent"("id_membre_adherent")
ON DELETE CASCADE
ON UPDATE RESTRICT
NOT DEFERRABLE,
FOREIGN KEY ("id_traitement") REFERENCES "traitement"("id_traitement")
ON DELETE RESTRICT
ON UPDATE RESTRICT
NOT DEFERRABLE
) WITH OIDS;
CREATE INDEX "adherant_spectacle_fk" ON "spectacle"
USING btree ("id_membre_adherent");
CREATE INDEX "genre_spectacle_fk" ON "spectacle"
USING btree ("id_genre_festival");
CREATE INDEX "spectacle_au_festival_fk" ON "spectacle"
USING btree ("id_festival");
When I duplicate this code in an other table named spectacle_v without
Foreygn key ... all is running.
But when I try to delete a spectacle_membre, linked value in spectacle
are correctly deleted, but I have an error for spectacle_v which is not
linked :
(ERROR: referential integrity violation - key in membre_adherent still
referenced from spectacle_v )
I do not understand this message error, because any foreign key is
referenced with this table.
From | Date | Subject | |
---|---|---|---|
Next Message | krystoffff | 2003-08-08 14:13:28 | Error message with a SQL function |
Previous Message | Scott Cain | 2003-08-07 21:15:51 | Re: EXTERNAL storage and substring on long strings |