pg.ddx.io pgsql-sql@postgresql.org mailing list archive
help / color / mirror / Atom feedSelecting * from the base table but getting the inheriteds columns
4+ messages / 3 participants
[nested] [flat]
* Selecting * from the base table but getting the inheriteds columns
@ 2002-10-29 22:37 James Adams <pornstarbatman@hotmail.com>
2002-10-30 08:05 ` Re: Selecting * from the base table but getting the inheriteds Tomasz Myrta <jasiek@klaster.net>
0 siblings, 1 reply; 4+ messages in thread
From: James Adams @ 2002-10-29 22:37 UTC (permalink / raw)
To: pgsql-sql
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?
please help
many thanks for your time
James
^ permalink raw reply [nested|flat] 4+ messages in thread
* Re: Selecting * from the base table but getting the inheriteds
2002-10-29 22:37 Selecting * from the base table but getting the inheriteds columns James Adams <pornstarbatman@hotmail.com>
@ 2002-10-30 08:05 ` Tomasz Myrta <jasiek@klaster.net>
2002-10-30 09:25 ` Re: Selecting * from the base table but getting the inheriteds James Adams <pornstarbatman@hotmail.com>
0 siblings, 1 reply; 4+ messages in thread
From: Tomasz Myrta @ 2002-10-30 08:05 UTC (permalink / raw)
To: James Adams <pornstarbatman@hotmail.com>; +Cc: pgsql-sql
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
^ permalink raw reply [nested|flat] 4+ messages in thread
* Re: Selecting * from the base table but getting the inheriteds
2002-10-29 22:37 Selecting * from the base table but getting the inheriteds columns James Adams <pornstarbatman@hotmail.com>
2002-10-30 08:05 ` Re: Selecting * from the base table but getting the inheriteds Tomasz Myrta <jasiek@klaster.net>
@ 2002-10-30 09:25 ` James Adams <pornstarbatman@hotmail.com>
2002-11-01 16:37 ` Re: Selecting * from the base table but getting the inheriteds Ross J. Reedstrom <reedstrm@rice.edu>
0 siblings, 1 reply; 4+ messages in thread
From: James Adams @ 2002-10-30 09:25 UTC (permalink / raw)
To: Tomasz Myrta <jasiek@klaster.net>; +Cc: pgsql-sql
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
>
^ permalink raw reply [nested|flat] 4+ messages in thread
* Re: Selecting * from the base table but getting the inheriteds
2002-10-29 22:37 Selecting * from the base table but getting the inheriteds columns James Adams <pornstarbatman@hotmail.com>
2002-10-30 08:05 ` Re: Selecting * from the base table but getting the inheriteds Tomasz Myrta <jasiek@klaster.net>
2002-10-30 09:25 ` Re: Selecting * from the base table but getting the inheriteds James Adams <pornstarbatman@hotmail.com>
@ 2002-11-01 16:37 ` Ross J. Reedstrom <reedstrm@rice.edu>
0 siblings, 0 replies; 4+ messages in thread
From: Ross J. Reedstrom @ 2002-11-01 16:37 UTC (permalink / raw)
To: James Adams <pornstarbatman@hotmail.com>; +Cc: Tomasz Myrta <jasiek@klaster.net>; pgsql-sql
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
^ permalink raw reply [nested|flat] 4+ messages in thread
end of thread, other threads:[~2002-11-01 16:37 UTC | newest]
Thread overview: 4+ messages (download: mbox mbox.gz follow: Atom feed)
-- links below jump to the message on this page --
2002-10-29 22:37 Selecting * from the base table but getting the inheriteds columns James Adams <pornstarbatman@hotmail.com>
2002-10-30 08:05 ` Re: Selecting * from the base table but getting the inheriteds Tomasz Myrta <jasiek@klaster.net>
2002-10-30 09:25 ` Re: Selecting * from the base table but getting the inheriteds James Adams <pornstarbatman@hotmail.com>
2002-11-01 16:37 ` Re: Selecting * from the base table but getting the inheriteds Ross J. Reedstrom <reedstrm@rice.edu>
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