hi everybody .. first post ... hope someone answers it ...
Well .. this is my problem ... I got 2 tables:
The tables are created with no probs.
I created some default data in table tipo_empleado, but when i try to fill the data in the second table with the _correct_ (unless 1 != 1 or 2 != 2) data, next error appears: (it's in spanish, i'll try my best to replicate it in english)
I really don't understand what's going on ... Thougth it maybe could be powerdesigner, but it isn't ... All other foreign keys are working perfectly .. except this one ... i don't know, seems to me that everything is correct... must be something stupid, but i don't get it ... Thanks in advance
Well .. this is my problem ... I got 2 tables:
Code:
/*==============================================================*/ /* Table: TIPO_EMPLEADO */ /*==============================================================*/ CREATE TABLE tipo_empleado ( id_tipo_usuario serial NOT NULL, nombre_tipo_usuario varchar(100) NOT NULL, CONSTRAINT pk_tipo_empleado PRIMARY KEY (id_tipo_usuario) ); comment on table TIPO_EMPLEADO is 'Listado de todos los tipos de empleados que hay'; /*==============================================================*/ /* Table: EMPLEADOS */ /*==============================================================*/ CREATE TABLE empleados ( rut char(10), id_tipo_usuario char(10), nombre_usuario varchar(20), "password" varchar(20), CONSTRAINT fk_empleado_reference_socios FOREIGN KEY (rut) REFERENCES socios (rut) ON UPDATE RESTRICT ON DELETE RESTRICT, CONSTRAINT referencia_tipo_empleado FOREIGN KEY (id_tipo_usuario) REFERENCES tipo_empleado (id_tipo_usuario) ON UPDATE RESTRICT ON DELETE RESTRICT ) ; comment on table EMPLEADOS is 'La lista de empleados';
I created some default data in table tipo_empleado, but when i try to fill the data in the second table with the _correct_ (unless 1 != 1 or 2 != 2) data, next error appears: (it's in spanish, i'll try my best to replicate it in english)
Code:
an error has occured: ERROR: referencia_tipo_empleado has violated the referencial integrity - reference to the key from empleados is not found in tipo_empleado