Re: Foreign Key Columns And Indices

From: "Roderick A(dot) Anderson" <raanders(at)tincan(dot)org>
To: Christopher Kings-Lynne <chriskl(at)familyhealth(dot)com(dot)au>
Cc: Hackers <pgsql-hackers(at)postgresql(dot)org>
Subject: Re: Foreign Key Columns And Indices
Date: 2001-02-05 03:22:37
Message-ID: Pine.LNX.4.10.10102041912350.19984-100000@tincan.org
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-hackers

On Mon, 5 Feb 2001, Christopher Kings-Lynne wrote:

> Just a quick question, when a column of a table is defined to be a foreign
> key, is it implicitly indexed, or does one still need to explicitly CREATE
> INDEX?

I don't think you can actually declare the column in the table as a
foreign key. A foreign key is a column or columns in another table. For
a single column in the other table I'm pretty sure that column must be
'not null' and 'unique'. An index - other than to inforce uniqueness
(currently how it's done in PostgreSQL?) - has nothing to do with the
foreign key.
Being a mere mortal - not a demi-god of PostgreSQLness - this could be
an over simplification or totally out to lunch.

Rod
--

In response to

Browse pgsql-hackers by date

  From Date Subject
Next Message Philip Warner 2001-02-05 03:31:33 Re: Foreign Key Columns And Indices
Previous Message Christopher Kings-Lynne 2001-02-05 03:14:51 Comparison operators for bytea