Re: Inherits is not encouraged? - Mailing list pgsql-sql

From Karsten Hilbert
Subject Re: Inherits is not encouraged?
Date
Msg-id 20090310082313.GE3885@merkur.hilbert.loc
Whole thread Raw
In response to Re: Inherits is not encouraged?  (Tom Lane <tgl@sss.pgh.pa.us>)
List pgsql-sql
On Mon, Mar 09, 2009 at 07:55:35PM -0400, Tom Lane wrote:

> Emi Lu <emilu@encs.concordia.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


pgsql-sql by date:

Previous
From: Tom Lane
Date:
Subject: Re: Inherits is not encouraged?
Next
From: hidura@gmail.com
Date:
Subject: Problem with an Empty Column