Can a field be a primary key as well as a foreign key? - Mailing list pgsql-general

From Andrew Snow
Subject Can a field be a primary key as well as a foreign key?
Date
Msg-id 20020312154409.B397@esper.modulus.org
Whole thread Raw
Responses Re: Can a field be a primary key as well as a foreign key?  (Jan Wieck <janwieck@yahoo.com>)
List pgsql-general

Can anyone see any problem with the following, practice?


CREATE TABLE parent (
  foo SERIAL PRIMARY KEY
);

CREATE TABLE child (
  foo INTEGER PRIMARY KEY REFERENCES parent ON DELETE CASCADE,
  bar TEXT
);

CREATE TABLE subchild (
  foo INTEGER PRIMARY KEY REFERENCES child ON DELETE CASCADE,
  bar2 TEXT
);


pgsql-general by date:

Previous
From: Tom Lane
Date:
Subject: Re: pg_toast table growth out of control
Next
From: Francisco Reyes
Date:
Subject: Re: spanish characters in postgresql