Backupping the table values

From: Vitaly Belman <vitalyb(at)gmail(dot)com>
To: PostgreSQL general <pgsql-general(at)postgresql(dot)org>
Subject: Backupping the table values
Date: 2005-02-26 14:47:38
Message-ID: fa96e3c605022606475609dfd0@mail.gmail.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-general

I am allowing my users to delete data from certain tables. However, to
be able to do a rollback of user changes, I decided to create another
"backup" schema that most data tables will copy data to, upon delete.

So basically what I have is:

public schema, in which there are two tables, A and B.
backup schema, in which there are two tables, A and B.

On table A and B in public I add a trigger "On Delete" which inserts
the deleted data to the matching tables in the backup scehma.

That'd work fine except the foreign keys problem. In A I have a
column, "B_id" that is a foreign key to an "id" in the B table. Thus
it means that I have to delete from A before I delete from B.

Inserting into the backup folders, on the other hand, should be
reversed, from the same reasons.

Anyone has an idea how to solve this?

--
ICQ: 1912453
AIM: VitalyB1984
MSN: tmdagent(at)hotmail(dot)com
Yahoo!: VitalyBe

Responses

Browse pgsql-general by date

  From Date Subject
Next Message Mike Harding 2005-02-26 15:12:13 Re: Hash aggregates blowing out memory
Previous Message Scott Marlowe 2005-02-26 14:46:10 Re: row numbering