Re: Selecting * from the base table but getting the inheriteds

Поиск
Список
Период
Сортировка
От Tomasz Myrta
Тема Re: Selecting * from the base table but getting the inheriteds
Дата
Msg-id 3DBF92BF.4080506@klaster.net
обсуждение исходный текст
Ответ на Selecting * from the base table but getting the inheriteds columns  ("James Adams" <pornstarbatman@hotmail.com>)
Список 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



В списке pgsql-sql по дате отправления:

Предыдущее
От: Viacheslav N Tararin
Дата:
Сообщение: Database Design tool
Следующее
От: "Kabai József"
Дата:
Сообщение: Re: Creating Stored Procedures