[SQL/Postgresql] une erreur dans mon script???

une erreur dans mon script??? [SQL/Postgresql] - SQL/NoSQL - Programmation

Marsh Posté le 13-05-2002 à 09:57:54    

salut tou le monde!  
voilà, chuis en train de créer une BDR, mais j'ai une erreur lors de la création des tables, et je vois pas pourquoi!! le message d'erreur n'étant pas très explicite, je demande votre aide (siouplait  :cry: )!
voilà mon script :
my $fill2 = $conn->exec("CREATE TABLE species (id_spec integer PRIMARY KEY, name text NOT NULL)" );
die $conn->errorMessage unless PGRES_COMMAND_OK eq $fill2->resultStatus;
my $fill4 = $conn->exec("CREATE TABLE protein (crc text, id_spec integer REFERENCES species MATCH FULL ON UPDATE cascade, gi_ref integer NOT NULL, source_ref text NOT NULL, def text NOT NULL, length integer NOT NULL, seq text NOT NULL, CONSTRAINT prot_pk PRIMARY KEY (crc, id_spec))" );
my $fill5 = $conn->exec("CREATE TABLE alias_prot (gi integer, source text, crc text NOT NULL REFERENCES protein MATCH FULL ON UPDATE cascade, id_spec integer NOT NULL REFERENCES species MATCH FULL ON UPDATE cascade, CONSTRAINT alias_prot_pk PRIMARY KEY (gi, source))" );
die $conn->errorMessage unless PGRES_COMMAND_OK eq $fill5->resultStatus;
 
le message d'erreur est :  
NOTICE:  CREATE TABLE/PRIMARY KEY will create implicit index 'alias_prot_pk' for table 'alias_prot'
NOTICE:  CREATE TABLE will create implicit trigger(s) for FOREIGN KEY check(s)
NOTICE:  Illegal FOREIGN KEY definition REFERENCES "protein"
ERROR:  number of key attributes in referenced table must be equal to foreign key
 
si vous avez une idée, chuis preneur!!
merci! :jap:

Reply

Marsh Posté le 13-05-2002 à 09:57:54   

Reply

Marsh Posté le 13-05-2002 à 11:07:24    

ayant respécifié les colonnes de référence (references nomtable (colonne), il me sort l'erreur suivante :
 
ERROR:  UNIQUE constraint matching given keys for referenced table "protein" not found
 
voilà, si vous avez une idée .....

Reply

Sujets relatifs:

Leave a Replay

Make sure you enter the(*)required information where indicate.HTML code is not allowed