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

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

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

In response to

Responses

Browse pgsql-general by date

  From Date Subject
Next Message Andy Colson 2009-08-02 01:49:23 Re: Can I add a super table to existing tables?
Previous Message Chris Spotts 2009-08-02 01:31:15 Re: How to execute external script from a TRIGGER or FUNCTION ?