From pornstarbatman@hotmail.com Tue Oct 29 22:39:21 2002 Received: from localhost (postgresql.org [64.49.215.8]) by postgresql.org (Postfix) with ESMTP id 483C3475F53 for ; Tue, 29 Oct 2002 17:39:21 -0500 (EST) Received: from hotmail.com (oe50.pav2.hotmail.com [64.4.36.22]) by postgresql.org (Postfix) with ESMTP id A9425475E5E for ; Tue, 29 Oct 2002 17:39:20 -0500 (EST) Received: from mail pickup service by hotmail.com with Microsoft SMTPSVC; Tue, 29 Oct 2002 14:39:22 -0800 X-Originating-IP: [217.168.173.114] From: "James Adams" To: Subject: Selecting * from the base table but getting the inheriteds columns Date: Tue, 29 Oct 2002 23:37:46 +0100 MIME-Version: 1.0 Content-Type: multipart/alternative; boundary="----=_NextPart_000_003B_01C27FA4.2F5B1E60" X-Priority: 3 X-MSMail-Priority: Normal X-Mailer: Microsoft Outlook Express 6.00.2720.3000 X-MimeOLE: Produced By Microsoft MimeOLE V6.00.2600.0000 Message-ID: X-OriginalArrivalTime: 29 Oct 2002 22:39:22.0621 (UTC) FILETIME=[06D78AD0:01C27F9C] X-Virus-Scanned: by AMaViS new-20020517 X-Archive-Number: 200210/395 X-Sequence-Number: 10112 This is a multi-part message in MIME format. ------=_NextPart_000_003B_01C27FA4.2F5B1E60 Content-Type: text/plain; charset="iso-8859-1" Content-Transfer-Encoding: quoted-printable Hello, I have a "baseTable". I have a number of decendantTables that INHERIT from= the base table.=20=20 I want to do somthing like =3D>select * from baseTable; But I want it to return the data in the all the descendant tables along wit= h the extra column that they contain. How do I do this? please help many thanks for your time James ------=_NextPart_000_003B_01C27FA4.2F5B1E60 Content-Type: text/html; charset="iso-8859-1" Content-Transfer-Encoding: quoted-printable
Hello,
 
I have a "baseTable".  I have a = number=20 of decendantTables that INHERIT from the base table. =20
 
I want to do somthing like
 
=3D>select * from baseTable;
 
But I want it to return the data in the al= l the=20 descendant tables along with the extra column that they contain.  How = do I=20 do this?
 
please help
 
many thanks for your time
 
