Subject: relational databases and Postgres

From: Stuart Pook <[email-masked]>
Date: Mon, 03 Aug 92 14:51:42 +0200

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