X-Original-To: pgsql-admin-postgresql.org@localhost.postgresql.org Received: from localhost (unknown [200.46.204.2]) by svr1.postgresql.org (Postfix) with ESMTP id 6ED80D1CCD7 for ; Fri, 20 Feb 2004 20:05:35 +0000 (GMT) Received: from svr1.postgresql.org ([200.46.204.71]) by localhost (neptune.hub.org [200.46.204.2]) (amavisd-new, port 10024) with ESMTP id 25906-04 for ; Fri, 20 Feb 2004 16:05:27 -0400 (AST) Received: from diver.highboard.com (ns5.highboard.com [207.44.244.101]) by svr1.postgresql.org (Postfix) with ESMTP id 91271D1C511 for ; Fri, 20 Feb 2004 16:05:25 -0400 (AST) Received: from roc-66-67-208-52.rochester.rr.com ([66.67.208.52] helo=swimmer) by diver.highboard.com with asmtp (Exim 4.24) id 1AuGtx-0008FM-LH for pgsql-admin@postgresql.org; Fri, 20 Feb 2004 15:05:33 -0500 Reply-To: From: "Jeremy Smith" To: Subject: Re: "DELETE FROM" protection Date: Fri, 20 Feb 2004 15:05:07 -0500 Message-ID: MIME-Version: 1.0 Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: 7bit X-Priority: 3 (Normal) X-MSMail-Priority: Normal X-Mailer: Microsoft Outlook IMO, Build 9.0.2416 (9.0.2910.0) In-Reply-To: <200402201826.i1KIQf606802@candle.pha.pa.us> Importance: Normal X-MimeOLE: Produced By Microsoft MimeOLE V6.00.2800.1106 X-AntiAbuse: This header was added to track abuse, please include it with any abuse report X-AntiAbuse: Primary Hostname - diver.highboard.com X-AntiAbuse: Original Domain - postgresql.org X-AntiAbuse: Originator/Caller UID/GID - [47 12] / [47 12] X-AntiAbuse: Sender Address Domain - highboard.com X-Virus-Scanned: by amavisd-new at postgresql.org X-Archive-Number: 200402/310 X-Sequence-Number: 12484 Great point Bruce, I hadn't really thought of the semi-colon as a safety mechanism, but I guess it is. Jeremy -----Original Message----- From: pgsql-admin-owner@postgresql.org [mailto:pgsql-admin-owner@postgresql.org]On Behalf Of Bruce Momjian Sent: Friday, February 20, 2004 1:27 PM To: Yuji Shinozaki Cc: Dave Ewart; pgsql-admin@postgresql.org Subject: Re: [ADMIN] "DELETE FROM" protection Yuji Shinozaki wrote: > > I've gotten myself into the habit of always writing out a > > SELECT ... FROM ... WHERE ...; > > first, and then command-line editing it to > > DELETE FROM ... WHERE ...; > > Putting it in a transaction (BEGIN, COMMIT or ROLLBACK) is probably the > best practice. I used to do this with Informix before a DELETE: > SELECT COUNT(*) FROM ... WHERE ...; ^^^^^^^^ and Informix had that "Are your sure" check in dbaccess too, but after I did the COUNT(*), the prompt was just annoying. Also, what interfaces allow you to just press ENTER to send a command? With psql, you have to terminate it with a semicolon or nothing happens. I think there is justification for an "Are you sure" only if a single keystroke sends the command. -- Bruce Momjian | http://candle.pha.pa.us pgman@candle.pha.pa.us | (610) 359-1001 + If your life is a hard drive, | 13 Roberts Road + Christ can be your backup. | Newtown Square, Pennsylvania 19073 ---------------------------(end of broadcast)--------------------------- TIP 2: you can get off all lists at once with the unregister command (send "unregister YourEmailAddressHere" to majordomo@postgresql.org)