Re: FKs + partial indexes?

From: Jim Nasby <decibel(at)decibel(dot)org>
To: David Fetter <david(at)fetter(dot)org>
Cc: Andrew Dunstan <andrew(at)dunslane(dot)net>, PostgreSQL-development <pgsql-hackers(at)postgresql(dot)org>
Subject: Re: FKs + partial indexes?
Date: 2006-11-26 22:16:12
Message-ID: FA01C6D9-A54D-47D7-8D88-A7238F929541@decibel.org
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-hackers

On Nov 23, 2006, at 12:05 PM, David Fetter wrote:
> On Wed, Nov 22, 2006 at 01:33:21PM -0500, Andrew Dunstan wrote:
>> 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?

EAV?

If we're going to improve the situation of needing lookup tables, I
think the way to do it would be through enums, or allowing user-
configurable settings on TOAST. The latter would allow you to force
any value written into a text field to get toasted. If you also allow
toast to combine multiple identical values into a single row in the
toast table (it might already do that...), you now have your normal
lookup-table scenario, without having to define an extra table, RI,
etc. (Ok, you'd need a check constraint too for "normal" lookup table
behavior).
--
Jim Nasby jim(at)nasby(dot)net
EnterpriseDB http://enterprisedb.com 512.569.9461 (cell)

In response to

Responses

Browse pgsql-hackers by date

  From Date Subject
Next Message David Fetter 2006-11-26 23:05:51 Re: FKs + partial indexes?
Previous Message Jim Nasby 2006-11-26 22:10:01 Re: XA support (distributed transactions)