James
 
 
------=_NextPart_000_003B_01C27FA4.2F5B1E60-- From jasiek@klaster.net Wed Oct 30 07:58:56 2002 Received: from localhost (postgresql.org [64.49.215.8]) by postgresql.org (Postfix) with ESMTP id CA952475B8A for ; Wed, 30 Oct 2002 02:58:56 -0500 (EST) Received: from serwer.skawsoft.com.pl (serwer.skawsoft.com.pl [213.25.37.66]) by postgresql.org (Postfix) with ESMTP id 25234474E61 for ; Wed, 30 Oct 2002 02:58:56 -0500 (EST) Received: from klaster.net (pd88.krakow.cvx.ppp.tpnet.pl [213.76.39.88]) by serwer.skawsoft.com.pl (Postfix) with ESMTP id 023052B501; Wed, 30 Oct 2002 08:51:10 +0100 (CET) Message-ID: <3DBF92BF.4080506@klaster.net> Date: Wed, 30 Oct 2002 09:05:19 +0100 From: Tomasz Myrta User-Agent: Mozilla/5.0 (Windows; U; Win 9x 4.90; PL; rv:1.1) Gecko/20020826 X-Accept-Language: pl, en-us, en MIME-Version: 1.0 To: James Adams Cc: pgsql-sql@postgresql.org Subject: Re: Selecting * from the base table but getting the inheriteds References: Content-Type: text/plain; charset=ISO-8859-1; format=flowed Content-Transfer-Encoding: 8bit X-Virus-Scanned: by AMaViS new-20020517 X-Archive-Number: 200210/398 X-Sequence-Number: 10115 Uz.ytkownik James Adams napisa?: > Hello, > > I have a "baseTable". I have a number of decendantTables that INHERIT > from the base table. > > I want to do somthing like > > =>select * from baseTable; > > But I want it to return the data in the all the descendant tables along > with the extra column that they contain. How do I do this? > select *, cast(null as varchar) as another_field1, cast(null as int4) as another_field2 from only basetable union select * from descent_table Isn't it easier to just create baseTable with the same columns as descent tables (and fill them with nulls)? Tomasz Myrta From pornstarbatman@hotmail.com Wed Oct 30 09:27:01 2002 Received: from localhost (postgresql.org [64.49.215.8]) by postgresql.org (Postfix) with ESMTP id ECAF6475DFF for ; Wed, 30 Oct 2002 04:27:01 -0500 (EST) Received: from hotmail.com (oe26.pav2.hotmail.com [64.4.36.83]) by postgresql.org (Postfix) with ESMTP id 3E213475CE5 for ; Wed, 30 Oct 2002 04:27:01 -0500 (EST) Received: from mail pickup service by hotmail.com with Microsoft SMTPSVC; Wed, 30 Oct 2002 01:27:02 -0800 X-Originating-IP: [217.168.173.114] From: "James Adams" To: "Tomasz Myrta" Cc: References: <3DBF92BF.4080506@klaster.net> Subject: Re: Selecting * from the base table but getting the inheriteds Date: Wed, 30 Oct 2002 10:25:17 +0100 MIME-Version: 1.0 Content-Type: text/plain; charset="iso-8859-1" Content-Transfer-Encoding: 7bit X-Priority: 3 X-MSMail-Priority: Normal X-Mailer: Microsoft Outlook Express 6.00.2720.3000 X-MimeOLE: Produced By Microsoft MimeOLE V6.00.2600.0000 Message-ID: X-OriginalArrivalTime: 30 Oct 2002 09:27:02.0020 (UTC) FILETIME=[80D94440:01C27FF6] X-Virus-Scanned: by AMaViS new-20020517 X-Archive-Number: 200210/402 X-Sequence-Number: 10119 Yea it would be easier to have everything in one table filling unused with nulls, but I was trying to avoid that because of the wasted space. But I think I'll do it that way after all :~] Thanks for your help ----- Original Message ----- From: "Tomasz Myrta" To: "James Adams" Cc: Sent: Wednesday, October 30, 2002 9:05 AM Subject: Re: [SQL] Selecting * from the base table but getting the inheriteds > Uz.ytkownik James Adams napisa?: > > Hello, > > > > I have a "baseTable". I have a number of decendantTables that INHERIT > > from the base table. > > > > I want to do somthing like > > > > =>select * from baseTable; > > > > But I want it to return the data in the all the descendant tables along > > with the extra column that they contain. How do I do this? > > > > select > *, > cast(null as varchar) as another_field1, > cast(null as int4) as another_field2 > from only basetable > union > select > * > from descent_table > > Isn't it easier to just create baseTable with the same columns as > descent tables (and fill them with nulls)? > > Tomasz Myrta > > > ---------------------------(end of broadcast)--------------------------- > TIP 5: Have you checked our extensive FAQ? > > http://www.postgresql.org/users-lounge/docs/faq.html > From reedstrm@rice.edu Fri Nov 1 16:37:35 2002 Received: from localhost (postgresql.org [64.49.215.8]) by postgresql.org (Postfix) with ESMTP id 3BA5E476DA5 for ; Fri, 1 Nov 2002 11:37:35 -0500 (EST) Received: from ece.rice.edu (ece.rice.edu [128.42.4.34]) by postgresql.org (Postfix) with ESMTP id C721A476DB8 for ; Fri, 1 Nov 2002 11:37:34 -0500 (EST) Received: from localhost (localhost [127.0.0.1]) by ece.rice.edu (Postfix) with SMTP id 0CF4468A9A; Fri, 1 Nov 2002 10:37:39 -0600 (CST) Received: from localhost (localhost [127.0.0.1]) by ece.rice.edu (Postfix) with ESMTP id 87B5568A97; Fri, 1 Nov 2002 10:37:38 -0600 (CST) Received: from wallace.ece.rice.edu (wallace.ece.rice.edu [128.42.12.154]) by ece.rice.edu (Postfix) with ESMTP id 8F55768A99; Fri, 1 Nov 2002 10:37:35 -0600 (CST) Received: from reedstrm by wallace.ece.rice.edu with local (Exim 3.36 #1 (Debian)) id 187enf-00007s-00; Fri, 01 Nov 2002 10:37:35 -0600 Date: Fri, 1 Nov 2002 10:37:35 -0600 From: "Ross J. Reedstrom" To: James Adams Cc: Tomasz Myrta , pgsql-sql@postgresql.org Subject: Re: Selecting * from the base table but getting the inheriteds Message-ID: <20021101163735.GA443@wallace.ece.rice.edu> Mail-Followup-To: "Ross J. Reedstrom" , James Adams , Tomasz Myrta , pgsql-sql@postgresql.org References: <3DBF92BF.4080506@klaster.net> Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: User-Agent: Mutt/1.4i X-Virus-Scanned: by AMaViS snapshot-20020300 X-DCC--Metrics: ece.rice.edu 1067; Body=1 Fuz1=1 Fuz2=1 X-Virus-Scanned: by AMaViS new-20020517 X-Archive-Number: 200211/9 X-Sequence-Number: 10151 On Wed, Oct 30, 2002 at 10:25:17AM +0100, James Adams wrote: > Yea it would be easier to have everything in one table filling unused with > nulls, but I was trying to avoid that because of the wasted space. > But I think I'll do it that way after all :~] > Thanks for your help Don't fret too much about the wasted space: NULL fields set a bit in a bitmask in the header of the on-disk tuple, so they take up _no_ storage at all. Ross