Re: INHERIT - Mailing list pgsql-hackers

From Hannu Krosing
Subject Re: INHERIT
Date
Msg-id 3B9BB3BD.1B09ABFF@tm.ee
Whole thread Raw
In response to Re: INHERIT  ("Oliver Elphick" <olly@lfix.co.uk>)
List pgsql-hackers
Oliver Elphick wrote:
> 
> Peter Harvey wrote:
>   >If I try to get the columns from pg_attribute using the oid of a child
>   >table created with INHERIT I get its columns AND all of its inherited
>   >columns.
>   >
>   >How do I just get the columns added by the child table?
>   >
>   >I figure I could check each column to see if they also exist in
>   >pg_attribute under a parent table but I figure there must be an
>   >easier/faster way? Another pg_* table perhaps? Besides; I am not certian
>   >this would work if there is a common column between a child and one of
>   >its parents (if that is even allowed)?

hannu=# \d parent         Table "parent"Attribute |  Type   | Modifier 
-----------+---------+----------parid     | integer | not null
Index: parent_pkey

hannu=# create table badchild (parid text) inherits (parent);
NOTICE:  CREATE TABLE: merging attribute "parid" with inherited
definition
ERROR:  CREATE TABLE: attribute "parid" type conflict (int4 and text)
hannu=# 

And anyway, in the current state I would advise you not to put too much 
hope in postgreSQL's OO features, especially inheritance ;)

-------------
Hannu


pgsql-hackers by date:

Previous
From: Barry Lind
Date:
Subject: Re: Timezones and time/timestamp values in FE/BE protocol
Next
From: "Jim Buttafuoco"
Date:
Subject: pg_dump -C and locations (with subject this time)