Re: [HACKERS] Another RI question - Mailing list pgsql-hackers

From Andreas Zeugswetter
Subject Re: [HACKERS] Another RI question
Date
Msg-id 37E9F0E6.A88EFB66@telecom.at
Whole thread Raw
Responses Re: [HACKERS] Another RI question
List pgsql-hackers
>     Is it ALLWAYS the case, that a FK constraint refers to the PK
>     of  another  table?  Or could arbitraty attributes of another
>     table be referenced by a FK too?

arbitrary (usually unique indexed) columns

>     Is it guaranteed that I find the PK  definition  of  a  table
>     allways in the index <tablename>_pkey?

No. I think there is a column in pg_index that marks a pk already.
(for odbc) This would imho be the best way.

>     Another (my preferred) way would be to name the automatically
>     created  PK  index  something like "pg_pkey_<tableoid>". This

You want to have the ability to:
1. create table
2. create unique index
3. alter table add constraint primary key (uses existing index)

The automatic naming should be irrelevant. 

Andreas


pgsql-hackers by date:

Previous
From: Jose Antonio Cotelo lema
Date:
Subject: Problems when opening large objects in the server side.
Next
From: "Hiroshi Inoue"
Date:
Subject: RE: [HACKERS] IPC on win32 - additions for 6.5.2 and current trees