Classes, Inheritance, and Children - Mailing list pgsql-sql

From Thomas Swan
Subject Classes, Inheritance, and Children
Date
Msg-id 4.3.2.7.2.20000727014844.020d4d48@sunset.backbone.olemiss.edu
Whole thread Raw
Responses Re: Classes, Inheritance, and Children  ("Oliver Elphick" <olly@lfix.co.uk>)
List pgsql-sql
<br /> I think I may have asked this before... If I did I'm sorry, but maybe this attempt, assuming a prior one, may be
alittle more clear.<br /><br /> create table foo (id int8);<br /> create table bar1 (name text) inherits (foo);<br />
createtable bar2 (data text) inherits (foo);<br /> create table hybrid ( ) inherits (bar1, bar2);<br /><br /><b>INSERT
INTOfoo VALUES (1);<br /> INSERT INTO bar1 VALUES (2,'myname');<br /> INSERT INTO bar2 VALUES (3,'mydata');<br />
INSERTINTO hybrid VALUES (4,'morename','moredata');<br /><br /><br /></b>I want to do a <b>SELECT * FROM foo*</b>; but
Ionly get the 'id' column as in :<br /><br /><font face="Courier, Courier">id <br /> ---<br />  1<br />  2<br />  3<br
/> 4<br /><br /><br /></font>What would be the query to get the following table or a magical way to expand children?<br
/><br/> I had originally hoped that <b>SELECT * FROM foo*</b> would yield the following, but it's not so.<br /><br
/><fontface="Courier, Courier">id | name       | data<br /> ---+------------+-------------<br />  1 | null       |
null<br/>  2 | 'myname'   | null<br />  3 | null       | 'mydata'<br />  4 | 'morename' | 'moredata'<br />   
|           |<br /><br /></font>I tried <b>SELECT id, name AS NULL, data AS NULL FROM foo*</b>; but that didn't do
anythingbut make 2 null columns...<br /><br /> Any help would be ... helpful...<br /><br /> Thanks,<br /> Thomas 

pgsql-sql by date:

Previous
From: danny
Date:
Subject: how to r/w blob field in php
Next
From: "Vladimir Terziev"
Date:
Subject: Large text insertion