Ver Mensaje Individual
  #2 (permalink)  
Antiguo 18/05/2011, 10:47
Avatar de huesos52
huesos52
Colaborador
 
Fecha de Ingreso: febrero-2009
Ubicación: Manizales - Colombia
Mensajes: 5.980
Antigüedad: 15 años, 2 meses
Puntos: 360
Respuesta: Error al insertar datos en una tabla con llave foranea

Estas creando mal la tabla deportivo. Estas haciendo las foreign key contra el campo id_deportivo.

Por la logica que veo, sería así:
Código SQL:
Ver original
  1. CREATE TABLE deportivo
  2. (
  3. id_deportivo INTEGER NOT NULL,
  4. persona_cedula INTEGER NOT NULL,
  5. municipios_id_municipios INTEGER NOT NULL,
  6. resolucion_deportivo CHARACTER(100),
  7. nombre_deportivo CHARACTER(100),
  8. CONSTRAINT deportivo_pkey PRIMARY KEY (id_deportivo),
  9. CONSTRAINT deportivo_id_deportivo_fkey FOREIGN KEY (municipios_id_municipios)
  10. REFERENCES municipios (id_municipios) MATCH SIMPLE
  11. ON UPDATE NO ACTION ON DELETE NO ACTION,
  12. CONSTRAINT deportivo_id_deportivo_fkey1 FOREIGN KEY (persona_cedula)
  13. REFERENCES persona (cedula) MATCH SIMPLE
  14. ON UPDATE NO ACTION ON DELETE NO ACTION
  15. )
  16. WITH (
  17. OIDS=FALSE
  18. );
  19. ALTER TABLE deportivo OWNER TO postgres;
__________________
Without data, You are another person with an opinion.
W. Edwads Deming