I have created the following tables.
First Table -
CREATE TABLE process
(
process_name varchar(60) NOT NULL,
fluid_id serial NOT NULL,
fluid varchar(30) NOT NULL,
ip_op_reactor varchar(3),
source varchar(30),
destination varchar(30),
CONSTRAINT process_pk PRIMARY KEY (fluid_id)
);
---------
Second Table -
CREATE TABLE specification
(
fluid_id int4 NOT NULL,
line_vessel_ident varchar(30),
CONSTRAINT specification_pk PRIMARY KEY (fluid_id),
CONSTRAINT specification_fluid_id_fk FOREIGN KEY (fluid_id) REFERENCES process (fluid_id)
);
On data entry I want the serial number generated in process.fluid_id to be transferred to column specification.fluid_id.
A simple insert/select command will transfer the serial number but entering a second row then employing an insert/select command violates the p_k unique rule.
What do I need to do?
Bob