Thread: rollback

rollback

From
Oleg Lebedev
Date:
Hi everybody,
I was playing with psql and accidently deleted a couple of records from
my database. I am wondering if there is any way to restore them. I know
that in Oracle you can do 'rollback work' from SQLPlus interface and it
would rollback all the updates done to the database.
I am pretty sure that from now on I would try to revoke permissions to
delete anything from the database from users like myself. What is the
best way to do this?
thanks,

Oleg



Re: rollback

From
Haller Christoph
Date:
> Hi everybody,
> I was playing with psql and accidently deleted a couple of records from
> my database. I am wondering if there is any way to restore them. I know
> that in Oracle you can do 'rollback work' from SQLPlus interface and it
> would rollback all the updates done to the database. 
That's available in PostgreSQL too. 
But, by entering psql autocommit is on by default, meaning every sql 
command is committed at once. 
To enable a rollback in psql you have to enter a transaction explicitly 
by using BEGIN; 
Everything done below BEGIN can be rolled back. 
Try. 

> I am pretty sure that from now on I would try to revoke permissions to
> delete anything from the database from users like myself. What is the
> best way to do this?
Refer to the sql commands GRANT and REVOKE within the documentation. 
Additionally, you should check the CREATE GROUP command. 
Creating groups of users is a very elegant way to grant/revoke 
permissions on objects. 
As far as I know there is no way to revoke delete permissions 
on the database as whole, you have to list all tables you want to 
have delete permissions dropped. 
Regards, Christoph