referencing a `serial' column as a foreign key

From: Arcady Genkin <a(dot)genkin(at)utoronto(dot)ca>
To: pgsql-novice(at)postgresql(dot)org
Subject: referencing a `serial' column as a foreign key
Date: 2000-05-22 07:09:59
Message-ID: 87vh07giwo.fsf@tea.thpoon.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-novice

What would be the correct data type for a foreign key column that
references a `serial' column in another table? E.g.:

create table labels ( labelid serial );
create table disks (
diskid serial,
labelid int4 references labels ( labelid ) );

The above works (serial is a 4-byte numerical type in 7.0), but I'm
concerned if this is the right way to do it... What if implementation
of `serial' type changes in future releases?

Thanks,
--
Arcady Genkin http://www.thpoon.com
Nostalgia isn't what it used to be.

Browse pgsql-novice by date

  From Date Subject
Next Message Thomas Tynan 2000-05-22 15:21:41 running Postgresql on Mandrake 7.0
Previous Message D. Duccini 2000-05-20 18:16:22 Re: opening old database