Tables Referencing themselves As Foreign Keys

From: "Tony (Unihost)" <tony(at)unihost(dot)net>
To: pgsql-general(at)postgresql(dot)org
Subject: Tables Referencing themselves As Foreign Keys
Date: 2003-12-22 10:57:43
Message-ID: 3FE6CE27.5080102@unihost.net
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-general

Hi,

I'm still new to this so if I'm sounding dumb or my premise is flawed
please forgive me. I have a DB design which contains a table which has
categories, each category has a parent category, and is recursed until
the top category is reached, in order to create breadcrumbs. Is there
any problem with using foreign keys to reference the same table? So a
when category is added the CatParent MUST be present as a CatID

CatID - Serial
CatParent - int4 - References CatID
CatName - Text

Am I likeley to come unstuck with this?

Cheers

T.

Responses

Browse pgsql-general by date

  From Date Subject
Next Message Oleg Bartunov 2003-12-22 11:05:59 Re: questions about tsearch2 (for czech language)
Previous Message Richard Huxton 2003-12-22 10:50:17 Re: Groff and Weinberg SQL Complete Reference - Sample database?