Received: from localhost (postgresql.org [64.49.215.8]) by postgresql.org (Postfix) with ESMTP id 9C6DF475AE5 for ; Thu, 31 Oct 2002 10:26:52 -0500 (EST) Received: from news.hub.org (news.hub.org [64.49.215.80]) by postgresql.org (Postfix) with ESMTP id 0F732475A1E for ; Thu, 31 Oct 2002 10:26:52 -0500 (EST) Received: by news.hub.org (Postfix, from userid 8) id 3556A3817EE; Thu, 31 Oct 2002 10:26:50 -0500 (EST) Date: Thu, 31 Oct 2002 10:26:26 -0500 From: "Alex J. Avriette" Organization: Avriette Sprocket Destruction Corp. User-Agent: Mozilla/5.0 (Macintosh; U; PPC Mac OS X; en-US; rv:1.2b) Gecko/20021016 X-Accept-Language: en-us, en MIME-Version: 1.0 X-Newsgroups: comp.databases.postgresql.admin Subject: Re: URGENT: undoing a mistake References: In-Reply-To: Content-Type: text/plain; charset=us-ascii; format=flowed Content-Transfer-Encoding: 7bit Message-ID: Lines: 20 X-Complaints-To: abuse@speakeasy.net X-DMCA-Notifications: http://www.giganews.com/info/dmca.html X-Abuse-and-DMCA-Info: Please be sure to forward a copy of ALL headers X-Abuse-and-DMCA-Info: Otherwise we will be unable to process your complaint properly X-Postfilter: 1.1 To: pgsql-admin@postgresql.org X-Virus-Scanned: by AMaViS new-20020517 X-Archive-Number: 200211/15 X-Sequence-Number: 6203 > 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); Ouch. First off, Postgres has transactioning. If you use BEGIN ... [ROLLBACK|COMMIT] you can avoid things like that. (the Perl DBI driver will allow you to do this, check the perldoc page for DBI). As a last resort, you can probably restore from the dump of the table/database you make nightly (riiiight?). Alex