URGENT: undoing a mistake

From: Andrew Perrin <clists(at)perrin(dot)socsci(dot)unc(dot)edu>
To: pgsql-admin(at)postgresql(dot)org
Subject: URGENT: undoing a mistake
Date: 2002-10-30 20:53:15
Message-ID: Pine.LNX.4.21.0210301550570.690-100000@perrin.socsci.unc.edu
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-admin

Folks,

I just made a mistake that could be quite costly: I did this:

update writer_survey set partid='W41308' where survid in (select survid
from participants where partid='W41291' limit 1);

when I should have done this:

update writer_survey set partid='W41308' where survid in (select survid
from writer_survey where partid='W41291' limit 1);

Is there any way I can undo this, e.g., set partid back to what it was
before I ran this command? I know I should have done it in a transaction,
but I didn't.

More broadly, can someone explain why it worked? There is no survid column
in participants, so I would have expected it to generate an error on the
sub-select, not match all rows!

Thanks for any help.

----------------------------------------------------------------------
Andrew J Perrin - http://www.unc.edu/~aperrin
Assistant Professor of Sociology, U of North Carolina, Chapel Hill
clists(at)perrin(dot)socsci(dot)unc(dot)edu * andrew_perrin (at) unc.edu

Responses

Browse pgsql-admin by date

  From Date Subject
Next Message John Sequeira 2002-10-30 21:27:33 HA for high insert volume
Previous Message Tom Lane 2002-10-30 19:09:32 Re: Behaviour patterns on pgsql (7.1.3)