Composite Keys - Mailing list pgsql-general

From Bruce Elrick
Subject Composite Keys
Date
Msg-id 382CC87B.E336E1DF@home.com
Whole thread Raw
List 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@home.com                          IBM Certified Specialist
Business: belrick@saltus.ab.ca          ADSM, AIX Support, RS/6000 SP, HACMP

pgsql-general by date:

Previous
From: Marcin Inkielman
Date:
Subject: Re: [GENERAL] Postgres concurrency : urgent
Next
From: Bruce Elrick
Date:
Subject: Re: Composite Keys