pg.ddx.io  pgsql-sql@postgresql.org mailing list archive  
help / color / mirror / Atom feed
arhiving rule
2+ messages / 2 participants
[nested] [flat]

* arhiving rule
@ 2000-12-01 11:44 A. Van Hook <hook@kcp.com>
  2000-12-01 15:21 ` Re: arhiving rule Tom Lane <tgl@sss.pgh.pa.us>
  0 siblings, 1 reply; 2+ messages in thread

From: A. Van Hook @ 2000-12-01 11:44 UTC (permalink / raw)
  To: pgsql-sql

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




^ permalink  raw  reply  [nested|flat] 2+ messages in thread

* Re: arhiving rule
  2000-12-01 11:44 arhiving rule A. Van Hook <hook@kcp.com>
@ 2000-12-01 15:21 ` Tom Lane <tgl@sss.pgh.pa.us>
  0 siblings, 0 replies; 2+ messages in thread

From: Tom Lane @ 2000-12-01 15:21 UTC (permalink / raw)
  To: A. Van Hook <hook@kcp.com>; +Cc: pgsql-sql

"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



^ permalink  raw  reply  [nested|flat] 2+ messages in thread


end of thread, other threads:[~2000-12-01 15:21 UTC | newest]

Thread overview: 2+ messages (download: mbox mbox.gz follow: Atom feed)
-- links below jump to the message on this page --
2000-12-01 11:44 arhiving rule A. Van Hook <hook@kcp.com>
2000-12-01 15:21 ` Tom Lane <tgl@sss.pgh.pa.us>

This inbox is served by DDX for PostgreSQL; see mirroring instructions
for how to clone and mirror all data and code used for this inbox