Linking

From: Bob Pawley <rjpawley(at)shaw(dot)ca>
To: Postgre General <pgsql-general(at)postgresql(dot)org>
Subject: Linking
Date: 2005-11-01 22:22:07
Message-ID: 01be01c5df32$b1e87e90$ac1d4318@OWNER
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: 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

Responses

Browse pgsql-general by date

  From Date Subject
Next Message Martijn van Oosterhout 2005-11-01 22:24:22 Re: PostgreSQL, Mac OS X and locales
Previous Message Jim C. Nasby 2005-11-01 22:12:33 Re: PostgreSQL on 64-bit operating systems