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

Re: "DELETE FROM" protection

From: "Jeremy Smith" <jer(at)highboard(dot)com>
To: <pgsql-admin(at)postgresql(dot)org>
Subject: Re: "DELETE FROM" protection
Date: 2004-02-20 20:05:07
Message-ID: (view raw, whole thread or download thread mbox)
Lists: pgsql-admin
Great point Bruce,

I hadn't really thought of the semi-colon as a safety mechanism, but I guess
it is.


-----Original Message-----
From: pgsql-admin-owner(at)postgresql(dot)org
[mailto:pgsql-admin-owner(at)postgresql(dot)org]On Behalf Of Bruce Momjian
Sent: Friday, February 20, 2004 1:27 PM
To: Yuji Shinozaki
Cc: Dave Ewart; pgsql-admin(at)postgresql(dot)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
> Putting it in a transaction (BEGIN, COMMIT or ROLLBACK) is probably the
> best practice.

I used to do this with Informix before a DELETE:


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                        |
  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

---------------------------(end of broadcast)---------------------------
TIP 2: you can get off all lists at once with the unregister command
    (send "unregister YourEmailAddressHere" to majordomo(at)postgresql(dot)org)

In response to

pgsql-admin by date

Next:From: Bruno Wolff IIIDate: 2004-02-20 20:11:39
Subject: Re: Index called with Union but not with OR clause
Previous:From: Mitch PirtleDate: 2004-02-20 19:45:38
Subject: Re: database clustering

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