Re: "DELETE FROM" protection - Mailing list pgsql-admin

From Bruce Momjian
Subject Re: "DELETE FROM" protection
Date
Msg-id 200402201826.i1KIQf606802@candle.pha.pa.us
Whole thread Raw
In response to Re: "DELETE FROM" protection  (Yuji Shinozaki <ys2n@virginia.edu>)
Responses Re: "DELETE FROM" protection
List pgsql-admin
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

pgsql-admin by date:

Previous
From: Andrew Sullivan
Date:
Subject: Re: Panic involving a LC_COLLATE issue
Next
From: "Jeremy Smith"
Date:
Subject: PosgreSQL hogging resources?