Recursive FOREIGN KEY?

From: "Joe Stump" <joe(at)joestump(dot)net>
To: <pgsql-general(at)postgresql(dot)org>
Subject: Recursive FOREIGN KEY?
Date: 2004-04-04 00:46:37
Message-ID: 002a01c419de$49e78400$9601a8c0@jstump
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-general

I have a table that will have a parent/child relationship (specifically
a recursive collection of categories) and was wondering if I can
reference a key in the same table ...

CREATE TABLE categories (
categoryID integer PRIMARY KEY,
parentID integer REFERENCES categories (categoryID) ON DELETE CASCADE,

...
);

Is this supported? Any comments from people out there who have created
such setups? I'm new to PGSQL and looking hard at converting from MySQL
so all of these fun features are new to me :)

Thanks!

--Joe

--
Joe Stump, President
JCS Solutions
http://www.jcssolutions.com
(734) 786 0176

Responses

Browse pgsql-general by date

  From Date Subject
Next Message Joe Stump 2004-04-04 02:31:15 Re: Recursive FOREIGN KEY?
Previous Message wespvp 2004-04-03 21:40:01 thread_test.c problems