Received: from malur.postgresql.org ([217.196.149.56]) by arkaria.postgresql.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_CBC_SHA384:256) (Exim 4.89) (envelope-from ) id 1eqGex-0005S0-Go for pgsql-general@arkaria.postgresql.org; Mon, 26 Feb 2018 11:09:31 +0000 Received: from localhost ([127.0.0.1] helo=malur.postgresql.org) by malur.postgresql.org with esmtp (Exim 4.89) (envelope-from ) id 1eqGew-0005QI-BU for pgsql-general@arkaria.postgresql.org; Mon, 26 Feb 2018 11:09:30 +0000 Received: from makus.postgresql.org ([2001:4800:1501:1::229]) by malur.postgresql.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_CBC_SHA384:256) (Exim 4.89) (envelope-from ) id 1eqGev-0005Q7-WE for pgsql-general@lists.postgresql.org; Mon, 26 Feb 2018 11:09:30 +0000 Received: from mout.kundenserver.de ([212.227.17.24]) by makus.postgresql.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_CBC_SHA1:256) (Exim 4.89) (envelope-from ) id 1eqGeo-0003fl-LB for pgsql-general@postgresql.org; Mon, 26 Feb 2018 11:09:28 +0000 Received: from [10.8.0.146] ([185.40.248.10]) by mrelayeu.kundenserver.de (mreue101 [212.227.15.145]) with ESMTPSA (Nemesis) id 0Lxwsm-1edwrk06OC-015Gbs for ; Mon, 26 Feb 2018 12:09:20 +0100 Subject: Re: Creating complex track changes database - challenge! To: pgsql-general@postgresql.org Newsgroups: gmane.comp.db.postgresql.general References: From: Thomas Kellerer Message-ID: <87b96364-ab33-90f9-e8df-c95cf8468648@gmx.net> Date: Mon, 26 Feb 2018 12:09:19 +0100 User-Agent: Mozilla/5.0 (Windows; U; Windows NT 5.1; en-US; rv:1.8.1.23) Gecko/20090812 Thunderbird/2.0.0.23 Mnenhy/0.7.6.666 MIME-Version: 1.0 In-Reply-To: Content-Type: text/plain; charset=utf-8 Content-Language: de-DE Content-Transfer-Encoding: 8bit X-Provags-ID: V03:K0:yvpDfSdDWfGqaFqh+L7PhQQDsXnrb5BpDiRrcbhP8ypN47UNNt0 CHEaVbNT2k4f1+rdWdwz1pJm61798fAMV+NRlHErEaVvIg/Hu7DIvaBqOAso+c96ep/j64Y g0CS4PMG51ofHb+fzvcg+tln3qXEM7ejFhNIrL8eR+eVU5hnlL/ky3LS3r1LstPLpR7XDrE zkiDDa7RIeZaDwkbPjH9Q== X-UI-Out-Filterresults: notjunk:1;V01:K0:1LEw9I6Zh7M=:LhX2+FWBL9i9QfUG7w7VUg EqFDE1RS+u9Ibj6mBl49y6eutr5bKLwjxtLCUefM85QXMyLu+8+LWzu1armqyt2pllKNJE1JR 2sbnsq1IgsyUakABCTYBS/gKPNwSR3s+T9LHcD9U73ryg+F2+uCrYR1ERPmaGnCZHthORhSlc q1JdzvlASoRsfzvONMDDZsvGdf/SmLNMJ+AIgBLLsak0/FpZm6ofuOPBQK86JReYEwRikeF9A qbMirxXmHW+CSiRqB2X/EPKtPZQpJ6uHR7J3t5zE8yaAdtKKE8dzi79LKixkuiGet1/OuZJHk IuMp1wzJE4dfZrJrsBjmsAwSyF/ZC47SmIE2GNRPKavJiIAo6e9kzoZ9xUfkXwGd1XbhPp7Yu nDNihdJsmtr8FVgfKq+5WbUeJ7j0IPZXnrnqq3LsqMJOSu14fFnI01upzspxE7SdkqyiRoQwF TABEPmnQ3TVTBIRt4pI0nVQC90r48j71NU2483PjiSuYsfE6/1+MralrLPUDItW3oTQw9dGHt 6PtIRvUDVvfaBgc1MwkYwQJ9HwmH7ty3LkHcxqjYXOAPJu54z9/HdQPSiGMHRnuSNYVaJzl3C SuKUn8oPJw+/JZjRLY8hELHe75MKVs1oC1SqAttt07/S5JaQ19GnXpfuIRU6wz99D26E0remG y7cvPHny/6sNxBRScXHZL+q0R/PujR7RPDfaqTRkVsYS1CCE+COizT3jSy0CR6/R9brzYNmYH bGOZtQsrNi+1YVPtwmD6TYCXh4H5+kNl4mxlZclqTMhrqnvtlMahSB7jZas= List-Id: List-Help: List-Subscribe: List-Post: List-Owner: List-Archive: Precedence: bulk Ł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