Immutable datastore library?

From: Guyren Howe <guyren(at)gmail(dot)com>
To: pgsql-general <pgsql-general(at)postgresql(dot)org>
Subject: Immutable datastore library?
Date: 2016-10-17 20:39:58
Message-ID: 995A4B35-51AD-471E-AF43-49A57B068E5D@gmail.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-general

I would like to use Postgres as an immutable data store. A subject table would have a timestamp column, and that would be added to what would otherwise be the primary key.

Trap updates and turn them into inserts. Have an associated _deleted table. Trap deletes and turn them into inserts of the primary key into that table.

Create a view that only shows the non-deleted records with the most recent timestamps.

Stored procedure to do all that to a table. Event trigger to drop and re-create the view on changes to the table columns.

I think that's about it. Seems an obvious and nice general-purpose thing to do. It also seems like something someone might have already done, but googling "immutable postgres" pulls up things about writing functions.

Does anyone know of a project that has already done this?

Responses

Browse pgsql-general by date

  From Date Subject
Next Message Melvin Davidson 2016-10-17 20:54:46 Re: Problem changing default data_directory in PG 9.6 + CentOS6
Previous Message Edilmar LISTAS 2016-10-17 20:38:47 Problem changing default data_directory in PG 9.6 + CentOS6