On Wed, Aug 29, 2012 at 8:52 AM, Chris Travers <chris.travers@xxxxxxxxx> wrote: > ALTER TABLE fruit ADD apple_id int; > ALTER TABLE fruit ADD FOREIGN KEY (apple_id, type) > REFERENCES apple (fruit_id, type) > DEFERRABLE INITIALLY DEFERRED; > > And then do the same for orange etc. you can then: > > ALTER TABLE fruit ADD CHECK ((type = 'apple' and apple_id IS NOT NULL) OR > (type = 'orange' AND orange_id IS NOT NULL) > etc.... Doing the above for me is a 'bridge too far'. Sure, It's the only way to make sure the base type is properly specialized but it just sucks. If there was some way to 'C union' the value into a single column (there isn't) i'd be all over it... merlin -- Sent via pgsql-general mailing list (pgsql-general@xxxxxxxxxxxxxx) To make changes to your subscription: http://www.postgresql.org/mailpref/pgsql-general