Linking - Mailing list pgsql-general

From Bob Pawley
Subject Linking
Date
Msg-id 01be01c5df32$b1e87e90$ac1d4318@OWNER
Whole thread Raw
Responses Re: Linking
Re: Linking
List pgsql-general

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

pgsql-general by date:

Previous
From: "Jim C. Nasby"
Date:
Subject: Re: PostgreSQL on 64-bit operating systems
Next
From: Martijn van Oosterhout
Date:
Subject: Re: PostgreSQL, Mac OS X and locales