Re: Primary key question

From: "Ruediger Maehl" <ruediger(dot)maehl(at)web(dot)de>
To: pgsql-general(at)postgresql(dot)org
Subject: Re: Primary key question
Date: 2000-07-04 05:41:03
Message-ID: newscache$b3s5xf$ldf$1@www
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-general

Hi Richard,

Richard Rowell schrieb in Nachricht
<3bi0ms00iak74c6jm26117unsskokmp0b4(at)4ax(dot)com>...
>I'm creating a database with 20 tables or so. I have come to the
>table that will likely tie many of these tables together, that is
>every single field in this table will be a foriegn key. My question
>is, rather then include all of the fields into the primary key of this
>table, and therefore include all of these fields into any table that
>will reference this one, would it be politically correct to just give
>each entry an integer as a primary key

it is not only politically but also absolutely correct
to use one expression as primary key for table that
is mostly or even only composed of foreign keys to
other tables.

> and scan for dupes in a trigger?

You can create a unique index on a combination of columns
to prevent duplicate entries.

> It sure seems like it would cut down on the complexity of
>the whole thing...

yep

>
>Thanx in advance!

Ruediger

In response to

Browse pgsql-general by date

  From Date Subject
Next Message Philip Warner 2000-07-04 06:11:25 Re: Installing DBD::Pg
Previous Message Sean Carmody 2000-07-04 05:17:59 Installing DBD::Pg