Question about inheritance

From: "Christopher Kings-Lynne" <chriskl(at)familyhealth(dot)com(dot)au>
To: "Hackers" <pgsql-hackers(at)postgresql(dot)org>
Subject: Question about inheritance
Date: 2001-06-05 01:42:38
Message-ID: ECEHIKNFIMMECLEBJFIGEENPCAAA.chriskl@familyhealth.com.au
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-hackers

Hi guys,

It's relatively straightforward to allow check constraints to be inherited -
but is it really possible to ever do the same with primary, unique or even
foreign constraints?

ie. Say a table has a primary key and I inherit from this table. Since the
primary key is an index on the parent table, I could just create another
index on the child table, on the same column.

However - because we are dealing with two separate indices, it should still
be possible to insert duplicate values into the parent table and the child
table shouldn't it? This means that when a query is run over the parent
table that includes results from the child table then you will get duplicate
results in a supposedly primary index.

Similar arguments seem to apply to unique and foreign constraints. If you
could use aggregate functions in check constraints - you'd have another
problem. And if asserts were ever implemented - same thing...

Am I misunderstanding how the mechanism works, or is this a big, not easily
solved, problem?

Chris

Responses

Browse pgsql-hackers by date

  From Date Subject
Next Message Tom Lane 2001-06-05 01:56:21 Mirrors not tracking main ftp site?
Previous Message Tom Lane 2001-06-04 23:58:26 Re: Curious (mis)behavior of access rights