Re: [HACKERS] Adding PRIMARY KEY info - Mailing list pgsql-hackers

From darcy@druid.net (D'Arcy J.M. Cain)
Subject Re: [HACKERS] Adding PRIMARY KEY info
Date
Msg-id m0zEaoV-00006JC@druid.net
Whole thread Raw
In response to Re: [HACKERS] Adding PRIMARY KEY info  (Vadim Mikheev <vadim@krs.ru>)
List pgsql-hackers
Thus spake Vadim Mikheev
> Imho, indices should be used/created for FOREIGN keys and so pg_index
> is good place for both PRIMARY and FOREIGN keys infos.

Are you sure?  I don't know about implementing it but it seems more
like an attribute thing rather than an index thing.  Certainly from a
database design viewpoint you want to refer to the fields, not the
index on them.  If you put it into the index then you have to do
an extra join to get the information.

Perhaps you have to do the extra join anyway for other purposes so it
may not matter.  All I want is to be able to be able to extract the
field that the designer specified as the key.  As long as I can design
a select statement that gives me that I don't much care how it is
implemented.  I'll cache the information anyway so it won't have a
huge impact on my programs.

--
D'Arcy J.M. Cain <darcy@{druid|vex}.net>   |  Democracy is three wolves
http://www.druid.net/darcy/                |  and a sheep voting on
+1 416 424 2871     (DoD#0082)    (eNTP)   |  what's for dinner.

pgsql-hackers by date:

Previous
From: David Hartwig
Date:
Subject: Re: [HACKERS] index fix report
Next
From: "Thomas G. Lockhart"
Date:
Subject: Re: [HACKERS] index fix report