Received: from malur.postgresql.org ([217.196.149.56]) by arkaria.postgresql.org with esmtps (TLS1.3) tls TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384 (Exim 4.94.2) (envelope-from ) id 1qU7HV-00BiJQ-OF for pgsql-admin@arkaria.postgresql.org; Thu, 10 Aug 2023 15:08:58 +0000 Received: from localhost ([127.0.0.1] helo=malur.postgresql.org) by malur.postgresql.org with esmtp (Exim 4.94.2) (envelope-from ) id 1qU7HU-00GA61-6q for pgsql-admin@arkaria.postgresql.org; Thu, 10 Aug 2023 15:08:56 +0000 Received: from magus.postgresql.org ([2a02:c0:301:0:ffff::29]) by malur.postgresql.org with esmtps (TLS1.3) tls TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384 (Exim 4.94.2) (envelope-from ) id 1qU7HT-00GA5t-Sv for pgsql-admin@lists.postgresql.org; Thu, 10 Aug 2023 15:08:56 +0000 Received: from mail-yw1-x1132.google.com ([2607:f8b0:4864:20::1132]) by magus.postgresql.org with esmtps (TLS1.3) tls TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256 (Exim 4.94.2) (envelope-from ) id 1qU7HS-001iDc-7E for pgsql-admin@lists.postgresql.org; Thu, 10 Aug 2023 15:08:55 +0000 Received: by mail-yw1-x1132.google.com with SMTP id 00721157ae682-5841be7d15eso12459047b3.2 for ; Thu, 10 Aug 2023 08:08:54 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20221208; t=1691680132; x=1692284932; h=in-reply-to:from:references:to:content-language:subject:user-agent :mime-version:date:message-id:from:to:cc:subject:date:message-id :reply-to; bh=jGFxQJbvUrb717smmRRd2C/haEr7G2RvmgcR1bhYSjc=; b=HJ2pdOraTmB5ZrD0tKYhR94IAvARdHZwL9gJ6mbziq9XdYt3lpJsMLgZdIqfni4r2B pdUdFFw2KW2/rW7M3ZcIYa6JAQ5mPx6V5khQwSEBVKUSUHbnKqIZxapB4oEjUl3rEyJg fIFPsAlTcCGHc2ILmG8V9QdWH0HGjAFwc/f6DzL2bjSTWayMjrgmYjYyIj6CWAXREwVF gAnznx52EK4/TLrOO5nSv0FMcwsTRO76pG0xhCu5qXPyYmouw/PMWSRjyvHB/iX8E2Mx XVNf/oRVtXFKj9hGNKcBlqX3WDvF1bRTjCksxhxDLHInDsFVFv74Nsneg6cc3JhtJHqq t9JA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20221208; t=1691680132; x=1692284932; h=in-reply-to:from:references:to:content-language:subject:user-agent :mime-version:date:message-id:x-gm-message-state:from:to:cc:subject :date:message-id:reply-to; bh=jGFxQJbvUrb717smmRRd2C/haEr7G2RvmgcR1bhYSjc=; b=Pj4B5YQ05SXgRzKgHqC6Ov/ajyFIg1cNhmmnQCexr1SwFIkKEuYueSHHxNj9VVUr68 3QN8Lkb5/95ICPm8NmiEAX7UkrEv4deL4KEaUa9ZeQYLuv3d8DSpEfWMRMHqXpAej9MW y6LNSHl77/zGDKAi6AKNdoYETbEC3dMfKpSjPFKkGX5XOHsL32crTUIhdKWFAala0I0q DGTv5bfE1PdUGG2W0r4QOjbf/k2DoY74MDiXx0v2rbIcMKuPO/I2RYx0a8zhREGlTCrU pZn2igbZ0AijkhN+mlZUuub0iMu/hyaVTwYH76/S1Pxm2Qedz7Rpx5VUFMvDoge0J4OD EtFQ== X-Gm-Message-State: AOJu0Yx3Cow2lIHCo0gVaA1XubIpseEYTZXgWpqqmypNbVaw2wxfUJJB JfAx+bLgzpvmayRHra/m3hbl6APnkK8= X-Google-Smtp-Source: AGHT+IFZkgc2DK+sGSli0946LsBORV8VEw05FEH9esxW0msQIliSpuqFoqlaa7glcqX+xDN4ODjwkg== X-Received: by 2002:a81:a50c:0:b0:584:bfd:bb66 with SMTP id u12-20020a81a50c000000b005840bfdbb66mr3388621ywg.30.1691680132295; Thu, 10 Aug 2023 08:08:52 -0700 (PDT) Received: from ?IPV6:2600:1700:bd2c:b810:6075:3f19:4ef7:e118? ([2600:1700:bd2c:b810:6075:3f19:4ef7:e118]) by smtp.googlemail.com with ESMTPSA id x64-20020a818743000000b0058442f46fbfsm392870ywf.44.2023.08.10.08.08.51 for (version=TLS1_3 cipher=TLS_AES_128_GCM_SHA256 bits=128/128); Thu, 10 Aug 2023 08:08:52 -0700 (PDT) Content-Type: multipart/alternative; boundary="------------I9huavXtzGfTL27aU8ZSrpeF" Message-ID: Date: Thu, 10 Aug 2023 10:08:51 -0500 MIME-Version: 1.0 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:102.0) Gecko/20100101 Thunderbird/102.11.0 Subject: Re: Undo Update Content-Language: en-US To: pgsql-admin@lists.postgresql.org References: <89095BFA-4C53-4E34-AB59-F58551B8F909@jakobs.com> From: Ron In-Reply-To: List-Id: List-Help: List-Subscribe: List-Post: List-Owner: List-Archive: Archived-At: Precedence: bulk This is a multi-part message in MIME format. --------------I9huavXtzGfTL27aU8ZSrpeF Content-Type: text/plain; charset=UTF-8; format=flowed Content-Transfer-Encoding: 7bit Ask your database administrator about PITR (Point In Time Recovery). On 8/10/23 04:17, Rajesh Kumar wrote: > In that case, how to take a backup specifically before that update and are > there any prequisites such as stopping the server when it happens? And > then backup like that? > > On Thu, 10 Aug, 2023, 2:36 PM Holger Jakobs, wrote: > > I'm afraid you will have to execute the SQL statement undoing it. Of > you don't know the previous values, you're out of luck. > > Then a backup is your best friend. > > > Am 10. August 2023 11:02:26 MESZ schrieb Rajesh Kumar > : > > Hi friends > > I was given a query to update the record in table A with where > clause. But I executed it in production mistakenly without where > clause so it updated incorrectly for all rows. > > How do I resolve this? > -- Born in Arizona, moved to Babylonia. --------------I9huavXtzGfTL27aU8ZSrpeF Content-Type: text/html; charset=UTF-8 Content-Transfer-Encoding: 7bit Ask your database administrator about PITR (Point In Time Recovery).

On 8/10/23 04:17, Rajesh Kumar wrote:
In that case, how to take a backup specifically before that update and are there any prequisites such as stopping the server when it happens? And then backup like that?

On Thu, 10 Aug, 2023, 2:36 PM Holger Jakobs, <holger@jakobs.com> wrote:
I'm afraid you will have to execute the SQL statement undoing it. Of you don't know the previous values, you're out of luck.

Then a backup is your best friend.


Am 10. August 2023 11:02:26 MESZ schrieb Rajesh Kumar <rajeshkumar.dba09@gmail.com>:
Hi friends

I was given a query to update the record in table A with where clause. But I executed it in production mistakenly without where clause so it updated incorrectly for all rows.

How do I resolve this?

--
Born in Arizona, moved to Babylonia.
--------------I9huavXtzGfTL27aU8ZSrpeF--