Re: OOP real life example (was Re: Why is MySQL more - Mailing list pgsql-hackers

From Greg Copeland
Subject Re: OOP real life example (was Re: Why is MySQL more
Date
Msg-id 1029169813.25246.119.camel@mouse.copelandconsulting.net
Whole thread Raw
In response to Re: OOP real life example (was Re: Why is MySQL more  (Oliver Elphick <olly@lfix.co.uk>)
Responses Re: OOP real life example (was Re: Why is MySQL more
Re: OOP real life example (was Re: Why is MySQL more
List pgsql-hackers
On Mon, 2002-08-12 at 10:39, Oliver Elphick wrote:
> On Mon, 2002-08-12 at 15:00, Greg Copeland wrote:
> > How exactly would you create an abstract base class for table type?
>
> CREATE TABLE abstract_base (
>    cols ...,
>    CONSTRAINT "No data allowed in table abstract_base!" CHECK (1 = 0)
> )
>
> This assumes that the constraint is not inherited or can be removed in
> child tables.
>

Why would I assume that constraints would not be inherited?  Seems as a
general rule of thumb, you'd want the constraints to be inherited.  Am I
missing something?

Also, if I remove the constraint on the child table, doesn't that really
mean I'm removing the constraint on the parent table?  That would seem
to violate the whole reason of having constraints.  If a constraint is
placed in an ABC and we find that we later need to remove it for EVERY
derived class, doesn't that imply it shouldn't of been in there to begin
with?  After all, in this case, we're saying that each and every derived
class needs to overload or drop a specific constraint.  That strikes me
as being rather obtuse.

That, in it self, I find rather interesting.  Is there any papers or
books which offers explanation of how constraints should handled for
table inheritance?

Greg


pgsql-hackers by date:

Previous
From: Oliver Elphick
Date:
Subject: Re: [GENERAL] Linux Largefile Support In Postgresql RPMS
Next
From: Andrew Sullivan
Date:
Subject: Re: [GENERAL] Linux Largefile Support In Postgresql RPMS