pg.ddx.io  pgsql-general@postgresql.org mailing list archive  
help / color / mirror / Atom feed
From: Thomas Kellerer <spam_eater@gmx.net>
To: pgsql-general@postgresql.org
Subject: Re: Creating complex track changes database - challenge!
Date: Mon, 26 Feb 2018 12:09:19 +0100
Message-ID: <87b96364-ab33-90f9-e8df-c95cf8468648@gmx.net> (raw)
In-Reply-To: <CAGv31oeZtBP6PefUADybfc8EwwR+gJ3h281WO_9zsvk9uyS0AQ@mail.gmail.com>
References: <CAGv31oeZtBP6PefUADybfc8EwwR+gJ3h281WO_9zsvk9uyS0AQ@mail.gmail.com>

Łukasz Jarych schrieb am 26.02.2018 um 11:44:
> i would like to ask you for help with track changes to my database. 
> I am new to PosgtreeSQL but i have to learn it quickly because of my boss. 
> 
> I have to:
> 
> 1. Keep all changes within table including:
> -adding rows
> -deleting
> -editing
>
> 2. Save table with specific state and recover specific state (so go back to previous table versions) including comparing tables.

There are several generic auditing triggers that can do that:

* http://cjauvin.blogspot.de/2013/05/impossibly-lean-audit-system-for.html
* https://eager.io/blog/audit-postgres/
* http://okbob.blogspot.de/2015/01/most-simply-implementation-of-history.html
* http://8kb.co.uk/blog/2015/01/19/copying-pavel-stehules-simple-history-table-but-with-the-jsonb-type...
* https://www.garysieling.com/blog/auditing-data-changes-postgres
* https://github.com/wingspan/wingspan-auditing
* https://wiki.postgresql.org/wiki/Audit_trigger_91plus

> 3. Track all DLL and DML changes with possibility to ho back to previous version. 

That will be very tricky, especially the "go back to previous version" part. 

But in general DDL changes can be tracked using event triggers. 

Thomas




view thread (14+ messages)  latest in thread

Message-ID: <87b96364-ab33-90f9-e8df-c95cf8468648@gmx.net>
Permalink:  ../87b96364-ab33-90f9-e8df-c95cf8468648@gmx.net/
Also on:    postgresql.org/message-id/87b96364-ab33-90f9-e8df-c95cf8468648@gmx.net

 · 

reply

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Reply to all the recipients from your mail client; the link fills in
  the headers below: reply via email
  Some clients, webmail especially, drop In-Reply-To and References from
  a link, and the reply then starts a new thread: use the mbox below.

  To: pgsql-general@postgresql.org
  Cc: spam_eater@gmx.net
  Subject: Re: Creating complex track changes database - challenge!
  In-Reply-To: <87b96364-ab33-90f9-e8df-c95cf8468648@gmx.net>
  References: <CAGv31oeZtBP6PefUADybfc8EwwR+gJ3h281WO_9zsvk9uyS0AQ@mail.gmail.com> <87b96364-ab33-90f9-e8df-c95cf8468648@gmx.net>

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

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