Composite Keys

From: Bruce Elrick <belrick(at)home(dot)com>
To: pgsql-questions(at)postgresql(dot)org
Subject: Composite Keys
Date: 1999-11-13 02:10:03
Message-ID: 382CC87B.E336E1DF@home.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-general

I couldn't grok this out of the docs. Does PostGreSQL support composite
keys? I am aware of the current lack of foreign key support except through
refint.so and triggers.

In my case, I'd like to have a single address table enforcing a unique
(employeenum, addrtype) instead of a home_address, office_address, and
worksite_address table, each enforcing a unique (employeenum) (which is a
foreign key of the employee table). In reading up on the unique constraint,
it is not obvious (to someone who is not a DBA) whether the uniqueness is
enforced on the combination of fields or on the fields separately.

That is, (empnum, addrtype)'s of the form (A, x), (A, y), (B, x), (C, x), (C,
z) are ok, where you see neither empnum nor addrtype are unique, only the
composition is.

I'm probably stating the obvious but I am unsure...

Bruce
--
Bruce Elrick, Ph.D. Saltus Technology Consulting Group
Personal: belrick(at)home(dot)com IBM Certified Specialist
Business: belrick(at)saltus(dot)ab(dot)ca ADSM, AIX Support, RS/6000 SP, HACMP

Responses

Browse pgsql-general by date

  From Date Subject
Next Message Bruce Elrick 1999-11-13 02:16:40 Re: Composite Keys
Previous Message Herbert Liechti 1999-11-12 15:01:31 troubles with datestyle