Re: [HACKERS] Another RI question

From: Andreas Zeugswetter <andreas(dot)zeugswetter(at)telecom(dot)at>
To: hackers(at)postgresql(dot)org
Subject: Re: [HACKERS] Another RI question
Date: 1999-09-23 09:20:38
Message-ID: 37E9F0E6.A88EFB66@telecom.at
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: 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

Responses

Browse pgsql-hackers by date

  From Date Subject
Next Message Hiroshi Inoue 1999-09-23 10:21:55 RE: [HACKERS] IPC on win32 - additions for 6.5.2 and current trees
Previous Message Jose Antonio Cotelo lema 1999-09-23 09:13:02 Problems when opening large objects in the server side.