Re: help:how to rollback postgresql to several minutes ago

Lists: pgsql-bugs
From: 刘剑 <liujian(at)raintai(dot)com>
To: pgsql-bugs <pgsql-bugs(at)postgresql(dot)org>
Subject: help:how to rollback postgresql to several minutes ago
Date: 2016-04-14 10:06:07
Message-ID: tencent_2C58D0DB56887C4823E090B2@qq.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Lists: pgsql-bugs

hello

please help,

I had written an update sql without where condition to my table, then updated whole table.
So how can i rollback this?

thank you very much.


From: Michael Paquier <michael(dot)paquier(at)gmail(dot)com>
To: 刘剑 <liujian(at)raintai(dot)com>
Cc: pgsql-bugs <pgsql-bugs(at)postgresql(dot)org>
Subject: Re: help:how to rollback postgresql to several minutes ago
Date: 2016-04-14 12:23:31
Message-ID: CAB7nPqSE0qU3NLeoVB8OdmEpndgFdMYLysr5jQ=JDT1Js9S=0w@mail.gmail.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Lists: Postg토토SQL : Postg토토SQL 메일 링리스트 : 2016-04-14 이후 PGSQL-BUGS 12:23

On Thu, Apr 14, 2016 at 7:06 PM, 刘剑 <liujian(at)raintai(dot)com> wrote:
> I had written an update sql without where condition to my table, then
> updated whole table.
> So how can i rollback this?

You need to roll in a backup I am afraid, and you should always have
some. Postgres has no way to replay back directly WAL records, it can
only forward replay. In such circumstances standby nodes with a delay
when applying WAL are useful.
--
Michael


From: Michael Paquier <michael(dot)paquier(at)gmail(dot)com>
To: 刘剑 <liujian(at)raintai(dot)com>
Cc: pgsql-bugs <pgsql-bugs(at)postgresql(dot)org>
Subject: Re: help:how to rollback postgresql to several minutes ago
Date: 2016-04-14 12:24:22
Message-ID: CAB7nPqRq6FfdQOte72xcsypc9wAtgzHHEpVKU+kocGsCf2WKBA@mail.gmail.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Lists: pgsql-bugs

On Thu, Apr 14, 2016 at 9:23 PM, Michael Paquier
<michael(dot)paquier(at)gmail(dot)com> wrote:
> On Thu, Apr 14, 2016 at 7:06 PM, 刘剑 <liujian(at)raintai(dot)com> wrote:
>> I had written an update sql without where condition to my table, then
>> updated whole table.
>> So how can i rollback this?
>
> You need to roll in a backup I am afraid, and you should always have
> some. Postgres has no way to replay back directly WAL records, it can
> only forward replay. In such circumstances standby nodes with a delay
> when applying WAL are useful.

By the way, this is not a bug. Such basic questions had better be
asked on pgsql-novice.
--
Michael