pg.ddx.io  pgsql-sql@postgresql.org mailing list archive  
help / color / mirror / Atom feed
From: BenLaKnet <benlaknet@icqmail.com>
To: pgsql-sql@postgresql.org
Subject: [pg-sql] - Problem with duplicate table (PostgreSQL 7.2.3
Date: Fri, 08 Aug 2003 10:13:59 +0200
Message-ID: <3F335BC7.7070800@icqmail.com> (raw)

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.







view thread (8+ messages)  latest in thread

Message-ID: <3F335BC7.7070800@icqmail.com>
Permalink:  ../3F335BC7.7070800@icqmail.com/
Also on:    postgresql.org/message-id/3F335BC7.7070800@icqmail.com

 · 

reply

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Reply to all the recipients using the --to and --cc options:
  reply via email

  To: pgsql-sql@postgresql.org
  Cc: benlaknet@icqmail.com
  Subject: Re: [pg-sql] - Problem with duplicate table (PostgreSQL 7.2.3
  In-Reply-To: <3F335BC7.7070800@icqmail.com>

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

This inbox is served by DDX for PostgreSQL; see mirroring instructions
for how to clone and mirror all data and code used for this inbox