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
NOTNULL, "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.