Ver Mensaje Individual
  #1 (permalink)  
Antiguo 23/05/2012, 08:34
jmgs04
 
Fecha de Ingreso: agosto-2011
Mensajes: 4
Antigüedad: 12 años, 8 meses
Puntos: 0
Exclamación clave foranea serial

Buen dia!! tengo en mi base de datos postgresql las tablas:

CREATE TABLE requerimiento
(
nombre character varying NOT NULL,
cod_req serial NOT NULL,
CONSTRAINT requerimiento_pkey PRIMARY KEY (cod_req)
)
WITH (
OIDS=FALSE
);
ALTER TABLE requerimiento OWNER TO postgres;
//------------------------------------------------------------------------------------------------
CREATE TABLE tipo_req
(
cod_tipo integer NOT NULL,
nomb_tipo character varying(100),
cod_req integer,
CONSTRAINT tipo_req_pkey PRIMARY KEY (cod_tipo),
CONSTRAINT tipo_req_cod_req_fkey FOREIGN KEY (cod_req)
REFERENCES requerimiento (cod_req) MATCH SIMPLE
ON UPDATE CASCADE ON DELETE CASCADE
)
WITH (
OIDS=FALSE
);
ALTER TABLE tipo_req OWNER TO postgres;
la duda que tengo es al momento de insertar datos en la tablas tipo_req especificamente la clave foranea cod_req; al ser de tipo serial no veo la forma de acceder a ella para conocer su valor o si existe alguna forma de herencia o algo para insertar.....
please alguien me ayuda???