From: Bruce Momjian <pgman@candle.pha.pa.us>
To: Yuji Shinozaki <ys2n@virginia.edu>
Cc: Dave Ewart <Dave.Ewart@cancer.org.uk>
Cc: pgsql-admin@postgresql.org
Subject: Re: "DELETE FROM" protection
Date: Fri, 20 Feb 2004 13:26:41 -0500 (EST)
Message-ID: <200402201826.i1KIQf606802@candle.pha.pa.us> (raw)
In-Reply-To: <Pine.LNX.4.44.0402200823180.21498-100000@atg2000.itc.virginia.edu>
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
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Reply to all the recipients from your mail client; the link fills in
the headers below: reply via email
Some clients, webmail especially, drop In-Reply-To and References from
a link, and the reply then starts a new thread: use the mbox below.
To: pgsql-admin@postgresql.org
Cc: pgman@candle.pha.pa.us, ys2n@virginia.edu, Dave.Ewart@cancer.org.uk
Subject: Re: "DELETE FROM" protection
In-Reply-To: <200402201826.i1KIQf606802@candle.pha.pa.us>
References: <Pine.LNX.4.44.0402200823180.21498-100000@atg2000.itc.virginia.edu> <200402201826.i1KIQf606802@candle.pha.pa.us>
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
This inbox is served by DDX for PostgreSQL; see mirroring instructions
for how to clone and mirror all data and code used for this inbox