Re: Inherits is not encouraged?

From: Karsten Hilbert <Karsten(dot)Hilbert(at)gmx(dot)net>
To: pgsql-sql(at)postgresql(dot)org
Subject: Re: Inherits is not encouraged?
Date: 2009-03-10 08:23:14
Message-ID: 20090310082313.GE3885@merkur.hilbert.loc
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-sql

On Mon, Mar 09, 2009 at 07:55:35PM -0400, Tom Lane wrote:

> Emi Lu <emilu(at)encs(dot)concordia(dot)ca> writes:
> > (1) Is possible that I could change the column of a table that is
> > defined by Inherits?
>
> > e.g., t1(col1, col2, col3); create table tx(colx) Inherits (t1)
> > I'd like to get tx shown as (col1, colx, col2, col3).
>
> No, you don't really have a lot of control over that.

"Explicit select list" would be one way (and the one that's
encouraged as good practice):

select col1, colx, col2, col3 from tx;

If that doesn't cut it (say, generic viewer which doesn't
know what is going to be viewed) - use a view over tx. Maybe
even "hide" the table tx as "table_tx" and name the view
itself "tx". Care needs to be taken then to either setup
appropriate rules or to make insert/update/delete go to
"table_tx".

Karsten
--
GPG key ID E4071346 @ wwwkeys.pgp.net
E167 67FD A291 2BEA 73BD 4537 78B9 A9F9 E407 1346

In response to

Browse pgsql-sql by date

  From Date Subject
Next Message hidura 2009-03-11 05:41:41 Problem with an Empty Column
Previous Message Tom Lane 2009-03-09 23:55:35 Re: Inherits is not encouraged?