Re: rollback - Mailing list pgsql-general

From Klint Gore
Subject Re: rollback
Date
Msg-id 48756321.3090505@une.edu.au
Whole thread Raw
In response to Re: rollback  (Adrian Moisey <adrian@careerjunction.co.za>)
List pgsql-general
Adrian Moisey wrote:
> Hi
>
> >>>> I would like to be able to "mark" a point in my postgres database.
> >>>> After that I want to change a few things and "rollback" to that point.
> >>>> Does postgres support such a thing?  Is it possible for me to do this?
> >>> Well, transactions do that. If you want to do this inside a
> >>> transaction, the term you're looking for is "savepoints".
> >> I would like to do this globally over the entire DB, is that possible?
> >
> > Sure. You can start a transaction, create tables, drop tables, do
> > inserts and deletes, update some tables, create and delete functions,
> > triggers, views and schemas. After that, rollback. No problem.
>
> Can I do this outside of a transaction?
>
>
How about
   create database a_copy template = original_database

To recover at later date
  drop database original_database;
  alter database a_copy rename to original_database;

There will be all sorts of issues so it might be impractical depending
on your situation.
- permission (have to be able to create/drop/rename databases)
- concurrency (noone connected for the drop, everything done by anyone
else will be forgotten as well)
- time / capacity (creating a copy of a large database might take a
while and need extra storage)

klint.

--
Klint Gore
Database Manager
Sheep CRC
A.G.B.U.
University of New England
Armidale NSW 2350

Ph: 02 6773 3789
Fax: 02 6773 3266
EMail: kgore4@une.edu.au


pgsql-general by date:

Previous
From: "Joshua D. Drake"
Date:
Subject: Re: Making a RPM installer
Next
From: Tom Lane
Date:
Subject: Re: Making a RPM installer