Re: feature idea – automatic up - Mailing list pgsql-general

From Richard Huxton
Subject Re: feature idea – automatic up
Date
Msg-id 40ADDE30.5080006@archonet.com
Whole thread Raw
In response to feature idea – automatic update tracking using date fields – feedback pls  (anony@dslextreme.com (anony))
Responses Re: feature idea – automatic up  (Tom Lane <tgl@sss.pgh.pa.us>)
List pgsql-general
anony wrote:
> Maybe this feature is already out there.
> I guess you could write triggers to do some of this.
>
> Often when designing a database I add a start_date and end_date column
> to the table. The start_date is when the record was created and the
> end_date is when the record expired. For UPDATES, I populate the
> end_date and INSERT a new record. This allows you to track changes
> though out time.

You probably want to read up on "Temporal Databases" which is what
you're talking about. I believe there is a book by C.J.Date on the topic
as it relates to relational DBs.

 From a curiosity point of view, there apparently used to be a
"time-travel" feature in (really) old versions of PG. MVCC effectively
creates a new row for every update anyway, so you could "rewind" to
previous transaction IDs to see the data then.

--
   Richard Huxton
   Archonet Ltd

pgsql-general by date:

Previous
From: Richard Huxton
Date:
Subject: Re: Problem with public schema
Next
From: Adam Witney
Date:
Subject: Re: Web DB Management tool