Re: Can I add a super table to existing tables?

From: Andy Colson <andy(at)squeakycode(dot)net>
To: pgsql-general(at)postgresql(dot)org
Cc: Jun Yang <jyang825(at)gmail(dot)com>
Subject: Re: Can I add a super table to existing tables?
Date: 2009-08-02 01:49:23
Message-ID: 4A74F0A3.7050206@squeakycode.net
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-general

Andy Colson wrote:
> Jun Yang wrote:
>> Hi all,
>>
>> I want to add some common columns to all of my tables. One way I
>> think would be to add a super table that contains the common columns
>> to all tables. But is there a way to add a super table to existing
>> tables for them to inherit from?
>>
>> Thanks!
>>
>> Jun
>>
>
> as long as the parent and child has the same table struct, yes.
>
> use:
>
> alter table child inherit newparent;
>
> -Andy

err... sorry, let me fix that: the parent must have a common subset of all the children. (The children can have extras the parent does not, but not visa versa)

-Andy

In response to

Responses

Browse pgsql-general by date

  From Date Subject
Next Message andy 2009-08-02 02:04:48 Re: Can I add a super table to existing tables?
Previous Message Andy Colson 2009-08-02 01:41:25 Re: Can I add a super table to existing tables?