Forum OpenACS Q&A: How to: UNDO and Update

Collapse
Posted by Bob OConnor on

OOPS --- I just made a careless error. I updated a bunch of records with Postgres 7.01 psql
update users set my_id =20 where xfield =1;

Is there a way to UNDO this action? I havn't done a Vacuum and will hold off pending a reply... As I understand it, the update actually creates a new row with a new OID and the old row remains marked for deletion.... something like:

select oid, user_id, last_name, first_names
where oid IS DELETED and xfield=1;

So, any "EASY" solutions?

TIA
-Bob

Collapse
Posted by Don Baccus on
No.  PSQL autocommits unless you wrap your commands in BEGIN/END.  Which, BTW, is something I do by habit having been bit in the ass myself by this once.

This may be something we should document since the PG people don't seem to really understand how easy it is for folks used to other database engines to assume that PSQL isn't autocommitting commands that are executed.

SQL*Plus, for instance, doesn't commit until you do an explicit COMMIT or exit the session.