Re: Foreign keys/unique values and views

From: Martijn van Oosterhout <kleptog(at)svana(dot)org>
To: Jan Wieck <JanWieck(at)Yahoo(dot)com>
Cc: Einar Karttunen <ekarttun(at)cs(dot)Helsinki(dot)FI>, Richard Huxton <dev(at)archonet(dot)com>, pgsql-general(at)postgresql(dot)org
Subject: Re: Foreign keys/unique values and views
Date: 2001-03-23 02:21:15
Message-ID: 20010323132115.B6658@chiru.svana.org
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-general

On Thu, Mar 22, 2001 at 06:33:16PM -0500, Jan Wieck wrote:
> Einar Karttunen wrote:
> How do you put a UNIQUE constraint on the entire inheritance
> hierarchie?

Easy. You make a unique index that covers an entire inheritance hierarchy.
If lots of table inherit a field "id" from a single table the you can put a
unique index on that field. All you need then is an index whose keys
reference not tuple IDs but (table ID, tuple ID) pairs.

Wow. I'm just thinking of how vacuum would deal with this. Probably not very
well. But it would give inheritance hierarchies very efficient lookups
rather than the implicit unioning done currently.

Martijn

In response to

Browse pgsql-general by date

  From Date Subject
Next Message Tom Lane 2001-03-23 02:52:43 Re: Problem migrating dump to latest CVS snapshot.
Previous Message Tom Lane 2001-03-23 02:07:25 Re: [HACKERS] SPI example does not work for 7.1beta4