Re: patch for check constraints using multiple inheritance

From: Yeb Havinga <yebhavinga(at)gmail(dot)com>
To: Robert Haas <robertmhaas(at)gmail(dot)com>
Cc: Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us>, Henk Enting <h(dot)d(dot)enting(at)mgrid(dot)net>, pgsql-hackers(at)postgresql(dot)org
Subject: Re: patch for check constraints using multiple inheritance
Date: 2010-08-03 19:05:58
Message-ID: 4C586896.6040709@gmail.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-hackers

Yeb Havinga wrote:
> The underlying cause is the failure of the code to recognize that if
> relation C inherits from both A and B, where A and B both have column
> x, that A.x 'is the same as' B.x, where the 'is the same as' relation
> is the same that holds for (A.x, C.x) and (B.x, C.x), which the code
> does a lot of trouble for to recognize. This means that if some
> definition is altered on A.x, only C.x is updated and B.x not touched.
> IMO this is wrong and either a multiple inheritance structure like
> this should be prohibited, since the user did not explicitly declare
> that A.x and B.x 'are the same' (by e.g. defining a relation D.x and
> have A and B inherit from that), or the code should update parents of
> relations when the childs are updated.
Thinking about this a bit more, the name 'is the same as' is a bit
confusing, since that relation might not be commutative. C.x 'inherits
properties from' A.x, or C.x 'is defined by' A.x are perhaps better
names, that reflect that the converse might not hold. OTOH, what does
C.x 'inherits (all) properties from' A.x mean? If it means that for all
properties P, P(C.x) iff P(A.x), then C.x = A.x commutatively and by
similar reasoning A.x = B.x.

> ALTER TABLE top1 RENAME COLUMN a_table_column TO another_table_column;
When looking for previous discussions that was referred to upthread, the
first thing I found was this recent thread about the exactly the same
problem http://archives.postgresql.org/pgsql-hackers/2010-01/msg03117.php

Sorry for the double post, however the previous discussion postponed
work to .. now, so maybe there is some value in first trying to specify
exactly what 'inherits' means, and derive consequences for code
behaviour from that.

regards,
Yeb Havinga

In response to

Browse pgsql-hackers by date

  From Date Subject
Next Message Robert Haas 2010-08-03 19:16:00 Re: (9.1) btree_gist support for searching on "not equals"
Previous Message Robert Haas 2010-08-03 18:49:24 Re: [COMMITTERS] pgsql: Add \conninfo command to psql, to show current connection info.