RE: How to reset a server error '25P02 in_failed_sql_transaction' - Mailing list pgsql-general

From Patrick FICHE
Subject RE: How to reset a server error '25P02 in_failed_sql_transaction'
Date
Msg-id VI1PR0501MB26698E93A206543AE9F497BCEF260@VI1PR0501MB2669.eurprd05.prod.outlook.com
Whole thread Raw
In response to How to reset a server error '25P02 in_failed_sql_transaction'  (Matthias Apitz <guru@unixarea.de>)
Responses Re: How to reset a server error '25P02 in_failed_sql_transaction'  (Matthias Apitz <guru@unixarea.de>)
List pgsql-general
Hi,

Which behavior are you looking for ?
If you want the following statements to succeed, I guess that you don't want to be in a transaction context.
In this case, you should have a look at the following link : https://www.postgresql.org/docs/11/ecpg-commands.html
By default, the AUTOCOMMIT is OFF but you can set it to ON and it should solve your issue as only explicit transactions
willkeep a transaction context.
 

Regards,

Patrick Fiche
Database Engineer, Aqsacom Sas.
c. 33 6 82 80 69 96 



-----Original Message-----
From: Matthias Apitz <guru@unixarea.de> 
Sent: Tuesday, December 31, 2019 6:55 AM
To: pgsql-general@lists.postgresql.org
Subject: How to reset a server error '25P02 in_failed_sql_transaction'


Hello,

Due to a wrong human input in the GUI of our application our application server, from the point of view of the
PostgreSQLserver it is the PostgreSQL client, issues a broken ESQL/C command to the PostgreSQL server, here from our
owndebug logging the command and the error message of the server:
 


posDebug: [27.12.2019 15:20:59:043] stmt: SELECT ctid, * from titel_datum WHERE desk>='*2019' AND feldnr IN ( 2 )
ORDERBY desk ASC , feldnr ASC
 
posDebug: [27.12.2019 15:20:59:043] ESQL: PREPARE sid_titel_datum  FROM :select_anw; ==== sqlca ====
sqlcode: -400
sqlerrm.sqlerrml: 61
sqlerrm.sqlerrmc: invalid input syntax for type date: »*2019« on line 918 ...

All subsequent correct (SELECT ...) statements get rejected with, for example: 


...
posDebug: [27.12.2019 15:20:59:044] stmt: SELECT ctid, * from titel_datum WHERE desk>='31.12.1900' AND feldnr IN ( 2 )
ORDER BY desk ASC , feldnr ASC
 
posDebug: [27.12.2019 15:20:59:044] ESQL: PREPARE sid_titel_datum  FROM :select_anw; ==== sqlca ====
sqlcode: -400
sqlerrm.sqlerrml: 105
sqlerrm.sqlerrmc: current transaction is aborted, commands ignored until end of transaction block on line 918
sqlerrd: 0 0 0 0 0 0
sqlwarn: 0 0 0 0 0 0 0 0
sqlstate: 25P02
========posSqlError=======
...

Note: we are not in some kind TRANSACTION block, like 'EXEC SQL BEGIN TRANSACTION;'

What is the correct way to abort the "transaction" as requested by the PG server to return to normal operations?

Thanks

    matthias

--
Matthias Apitz, ✉ guru@unixarea.de, http://www.unixarea.de/ +49-176-38902045 Public GnuPG key:
http://www.unixarea.de/key.pub



pgsql-general by date:

Previous
From: Guillaume Lelarge
Date:
Subject: Re: How to reset a server error '25P02 in_failed_sql_transaction'
Next
From: Sonam Sharma
Date:
Subject: Pg import access