Обсуждение: PROBLEM WITH FOREIGN KEY

Поиск
Список
Период
Сортировка

PROBLEM WITH FOREIGN KEY

От
"Mario Alberto Soto Cordones"
Дата:
hi.

i have a big problem...

i have created a 2 table cumacar and cumaasi,

the structure is

CUMACAR

cuidcar   char(2)
cucodcar  numeric(2)
cudescar  varchar(35)
cuempcar  numeric(2)
primary key (cucodcar, cuempcar)


CUMAASI

cucodasi  numeric  3
cudesasi  varchar  60
cucarasi  numeric  2
cuempasi  numeric  2
primary key (cucarasi, cucodasi, cuempasi)

i try create a foreing key and say:

Error - /var/www/html/phpPgAdmin/sql.php -- Line: 112
PostgreSQL ha dicho: ERROR: cumaasi_fk_cumacar referential integrity
violation - key referenced from cumaasi not found in cumacar
Your query:
ALTER TABLE cumaasi
ADD CONSTRAINT cumaasi_fk_cumacar
FOREIGN KEY(cucarasi, cuempasi)
REFERENCES
cumacar (cucodcar, cuempcar)


PLEASE HELP ME

sorry for my englis... i live in chile...

thank you











Re: PROBLEM WITH FOREIGN KEY

От
"Donald Fraser"
Дата:
>> PostgreSQL ha dicho: ERROR: cumaasi_fk_cumacar referential integrity violation - key referenced from cumaasi not found in cumacar
 
The message is telling you that it cannot create the constraint because data in the two tables causes a referential integrity violation.
That is there is data in a record for table CUMAASI for columns cucarasi and cuempasi that cannot be matched to a record for table CUMACAR for columns cucodcar and cuempcar.
 
Regards
Donald Fraser
----- Original Message -----
Sent: Tuesday, March 18, 2003 4:32 PM
Subject: [ADMIN] PROBLEM WITH FOREIGN KEY

hi.

i have a big problem...

i have created a 2 table cumacar and cumaasi,

the structure is

CUMACAR

cuidcar   char(2)
cucodcar  numeric(2)
cudescar  varchar(35)
cuempcar  numeric(2)
primary key (cucodcar, cuempcar)


CUMAASI

cucodasi  numeric  3
cudesasi  varchar  60
cucarasi  numeric  2
cuempasi  numeric  2
primary key (cucarasi, cucodasi, cuempasi)

i try create a foreing key and say:

Error - /var/www/html/phpPgAdmin/sql.php -- Line: 112
PostgreSQL ha dicho: ERROR: cumaasi_fk_cumacar referential integrity
violation - key referenced from cumaasi not found in cumacar
Your query:
ALTER TABLE cumaasi
ADD CONSTRAINT cumaasi_fk_cumacar
FOREIGN KEY(cucarasi, cuempasi)
REFERENCES
cumacar (cucodcar, cuempcar)


PLEASE HELP ME

sorry for my englis... i live in chile...

thank you











---------------------------(end of broadcast)---------------------------
TIP 5: Have you checked our extensive FAQ?

http://www.postgresql.org/docs/faqs/FAQ.html