Skip site navigation (1) Skip section navigation (2)

Re: "DELETE FROM" protection

From: Bruce Momjian <pgman(at)candle(dot)pha(dot)pa(dot)us>
To: Yuji Shinozaki <ys2n(at)virginia(dot)edu>
Cc: Dave Ewart <Dave(dot)Ewart(at)cancer(dot)org(dot)uk>, pgsql-admin(at)postgresql(dot)org
Subject: Re: "DELETE FROM" protection
Date: 2004-02-20 18:26:41
Message-ID: 200402201826.i1KIQf606802@candle.pha.pa.us (view raw or flat)
Thread:
Lists: 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(at)candle(dot)pha(dot)pa(dot)us               |  (610) 359-1001
  +  If your life is a hard drive,     |  13 Roberts Road
  +  Christ can be your backup.        |  Newtown Square, Pennsylvania 19073

In response to

Responses

pgsql-admin by date

Next:From: Jeremy SmithDate: 2004-02-20 18:39:36
Subject: PosgreSQL hogging resources?
Previous:From: Andrew SullivanDate: 2004-02-20 18:23:59
Subject: Re: Panic involving a LC_COLLATE issue

Privacy Policy | About PostgreSQL
Copyright © 1996-2014 The PostgreSQL Global Development Group