Cascade Order

From: "Marty Alchin" <gulopine(at)hotmail(dot)com>
To: pgsql-general(at)postgresql(dot)org
Subject: Cascade Order
Date: 2004-07-28 13:34:31
Message-ID: BAY15-F27fki9PT3lz5000914c6@hotmail.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-general

Fir of all, hello to all of you. I'm new to this list, and I apologize if
this has already been asked, but the mailing list archives don't seem to be
responding at the moment for me to search through.

In my uses of PostgreSQL, I'm developing a revision control system for some
of my data, and I'd like it to be handled in PostgreSQL to make the
interface in the application much simpler. The challenge I face now is to
create a rollback system so that when a revision is deleted, the data in the
actual information table is rolled back to its state prior to the revision
that was just deleted. I set up foreign keys in the revision table so it
would cause a chain reaction and delete all revisions on that same document
after the one to be deleted, but this is where it stops functioning as I
need it to.

PostgreSQL deletes the requested row first, then cascades to the next row,
which triggers a cascade to the next, and so on. For my rollback, however, I
need to be able to delete the last revision first, and rollback one revision
at a time until the initially specified revision is deleted.

Is there a way to instruct PostgreSQL to perform the cascade in reverse
order like this, or do I need to create a seperate function to search for
and delete the revisions without the aid of the foreign key? Any help in
this area would be greatly appreciated.

Thank you,
Marty Alchin

_________________________________________________________________
Overwhelmed by debt? Find out how to Dig Yourself Out of Debt from MSN
Money. http://special.msn.com/money/0407debt.armx

Browse pgsql-general by date

  From Date Subject
Next Message John Sidney-Woollett 2004-07-28 13:43:03 Re: altering a starting value of "serial" macro
Previous Message Prabu Subroto 2004-07-28 13:20:43 Re: altering a table to set serial function