Thread

  1. updating derived classes

    Ami Ganguli <ami@ganguli.com> — 2000-07-05T00:18:07Z

    =========================================================================
                             POSTGRESQL BUG REPORT TEMPLATE
     ========================================================================
    
    
    Your name               : Ami Ganguli
    Your email address      : ami@ganguli.com
    
    
    System Configuration
    ---------------------
      Architecture (example: Intel Pentium)         : AMD Athlon
    
      Operating System (example: Linux 2.0.26 ELF)  : Linux 2.2.16 ELF
    
      PostgreSQL version (example: PostgreSQL-6.5.1):   PostgreSQL-7.0.2
    
      Compiler used (example:  gcc 2.8.0)           : not sure (from RPM)
    
    
    Please enter a FULL description of your problem:
    ------------------------------------------------
    
    When UPDATING a table that has derived classes the documentation states that
    the plain UPDATE command should update all the derived classes as well. 
    (UPDATE ONLY would update only the specified class.)  This doesn't seem to
    work and I can't figure out how to update both all the derived classes without
    copious amounts of code.
    
    Please describe a way to repeat the problem.   Please try to provide a
    concise reproducible example, if at all possible:
    ----------------------------------------------------------------------
    
    tester=# create table parent ( a int );
    CREATE
    tester=# create table child ( b int ) inherits ( parent );
    CREATE
    tester=# insert into child values ( 1, 2 );
    INSERT 19253 1
    tester=# select * from parent*;
     a 
    ---
     1
    (1 row)
    
    tester=# update parent set a=2;
    UPDATE 0
    tester=# update parent* set a=2;
    ERROR:  parser: parse error at or near "*"
    
    
    
    If you know how this problem might be fixed, list the solution below:
    ---------------------------------------------------------------------
    
    Thanks for any help with this.  I can work around the problem, but the
    resulting code would be quite unweildy and a bear to maintain.  Is there a
    clean workaround?
    
    ... Ami.