Re: canceling a delete

From: "David G(dot) Johnston" <david(dot)g(dot)johnston(at)gmail(dot)com>
To: "Campbell, Lance" <lance(at)illinois(dot)edu>
Cc: "pgsql-admin(at)postgresql(dot)org" <pgsql-admin(at)postgresql(dot)org>
Subject: Re: canceling a delete
Date: 2016-05-19 19:10:41
Message-ID: CAKFQuwaetkGycZgtdjDpJCXwpUf8+vQ2pD487X9Xa3pYxu5P4w@mail.gmail.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-admin

On Thu, May 19, 2016 at 2:44 PM, Campbell, Lance <lance(at)illinois(dot)edu> wrote:

> PostgreSQL 9.5.x
>
>
>
> I logged onto PostgreSQL. I did a command:
>
>
>
> Delete from some_table;
>
>
>
> I realized that I should have had a where clause. So I canceled the
> delete with CTRL-C. PostgreSQL said to canceled the delete.
>
>
>
> Did PostgreSQL delete any records?
>
>
>

​Mostly what Kevin said - though the first thing you should consider doing
next time is "BEGIN;"

A single statement either succeeds or fails atomically - so either it
deleted ALL records or none.

Once within a transaction you get to change your mind up until you issue a
"COMMIT;"

David J.

In response to

Browse pgsql-admin by date

  From Date Subject
Next Message Dave Johansen 2016-05-19 19:42:26 NO INHERIT and prepared statements?
Previous Message Campbell, Lance 2016-05-19 19:09:35 Re: canceling a delete