Referencing Serial Type as Foreign Key

From: Rich Shepard <rshepard(at)appl-ecosys(dot)com>
To: pgsql-general(at)postgresql(dot)org
Subject: Referencing Serial Type as Foreign Key
Date: 2005-06-03 17:10:43
Message-ID: Pine.LNX.4.62.0506031006480.21666@salmo.appl-ecosys.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-general

Don't know why I've not come across this before, but I have now.

In a table definition I reference the primary key of another table. That
key is of datatype SERIAL. In the referencing table, do I define the column
as

col_name INTEGER REFERENCES other-table (primary_key_field),

or is the datatype SERIAL because that's what the referenced
primary_key_field is?

Thanks,

Rich

--
Dr. Richard B. Shepard, President
Applied Ecosystem Services, Inc. (TM)
<http://www.appl-ecosys.com> Voice: 503-667-4517 Fax: 503-667-8863

Responses

Browse pgsql-general by date

  From Date Subject
Next Message Gevik babakhani 2005-06-03 17:12:00 Re: PostgreSQL Developer Network
Previous Message Sean Davis 2005-06-03 17:06:39 Re: Test for array slice?