pg.ddx.io  pgsql-admin@postgresql.org mailing list archive  
help / color / mirror / Atom feed
From: Scott Marlowe <scott.marlowe@gmail.com>
To: Paul Libbrecht <paul@activemath.org>
Cc: Tom Lane <tgl@sss.pgh.pa.us>
Cc: pgsql-admin@postgresql.org
Subject: Re: accidental drop table recoverable?
Date: Mon, 14 Jul 2008 11:09:39 -0600
Message-ID: <dcc563d10807141009y422ce863v38d45a40ab720962@mail.gmail.com> (raw)
In-Reply-To: <792684B3-32A7-4F9F-ACA2-A682BF35F9E0@activemath.org>
References: <53CDF98F-0AE1-49ED-A2A3-C3B1E2AF2E2E@activemath.org>
	<8259.1216046847@sss.pgh.pa.us>
	<792684B3-32A7-4F9F-ACA2-A682BF35F9E0@activemath.org>

On Mon, Jul 14, 2008 at 9:29 AM, Paul Libbrecht <paul@activemath.org> wrote:
>
> Le 14-juil.-08 à 16:47, Tom Lane a écrit :
>
>> You can't really "rollback" a DROP TABLE --- that corresponds directly
>> to a filesystem remove() call, and no amount of fooling around with the
>> database state will undo that.
>
> That is dark.
> I read yesterday night that actually a vacuum was advised everyday since
> otherwise there was no actual deletion. So you are telling me that, however,
> drop-table does really go to deletion right away?
>
> I'm running 7.4.5 btw.

First off, if you're gonna run 7.4.x then you should REALLY be running
the latest 7.4 version, which is 7.4.21.  You are missing almost 4
years worth of updates, and there ARE dataloss bugs in 7.4.5 which
could bite you.  But that's not the core of your issue here.

When you delete tuples in a table, postgresql doesn't delete the
actual row, it just marks it as deleted / not visible anymore.  Same
goes for the corresponding entries in an index.

Dropping or truncating a table is something else.  Now, if you do:

begin;
drop table yada;
rollback;

you'll still have your table. Same thing goes for truncate.  But once
you commit such a transaction, the table is gone.  Keep in mind that
if you don't start a transaction explicitly, then each command you
type in is a transaction unto itself, and that means that a simple
drop table statement commits as soon as it finishes.



view thread (5+ messages)

Message-ID: <dcc563d10807141009y422ce863v38d45a40ab720962@mail.gmail.com>
Permalink:  ../dcc563d10807141009y422ce863v38d45a40ab720962@mail.gmail.com/
Also on:    postgresql.org/message-id/dcc563d10807141009y422ce863v38d45a40ab720962@mail.gmail.com

 · 

reply

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 using the --to and --cc options:
  reply via email

  To: pgsql-admin@postgresql.org
  Cc: scott.marlowe@gmail.com, paul@activemath.org, tgl@sss.pgh.pa.us
  Subject: Re: accidental drop table recoverable?
  In-Reply-To: <dcc563d10807141009y422ce863v38d45a40ab720962@mail.gmail.com>

* 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