Under vs inheritance - Mailing list pgsql-hackers

From Babak Badaei
Subject Under vs inheritance
Date
Msg-id 001901c35d40$6e14c190$6501a8c0@DDP7NX01
Whole thread Raw
List pgsql-hackers
<div class="Section1"><p class="MsoNormal"><font face="Arial" size="2"><span style="font-size:10.0pt;
font-family:Arial">I am currently reading up on the history behind inheritance in <span class="SpellE">postgres</span>
andfound this interesting post back in May 2000.</span></font><p class="MsoNormal"><font face="Arial" size="2"><span
style="font-size:10.0pt;
font-family:Arial"> </span></font><p class="MsoNormal"><font face="Arial" size="2"><span style="font-size:10.0pt;
font-family:Arial"><a
href="http://archives.postgresql.org/pgsql-hackers/2000-05/msg01349.php">http://archives.postgresql.org/pgsql-hackers/2000-05/msg01349.php</a></span></font><p
class="MsoNormal"><fontface="Arial" size="2"><span style="font-size:10.0pt; 
font-family:Arial"> </span></font><p class="MsoNormal"><font face="Arial" size="2"><span style="font-size:10.0pt;
font-family:Arial"> </span></font><p class="MsoNormal"><font face="Arial" size="2"><span style="font-size:10.0pt;
font-family:Arial"> </span></font><p class="MsoNormal"><font face="Arial" size="2"><span style="font-size:10.0pt;
font-family:Arial"> </span></font><p class="MsoNormal"><font face="Arial" size="2"><span style="font-size:10.0pt;
font-family:Arial">From reading other posts, it seems that there is the idea that since under is single inheritance
thentables “under” another are all really in that same relation only they act the as expected to the user.<span
style="mso-spacerun:yes"> </span>It seems that this would allow backwards compatibility with current <span
class="SpellE">postgres</span>databases that use inheritance and offers a simplified single relation inheritance that
wouldfix problems with primary keys (references don’t see id’s created via a child <span class="SpellE">table<span
class="GramE">,etc</span></span>),constraints, triggers, etc. </span></font><p class="MsoNormal"><font face="Arial"
size="2"><spanstyle="font-size:10.0pt; 
font-family:Arial"> </span></font><p class="MsoNormal"><font face="Arial" size="2"><span style="font-size:10.0pt;
font-family:Arial"><a
href="http://archives.postgresql.org/pgsql-hackers/2002-08/msg01103.php">http://archives.postgresql.org/pgsql-hackers/2002-08/msg01103.php</a></span></font><p
class="MsoNormal"><fontface="Arial" size="2"><span style="font-size:10.0pt; 
font-family:Arial"> </span></font><p class="MsoNormal"><font face="Arial" size="2"><span style="font-size:10.0pt;
font-family:Arial"><a
href="http://archives.postgresql.org/pgsql-hackers/2002-09/msg01207.php">http://archives.postgresql.org/pgsql-hackers/2002-09/msg01207.php</a></span></font><p
class="MsoNormal"><fontface="Arial" size="2"><span style="font-size:10.0pt; 
font-family:Arial"> </span></font><p class="MsoNormal"><font face="Arial" size="2"><span style="font-size:10.0pt;
font-family:Arial">Since the old inheritance stuff would be the same as now (does not inherit primary key, etc.) it
wouldaddress other concerns as well:</span></font><p class="MsoNormal"><font face="Arial" size="2"><span
style="font-size:10.0pt;
font-family:Arial"> </span></font><p class="MsoNormal"><font face="Arial" size="2"><span style="font-size:10.0pt;
font-family:Arial"><a
href="http://archives.postgresql.org/pgsql-hackers/2002-08/msg01099.php">http://archives.postgresql.org/pgsql-hackers/2002-08/msg01099.php</a></span></font><p
class="MsoNormal"><fontface="Arial" size="2"><span style="font-size:10.0pt; 
font-family:Arial"> </span></font><p class="MsoNormal"><font face="Arial" size="2"><span style="font-size:10.0pt;
font-family:Arial"> </span></font><p class="MsoNormal"><font face="Arial" size="2"><span style="font-size:10.0pt;
font-family:Arial">From a point of view, inheritance is not broken it just works a different way; it does not violate
constraintsbecause the “only” clause shows that the value is not really in that table.<span style="mso-spacerun:yes"> 
</span>With“under”, the only clause, if it exists at all, could just basically filter for entries not added to columns
fromany “tables” added via under and show only the value directly inserted into the parent columns.<span
style="mso-spacerun:yes"> </span>Tables under another are physically one <span class="GramE">relation,</span> tables
inheritingfrom one another are physically different relations.</span></font><p class="MsoNormal"><font face="Arial"
size="2"><spanstyle="font-size:10.0pt; 
font-family:Arial"> </span></font><p class="MsoNormal"><font face="Arial" size="2"><span style="font-size:10.0pt;
font-family:Arial">Besides, “under” would be a new feature!</span></font><p class="MsoNormal"><font face="Arial"
size="2"><spanstyle="font-size:10.0pt; 
font-family:Arial"> </span></font><p class="MsoNormal"><span class="GramE"><font face="Arial" size="2"><span
style="font-size:10.0pt;font-family:Arial">Babak.</span></font></span><fontface="Arial" size="2"><span
style="font-size:10.0pt;font-family:Arial"></span></font></div>

pgsql-hackers by date:

Previous
From: Josh Berkus
Date:
Subject: Re: TODO items
Next
From: Rod Taylor
Date:
Subject: History