pg.ddx.io  pgsql-sql@postgresql.org mailing list archive  
help / color / mirror / Atom feed
From: James Adams <pornstarbatman@hotmail.com>
To: Tomasz Myrta <jasiek@klaster.net>
Cc: pgsql-sql@postgresql.org
Subject: Re: Selecting * from the base table but getting the inheriteds
Date: Wed, 30 Oct 2002 10:25:17 +0100
Message-ID: <OE26Qx6QC3gYKOvN5wL0000a19a@hotmail.com> (raw)
References: <OE50hCLwHc9ny7BXx4X00000bd3@hotmail.com>
	<3DBF92BF.4080506@klaster.net>

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" <jasiek@klaster.net>
To: "James Adams" <pornstarbatman@hotmail.com>
Cc: <pgsql-sql@postgresql.org>
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
>



view thread (4+ messages)  latest in thread

Message-ID: <OE26Qx6QC3gYKOvN5wL0000a19a@hotmail.com>
Permalink:  ../OE26Qx6QC3gYKOvN5wL0000a19a@hotmail.com/
Also on:    postgresql.org/message-id/OE26Qx6QC3gYKOvN5wL0000a19a@hotmail.com

 · 

reply

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Reply to all the recipients using the --to and --cc options:
  reply via email

  To: pgsql-sql@postgresql.org
  Cc: pornstarbatman@hotmail.com, jasiek@klaster.net
  Subject: Re: Selecting * from the base table but getting the inheriteds
  In-Reply-To: <OE26Qx6QC3gYKOvN5wL0000a19a@hotmail.com>

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

This inbox is served by DDX for PostgreSQL; see mirroring instructions
for how to clone and mirror all data and code used for this inbox