Re: FKs + partial indexes? - Mailing list pgsql-hackers

From David Fetter
Subject Re: FKs + partial indexes?
Date
Msg-id 20061123180506.GA1769@fetter.org
Whole thread Raw
In response to FKs + partial indexes?  (Andrew Dunstan <andrew@dunslane.net>)
Responses Re: FKs + partial indexes?  (Jim Nasby <decibel@decibel.org>)
List pgsql-hackers
On Wed, Nov 22, 2006 at 01:33:21PM -0500, Andrew Dunstan wrote:
> 
> I was thinking a bit about a problem that was mentioned in the 
> discussion TomD, Simon Rigga and I had about enums and foreign keys, 
> namely that often we find dozens of tiny little reference tables 
> littering the data model,

Is this really a problem?

> or else we find a table that somehow consolidates them, plus some
> sort of homegrown referential integrity checks.

That is the standard EAV mistake, born of fear of committing to do
some things and not to do others.

> I wondered if we could improve on that situation by using partial
> unique indexes on the consolidated table, and providing a mechanism
> to specify which index the FK must refer to (or else allow allow an
> optional predicate expression which would have to match the
> predicate expression of the partial index).

Isn't this just putting some lipstick on the EAV pig?

Cheers,
D
-- 
David Fetter <david@fetter.org> http://fetter.org/
phone: +1 415 235 3778        AIM: dfetter666                             Skype: davidfetter

Remember to vote!


pgsql-hackers by date:

Previous
From: Markus Schiltknecht
Date:
Subject: Re: [Replica-hooks-discuss] Integrating Replication ino
Next
From: Neil Conway
Date:
Subject: Re: 8.2 open items list