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 A0CA6D1E12C for ; Fri, 20 Feb 2004 18:27:04 +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 84130-10 for ; Fri, 20 Feb 2004 14:26:55 -0400 (AST) Received: from candle.pha.pa.us (candle.pha.pa.us [207.106.42.251]) by svr1.postgresql.org (Postfix) with ESMTP id E01A8D1E12E for ; Fri, 20 Feb 2004 14:26:52 -0400 (AST) Received: (from pgman@localhost) by candle.pha.pa.us (8.11.6/8.11.6) id i1KIQf606802; Fri, 20 Feb 2004 13:26:41 -0500 (EST) From: Bruce Momjian Message-Id: <200402201826.i1KIQf606802@candle.pha.pa.us> Subject: Re: "DELETE FROM" protection In-Reply-To: To: Yuji Shinozaki Date: Fri, 20 Feb 2004 13:26:41 -0500 (EST) Cc: Dave Ewart , pgsql-admin@postgresql.org X-Mailer: ELM [version 2.4ME+ PL108 (25)] MIME-Version: 1.0 Content-Transfer-Encoding: 7bit Content-Type: text/plain; charset=US-ASCII X-Virus-Scanned: by amavisd-new at postgresql.org X-Archive-Number: 200402/292 X-Sequence-Number: 12466 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