Received: from tangent.ics.olemiss.edu (IDENT:root@tangent.ics.olemiss.edu [130.74.31.3]) by hub.org (8.10.1/8.10.1) with ESMTP id e6R76tA95400 for ; Thu, 27 Jul 2000 03:06:55 -0400 (EDT) Received: from Betelgeuse.olemiss.edu (wsp000771wss.ics.olemiss.edu [130.74.31.251]) by tangent.ics.olemiss.edu (8.9.3/8.8.7) with ESMTP id CAA02425 for ; Thu, 27 Jul 2000 02:06:54 -0500 Message-Id: <4.3.2.7.2.20000727014844.020d4d48@sunset.backbone.olemiss.edu> X-Sender: tswan@sunset.backbone.olemiss.edu X-Mailer: QUALCOMM Windows Eudora Version 4.3.2 Date: Thu, 27 Jul 2000 02:06:51 -0500 To: pgsql-sql@postgresql.org From: Thomas Swan Subject: Classes, Inheritance, and Children Mime-Version: 1.0 Content-Type: multipart/alternative; boundary="=====================_229087468==_.ALT" X-Archive-Number: 200007/249 --=====================_229087468==_.ALT Content-Type: text/plain; charset="us-ascii"; format=flowed I think I may have asked this before... If I did I'm sorry, but maybe this attempt, assuming a prior one, may be a little more clear. create table foo (id int8); create table bar1 (name text) inherits (foo); create table bar2 (data text) inherits (foo); create table hybrid ( ) inherits (bar1, bar2); INSERT INTO foo VALUES (1); INSERT INTO bar1 VALUES (2,'myname'); INSERT INTO bar2 VALUES (3,'mydata'); INSERT INTO hybrid VALUES (4,'morename','moredata'); I want to do a SELECT * FROM foo*; but I only get the 'id' column as in : id --- 1 2 3 4 What would be the query to get the following table or a magical way to expand children? I had originally hoped that SELECT * FROM foo* would yield the following, but it's not so. id | name | data ---+------------+------------- 1 | null | null 2 | 'myname' | null 3 | null | 'mydata' 4 | 'morename' | 'moredata' | | I tried SELECT id, name AS NULL, data AS NULL FROM foo*; but that didn't do anything but make 2 null columns... Any help would be ... helpful... Thanks, Thomas --=====================_229087468==_.ALT Content-Type: text/html; charset="us-ascii"
I think I may have asked this before... If I did I'm sorry, but maybe this attempt, assuming a prior one, may be a little more clear.

create table foo (id int8);
create table bar1 (name text) inherits (foo);
create table bar2 (data text) inherits (foo);
create table hybrid ( ) inherits (bar1, bar2);

INSERT INTO foo VALUES (1);
INSERT INTO bar1 VALUES (2,'myname');
INSERT INTO bar2 VALUES (3,'mydata');
INSERT INTO hybrid VALUES (4,'morename','moredata');


I want to do a SELECT * FROM foo*; but I only get the 'id' column as in :

id
---
 1
 2
 3
 4


What would be the query to get the following table or a magical way to expand children?

I had originally hoped that SELECT * FROM foo* would yield the following, but it's not so.

id | name       | data
---+------------+-------------
 1 | null       | null
 2 | 'myname'   | null
 3 | null       | 'mydata'
 4 | 'morename' | 'moredata'
   |            |

I tried SELECT id, name AS NULL, data AS NULL FROM foo*; but that didn't do anything but make 2 null columns...

Any help would be ... helpful...

Thanks,
Thomas --=====================_229087468==_.ALT--