Return-Path: pg_adm@postgres.berkeley.edu
Received: by postgres.Berkeley.EDU (5.61/1.29)
	id AA00430; Mon, 3 Aug 92 08:04:45 -0700
Message-Id: <9208031504.AA00430@postgres.Berkeley.EDU>
From: Stuart Pook <stuart@genethon.genethon.fr>
Subject: relational databases and Postgres
To: postgres@postgres.berkeley.edu
Sender: pg_adm@postgres.berkeley.edu
Organization: Genethon, 13 Place de Rungis, 75013 Paris, France
              tel +33 1 45.65.13.00 x395, fax +33 1 45.88.52.20
X-Face: "6o}6kk")qjUnYYq-`3_.vGq;@xj`3>#I/>4>E>DldCv:X#2%Rm+dr9HVN`g'#QgZFgsYsY
 .Q)bH:AoaW(n~=2B4aY?Q?{)1]&J+:LRX,qB>k{=6`K#2tRitzHKmi_9`}Lx0xdI*r!?MVNj7za"pZ
 *_QEm})y`y=vyyy~^0GY"HTvSCnv}eP*?{%zJ<r'BRk[r|J#;Im"Vp]!L
Date: Mon, 03 Aug 92 14:51:42 +0200
From: Stuart Pook <stuart@genethon.genethon.fr>

I have an relational database that I would like to implement in
Postgres, and I have a few problems.  Most of the problems are caused
because some documented features of Postgres are not yet implemented.

1/      I want to have a table (class) with a unique key but the
manual for "create" says "Key is not implemented in Version 4.0".  Do I
have to create my own index and then use a rule to enforce the
uniqueness of the key?

2/      Given the above how can I create a composite key given that the
manual for "define index" says under bugs "Indices may only be defined
on a single key"?

3/      I want to create a foreign key relationship between, say, DEPT
and EMP, ie an EMP can never be in a department that does not exist. I
looked at "The Implementation of Postgres" by Stonebaker et al. and
found that I should be able to do

	create DEPT (dname = char16, floor = int2)
	create EMP (name = char16, dept = DEPT, salary = float)

This is not implemented either :-(.  I suppose that I could try and
write lots of rules: append rules for EMP (to make sure that the DEPT
exists), and delete rules for DEPT (to make sure that there are no
EMP's in this department) plus rules to prohibit the changing of keys
but this seems strange and prone to error.  And it will get very difficult
once I have a dozen tables.

Given that I have read that postgres is "extended relational" database
I imagine that there are solutions to the above problems.  Could
somebody please tell me what they are.  Perhaps I need to think about
the problem in a different way.

Thanks
Stuart Pook
