Peter Harvey wrote: >If I try to get the columns from pg_attribute using the oid of a child >table created with INHERIT
Iget its columns AND all of its inherited >columns. > >How do I just get the columns added by the child table? > >I
figureI could check each column to see if they also exist in >pg_attribute under a parent table but I figure there must
bean >easier/faster way? Another pg_* table perhaps? Besides; I am not certian >this would work if there is a common
columnbetween a child and one of >its parents (if that is even allowed)? > >As usual, any help would be greatly
appreciated.
SELECT a.attname FROM pg_attribute AS a, pg_class AS c, pg_inherits AS i WHERE a.attrelid = c.oid AND
i.inhrelid= c.oid AND c.relname = 'child_table' AND a.attname NOT IN ( SELECT a.attname FROM pg_attribute
ASa, pg_class AS c, pg_inherits AS i WHERE i.inhrelid = c.oid AND a.attrelid = i.inhparent AND
c.relname = 'child_table' )
--
Oliver Elphick Oliver.Elphick@lfix.co.uk
Isle of Wight http://www.lfix.co.uk/oliver
PGP: 1024R/32B8FAA1: 97 EA 1D 47 72 3F 28 47 6B 7E 39 CC 56 E4 C1 47
GPG: 1024D/3E1D0C1C: CA12 09E0 E8D5 8870 5839 932A 614D 4C34 3E1D 0C1C
======================================== "Submit yourselves therefore to God. Resist the devil, and he will flee
fromyou." James 4:7