Well .. this is my problem ... I got 2 tables:
Expand|Select|Wrap|Line Numbers
- /*==============================================================*/
- /* 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)
Expand|Select|Wrap|Line Numbers
- 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