Skip site navigation (1) Skip section navigation (2)

Re: FKs + partial indexes?

From: David Fetter <david(at)fetter(dot)org>
To: Andrew Dunstan <andrew(at)dunslane(dot)net>
Cc: PostgreSQL-development <pgsql-hackers(at)postgresql(dot)org>
Subject: Re: FKs + partial indexes?
Date: 2006-11-23 18:05:06
Message-ID: 20061123180506.GA1769@fetter.org (view raw or flat)
Thread:
Lists: 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(at)fetter(dot)org> http://fetter.org/
phone: +1 415 235 3778        AIM: dfetter666
                              Skype: davidfetter

Remember to vote!

In response to

Responses

pgsql-hackers by date

Next:From: Greg SmithDate: 2006-11-23 18:09:54
Subject: Re: Direct I/O issues
Previous:From: Markus SchiltknechtDate: 2006-11-23 17:26:12
Subject: Re: [Replica-hooks-discuss] Integrating Replication ino

Privacy Policy | About PostgreSQL
Copyright © 1996-2014 The PostgreSQL Global Development Group