Thread

  1. arhiving rule

    hook <hook@kcp.com> — 2000-12-01T11:44:29Z

    I have, what I think is a simple rule to arrive transactions:
    
     create rule usageupdt as on update to usage
               do insert into usageHistory
                  (lkey, jan, feb, mar, bowner, penalty, prepay, bal, notes,
    change)
               values
                  (new.lkey, old.jan, old.feb, old.mar, old.bowner,
                   old.penalty, old.prepay, old.bal, old.notes, 'now')
    
    
    the only problem is that once is rule is created,  new rows in the
    archive table all have the same date!
             -the date when the rule was created....
    
    
        thanks
        art
    
    
    
  2. Re: arhiving rule

    Tom Lane <tgl@sss.pgh.pa.us> — 2000-12-01T15:21:44Z

    "A. Van Hook" <hook@kcp.com> writes:
    > I have, what I think is a simple rule to arrive transactions:
    >  create rule usageupdt as on update to usage
    >            do insert into usageHistory
    >               (lkey, jan, feb, mar, bowner, penalty, prepay, bal, notes,
    > change)
    >            values
    >               (new.lkey, old.jan, old.feb, old.mar, old.bowner,
    >                old.penalty, old.prepay, old.bal, old.notes, 'now')
    
    > the only problem is that once is rule is created,  new rows in the
    > archive table all have the same date!
    >          -the date when the rule was created....
    
    Try now() instead of 'now'.  The latter is coerced to a timestamp
    constant as soon as the rule is parsed ...
    
    			regards, tom lane