Thread

  1. Re: Question about inheritance

    Dmitry G. Mastrukov Дмитрий Геннадьевич Мастрюков <dmitry@taurussoft.org> — 2001-06-05T10:17:33Z

     > "Christopher Kings-Lynne" <chriskl@familyhealth.com.au> writes:
     > > Am I misunderstanding how the mechanism works, or is this a big, not
     easily
     > > solved, problem?
     >
     > The latter.  Check the list archives for previous debates about this.
     > It's not real clear whether an inherited primary key should be expected
     > to be unique across the whole inheritance tree, or only unique per-table
     > (IIRC, plausible examples have been advanced for each case).  If we want
     > uniqueness across multiple tables, it'll take considerable work to
     > create an index mechanism that'd enforce it.
     >
     IMHO current behaviour of PostgreSQL with inherited PK, FK, UNIQUE is
    simply
     bug not only from object-oriented but even object-related point of view.
    Now
     I can violate parent PK by inserting duplicate key in child!
    
     Inherited tables should honours all constraints from parent. If I change
     some constraint (seems only FK, but not PK or UNIQUE) I should be able to
    do
     it in more restrictive manner. For example, two base table is connected via
     FK. I can change such FK in childs from base1->base2 to child1->child2 (or
     child3) but not to child1->not_inherited_from_base2. CHECK, DEFAULT, NOT
     NULL are more free to changes, isn't it?
    
     IMHO last message in doc/TODO.details/inheritance from Oliver Elphick is a
     good direction for implementing with exception on more rectrictive child FK
     constraint (p.3 of message).
    
     As for me, I was pushed to rollback to scheme with no inheritance at all in
     my project for now. So I'm very interesting in implementing of right
     inheritance and I wanted to ask similar question in one of the lists in
    near
     future.
    
     Regards,
     Dmitry
    
    
    
    
    
  2. Re: Question about inheritance

    Bruce Momjian <pgman@candle.pha.pa.us> — 2001-06-10T03:48:30Z

    I have added this thread to TODO.detail/inheritance.
    
    >  > "Christopher Kings-Lynne" <chriskl@familyhealth.com.au> writes:
    >  > > Am I misunderstanding how the mechanism works, or is this a big, not
    >  easily
    >  > > solved, problem?
    >  >
    >  > The latter.  Check the list archives for previous debates about this.
    >  > It's not real clear whether an inherited primary key should be expected
    >  > to be unique across the whole inheritance tree, or only unique per-table
    >  > (IIRC, plausible examples have been advanced for each case).  If we want
    >  > uniqueness across multiple tables, it'll take considerable work to
    >  > create an index mechanism that'd enforce it.
    >  >
    >  IMHO current behaviour of PostgreSQL with inherited PK, FK, UNIQUE is
    > simply
    >  bug not only from object-oriented but even object-related point of view.
    > Now
    >  I can violate parent PK by inserting duplicate key in child!
    > 
    >  Inherited tables should honours all constraints from parent. If I change
    >  some constraint (seems only FK, but not PK or UNIQUE) I should be able to
    > do
    >  it in more restrictive manner. For example, two base table is connected via
    >  FK. I can change such FK in childs from base1->base2 to child1->child2 (or
    >  child3) but not to child1->not_inherited_from_base2. CHECK, DEFAULT, NOT
    >  NULL are more free to changes, isn't it?
    > 
    >  IMHO last message in doc/TODO.details/inheritance from Oliver Elphick is a
    >  good direction for implementing with exception on more rectrictive child FK
    >  constraint (p.3 of message).
    > 
    >  As for me, I was pushed to rollback to scheme with no inheritance at all in
    >  my project for now. So I'm very interesting in implementing of right
    >  inheritance and I wanted to ask similar question in one of the lists in
    > near
    >  future.
    > 
    >  Regards,
    >  Dmitry
    > 
    > 
    > 
    > 
    > ---------------------------(end of broadcast)---------------------------
    > TIP 6: Have you searched our list archives?
    > 
    > http://www.postgresql.org/search.mpl
    > 
    
    -- 
      Bruce Momjian                        |  http://candle.pha.pa.us
      pgman@candle.pha.pa.us               |  (610) 853-3000
      +  If your life is a hard drive,     |  830 Blythe Avenue
      +  Christ can be your backup.        |  Drexel Hill, Pennsylvania 19026