public inbox for [email protected]  
help / color / mirror / Atom feed
Re:  Error while updating a table
2+ messages / 2 participants
[nested] [flat]

* Re:  Error while updating a table
@ 2025-04-18 07:31 [email protected] <[email protected]>
  2025-04-18 09:58 ` Re:  Error while updating a table Laurenz Albe <[email protected]>
  0 siblings, 1 reply; 2+ messages in thread

From: [email protected] @ 2025-04-18 07:31 UTC (permalink / raw)
  To: pgsql-general; Laurenz Albe <[email protected]>

 Thanks Laurenz,
Now I need to do 2 things.
1.  Correct my application to catch errors and do either Rollback or commit.   This part is running smoothly from all other computers, so far.  Nevertheless I'll check that for any missing catch.2.  Find the faulty entry and do rectify.
For the second part, how to identify that culprit query?   Seems this has happened a few days back.  At that time, we had some power issues that made network to fail.  
To proceed, we need to find the culprit query?  How? Where?  No idea what was the pid then, as all computers were shut down every night.
Any possibilities?  steps?
Happiness Always
BKR Sivaprakash

    On Friday 18 April, 2025 at 12:24:54 pm IST, Laurenz Albe <[email protected]> wrote:  
 
 On Fri, 2025-04-18 at 05:49 +0000, [email protected] wrote:
> We use PowerBuilder along with PostgreSQL.
> 
> PostgreSQL 15.7 (Ubuntu 15.7-1.pgdg24.04+1) on x86_64-pc-linux-gnu, compiled by gcc (Ubuntu 13.2.0-23ubuntu4) 13.2.0, 64-bit
> 
> Suddenly, one system starts throwing an error while updating a record from PowerBuilder.
> The same update statement (window) works fine, when run from other computers.  Error
> occurs only when the statement is run from a particular computer.  The SQL Statement is
> 
> Update public.co_voucherseries_transaction_branch
> Set    vouchernumber   = <new number>
> Where  companycode     = '100'
> And    branchcode      = '001'
> And    accountperiodid = 1
> And    voucherseries   = 'SERIES'
> And    voucherversion  = 'version'
> And    activestatus    = 'Y'  ;
> 
> The error is
> SQLSTATE=25P02
> ERROR: current transaction is aborted, commands ignored until end of transaction block;
> Error while executing the query
> 
> Through googling, I found that last transaction was not properly rolled back.
> The (Postgresql) Linux server will be shut down every night and re-booted next day morning.   
> 
> Don't know when this error has occurred.  
> 
> Now I need to rectify this error?  How to do it?  Any help is really appreciated.

You would have to improve the code quality of the application, which does not seem
to do correct error handling or transaction management.

That error means that the *previous* statement (or one of the statements earlier in
the same database transaction) has caused an error.  In PostgreSQL, that means that
the transaction is aborted, and the following statements until the end of the
transaction will receive the error you experience.

So one of the following must be the case:

- the previous statement caused an error, but you didn't detect or handle that

- the previous transaction run on the same database connection caused an error,
  but you forgot to run ROLLBACK

Yours,
Laurenz Albe


  

^ permalink  raw  reply  [nested|flat] 2+ messages in thread

* Re:  Error while updating a table
  2025-04-18 07:31 Re:  Error while updating a table [email protected] <[email protected]>
@ 2025-04-18 09:58 ` Laurenz Albe <[email protected]>
  0 siblings, 0 replies; 2+ messages in thread

From: Laurenz Albe @ 2025-04-18 09:58 UTC (permalink / raw)
  To: [email protected] <[email protected]>; pgsql-general

On Fri, 2025-04-18 at 07:31 +0000, [email protected] 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






^ permalink  raw  reply  [nested|flat] 2+ messages in thread


end of thread, other threads:[~2025-04-18 09:58 UTC | newest]

Thread overview: 2+ messages (download: mbox mbox.gz follow: Atom feed)
-- links below jump to the message on this page --
2025-04-18 07:31 Re:  Error while updating a table [email protected] <[email protected]>
2025-04-18 09:58 ` Laurenz Albe <[email protected]>

This inbox is served by agora; see mirroring instructions
for how to clone and mirror all data and code used for this inbox