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

---------------------------(end of broadcast)---------------------------
TIP 4: Don't 'kill -9' the postmaster

Reply via email to