Subject: Re: Error while updating a table

From: "[email-masked]" <[email-masked]>
Date: Fri, 18 Apr 2025 11:20:13 +0000 (UTC)

If the query caused an error ....
Does it mean that other reasons might also be there?
Nevertheless, I'll check the log file to find the query...
Happiness Always
BKR Sivaprakash
    On Friday 18 April, 2025 at 03:53:06 pm IST, Laurenz Albe <[email-masked]> wrote:  
 
 On Fri, 2025-04-18 at 07:31 +0000, [email-masked] wrote:
> For the second part, how to identify that culprit query?

If the query caused an error, and you left "log_min_messages" at the
default setting, the error and the statement that caused it should
be in the PostgreSQL log.

Yours,
Laurenz Albe

---

From: "[email-masked]" <[email-masked]>
Date: Sat, 19 Apr 2025 12:38:49 +0000 (UTC)

So far, I couldn't find the query that caused the error.   Is there any way to unlock it?  
Re-start, Format and fresh install of windows, etc. ?
Happiness Always
BKR Sivaprakash
    On Friday 18 April, 2025 at 04:50:52 pm IST, [email-masked] <[email-masked]> wrote:  

Yours,
Laurenz Albe

---

From: Laurenz Albe <[email-masked]>
Date: Sat, 19 Apr 2025 14:55:12 +0200

> Re-start, Format and fresh install of windows, etc. ?

On Windows you have to reboot, bow three times toward sunset,
say a prayer to Bill Gates, then reboot again.

No, seriously: randomly messing around with your machine rarely ever
gets you closer to a solution.

If you get the error

  current transaction is aborted, commands ignored until end of transaction block

it is 100% clear that an earlier statement in the same transaction must
have got an error.  Write your application so that it logs *every* error
that comes from the database, then you are sure to catch that error.

Also, if "log_min_messages" is "warning" (the default) or "error", you
will find the error in the PostgreSQL log.  That's all I can say to you.

Yours,
Laurenz Albe

---

From: "[email-masked]" <[email-masked]>
Date: Sat, 19 Apr 2025 13:06:27 +0000 (UTC)

Thanks Laurenz,
> it is 100% clear that an earlier statement in the same transaction musthave got an error.  Write your application so that it logs *every* error

There is an option to log every sql statement that's executed from the application.  Unfortunately, that option was not set at that time.   Even I enable it now, I can't figure out that error.   By any chance, if I get that statement, what should I do?  What are the Steps (or documentation) to correct this issue?
Happiness Always
BKR Sivaprakash
    On Saturday 19 April, 2025 at 06:25:37 pm IST, Laurenz Albe <[email-masked]> wrote:  

If you get the error

Yours,
Laurenz Albe

---

From: "David G. Johnston" <[email-masked]>
Date: Sat, 19 Apr 2025 06:14:54 -0700

On Sat, Apr 19, 2025 at 6:06 AM [email-masked] <
[email-masked]> wrote:

> By any chance, if I get that statement, what should I do?
>

Read it.

What are the Steps (or documentation) to correct this issue?
Impossible to say until the statement is read.

David J.

---

From: "Andy Huang" <[email-masked]>
Date: Sat, 19 Apr 2025 21:24:11 +0800

I suggest to correct you application code first to log this error out in your application, the following picture is our code which can catch these kind of issue, and log it in the application log files.

------------------&nbsp;原始邮件&nbsp;------------------
发件人:                                                                                                                        "David G. Johnston"                                                                                    <[email-masked]&gt;;
发送时间:&nbsp;2025年4月19日(星期六) 晚上9:14
收件人:&nbsp;"[email-masked]"<[email-masked]&gt;;
抄送:&nbsp;"Pgsql-general"<[email-masked]&gt;;"Laurenz Albe"<[email-masked]&gt;;
主题:&nbsp;Re: Error while updating a table

On Sat, Apr 19, 2025 at 6:06 AM [email-masked] <[email-masked]&gt; wrote:

By any chance, if I get that statement, what should I do?&nbsp; 

Read it.

Impossible&nbsp;to say until the statement is read.

David J.

---

From: "Peter J. Holzer" <[email-masked]>
Date: Sat, 19 Apr 2025 21:42:03 +0200

On 2025-04-19 13:06:27 +0000, [email-masked] wrote:
> There is an option to log every sql statement that's executed from the
> application.  Unfortunately, that option was not set at that time.

You don't have to log every sql statement. Just the ones which cause
errors. As Laurenz mentioned, that happens automatically with the
default settings.

> Even I enable it now, I can't figure out that error.   

Just search the logs for the string "ERROR".

> By any chance, if I get that statement, what should I do?

1) Read the error message.
2) Figure out what caused the error
3) Fix the problem

        hjp

-- 
   _  | Peter J. Holzer    | Story must make more sense than reality.
|_|_) |                    |
| |   | [email-masked]         |    -- Charles Stross, "Creative writing
__/   | http://www.hjp.at/ |       challenge!"