Re: Foreign Key Columns And Indices

Поиск
Список
Период
Сортировка
От Philip Warner
Тема Re: Foreign Key Columns And Indices
Дата
Msg-id 3.0.5.32.20010205143133.021ed6d0@mail.rhyme.com.au
обсуждение исходный текст
Ответ на Foreign Key Columns And Indices  ("Christopher Kings-Lynne" <chriskl@familyhealth.com.au>)
Ответы Re: Foreign Key Columns And Indices  (Stephan Szabo <sszabo@megazone23.bigpanda.com>)
Список pgsql-hackers
At 11:01 5/02/01 +0800, 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?

The referenced columns must be either a PK or the set of columns in a
Unique constraint. As a result, then will have indexes. Not sure about the
referencing table - are there any NOTICES when you create an FK?

<Aside>

PGSQL implements PK/FK & Unique constraints by using indexes (and rules) at
the moment. There is no guarantee that this will always be the case - in
fact, one path to rationalizing the constraints system is to implement most
features as SQL CHECK constraints: 

PK: Check( (Select Count(*) from Table Where PKCOLS=PKCOLS) = 1) 
FK: Check( (Select Count(*) from PK_Table Where PKCOLS=FKCOLS) = 1)

etc.

This is something I would like to see discussed for 7.2.

</Aside>

----------------------------------------------------------------
Philip Warner                    |     __---_____
Albatross Consulting Pty. Ltd.   |----/       -  \
(A.B.N. 75 008 659 498)          |          /(@)   ______---_
Tel: (+61) 0500 83 82 81         |                 _________  \
Fax: (+61) 0500 83 82 82         |                 ___________ |
Http://www.rhyme.com.au          |                /           \|                                |    --________--
PGP key available upon request,  |  /
and from pgp5.ai.mit.edu:11371   |/


В списке pgsql-hackers по дате отправления:

Предыдущее
От: "Christopher Kings-Lynne"
Дата:
Сообщение: Comparison operators for bytea
Следующее
От: "Roderick A. Anderson"
Дата:
Сообщение: Re: Foreign Key Columns And Indices