Received: from malur.postgresql.org ([217.196.149.56]) by arkaria.postgresql.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_CBC_SHA1:256) (Exim 4.89) (envelope-from ) id 1imL9R-00010g-He for pgsql-general@arkaria.postgresql.org; Tue, 31 Dec 2019 17:17:49 +0000 Received: from localhost ([127.0.0.1] helo=malur.postgresql.org) by malur.postgresql.org with esmtp (Exim 4.89) (envelope-from ) id 1imL9P-0007TR-Dc for pgsql-general@arkaria.postgresql.org; Tue, 31 Dec 2019 17:17:47 +0000 Received: from makus.postgresql.org ([2001:4800:3e1:1::229]) by malur.postgresql.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_CBC_SHA1:256) (Exim 4.89) (envelope-from ) id 1imL9O-0007TK-Ud for pgsql-general@lists.postgresql.org; Tue, 31 Dec 2019 17:17:47 +0000 Received: from mail-oi1-x233.google.com ([2607:f8b0:4864:20::233]) by makus.postgresql.org with esmtps (TLS1.3:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.92) (envelope-from ) id 1imL9M-00071B-Ia for pgsql-general@lists.postgresql.org; Tue, 31 Dec 2019 17:17:45 +0000 Received: by mail-oi1-x233.google.com with SMTP id a67so12037268oib.6 for ; Tue, 31 Dec 2019 09:17:44 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=subject:to:references:from:message-id:date:user-agent:mime-version :in-reply-to:content-language; bh=t/1jwk42UcdMGooGyqXOmrARdmXAta8D2oaa/NqNd48=; b=hsws4pXHGUM7kHYc0CtntBUAVkxPdoM6B5H/KE9ygki6miazsowDw4FhctpPnudfVf UNckxDzzWLb88l7SIQEH8V971i1gNQdeOXpZAZKRV88d1YvY+XFR4ty83jIVYq84LCeo MDh0p1PuhuuP1FolL+o5u3N+8hqV12NUcQoTkjH+XN07m3c7EpnPQro5TpswU9KfrUx0 sSf9r4OkemtXL6BiN0fHtkgQJBTZMxiFkIzqXGKOlYeWpIZ1N2UQ5nShrO17uK10sggw A7ik2TKMzVheBkUqEb+WxXIU5DiwWkIhWKZYDmGI8cpOzaw9SZaQ5I0ECZc80raWwO15 3d8A== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:subject:to:references:from:message-id:date :user-agent:mime-version:in-reply-to:content-language; bh=t/1jwk42UcdMGooGyqXOmrARdmXAta8D2oaa/NqNd48=; b=fnX7EK3VLZozXRy+MgLWJPQGpCh+gYqIw/6hxCOTvL3pMntkig09MWVecqnkYZvM2b syjyIx6IfKLIavNpp26lYkqePxvulA3h99HEjmzDkJp9anxYF3I9dl4JKSfyKWwBva7Z FDP6sb7NI5zCsqhaeowXCCepUjH+iNLxdKP8TbtZMRHX1E1K6iiwU/R0oTq8DOXBw1fv xMBlEu6z81xHhOjOc5dbjiwo+Il/dy+lEGwIuHP1tLcoXG4QiG0QTzt9nhfPDLQZTixE bucTxhXPp1GoCVWIsnpi3JteZ4jACC6QxzfoITAz3ZyB1zPgljph3es2HNhxX1VHvzQj q/lA== X-Gm-Message-State: APjAAAWnYW9f5seG0ZPY/yRpwd4lT2fL/N/v8pgxHTlNxgGkC9n/v/3f N+7j6t7s9rkOn7Z6XgVndxp9aFFuzx8= X-Google-Smtp-Source: APXvYqwpZd1cn1zLU3a4w9YxmKUMjiwdf3nhgA5HAqyAoUxcOiLxRA5fB3h3K2rkNeg8i08UgDbKew== X-Received: by 2002:a05:6808:3d0:: with SMTP id o16mr1034307oie.79.1577812663368; Tue, 31 Dec 2019 09:17:43 -0800 (PST) Received: from [192.168.1.10] (ip70-186-126-197.no.no.cox.net. [70.186.126.197]) by smtp.googlemail.com with ESMTPSA id j20sm17141014otl.5.2019.12.31.09.17.42 for (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Tue, 31 Dec 2019 09:17:42 -0800 (PST) Subject: Re: How to reset a server error '25P02 in_failed_sql_transaction' To: pgsql-general@lists.postgresql.org References: <20191231055501.GA2812@c720-r342378> From: Ron Message-ID: Date: Tue, 31 Dec 2019 11:17:41 -0600 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:60.0) Gecko/20100101 Thunderbird/60.9.0 MIME-Version: 1.0 In-Reply-To: Content-Type: multipart/alternative; boundary="------------8C1B531799232DDF0EE3735E" Content-Language: en-US List-Id: List-Help: List-Subscribe: List-Post: List-Owner: List-Archive: Precedence: bulk This is a multi-part message in MIME format. --------------8C1B531799232DDF0EE3735E Content-Type: text/plain; charset=utf-8; format=flowed Content-Transfer-Encoding: 8bit On 12/31/19 3:40 AM, Guillaume Lelarge wrote: > Le mar. 31 déc. 2019 à 06:55, Matthias Apitz > a écrit : > > > Hello, > > Due to a wrong human input in the GUI of our application our > application server, from the point of view of the PostgreSQL server it > is the PostgreSQL client, issues a broken ESQL/C command to the PostgreSQL > server, here from our own debug 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 )  ORDER BY 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? > > > You need to issue a ROLLBACK. then you'll be able to open another transaction. But how do you issue a ROLLBACK to a different pid? -- Angular momentum makes the world go 'round. --------------8C1B531799232DDF0EE3735E Content-Type: text/html; charset=utf-8 Content-Transfer-Encoding: 8bit On 12/31/19 3:40 AM, Guillaume Lelarge wrote:
Le mar. 31 déc. 2019 à 06:55, Matthias Apitz <guru@unixarea.de> a écrit :

Hello,

Due to a wrong human input in the GUI of our application our
application server, from the point of view of the PostgreSQL server it
is the PostgreSQL client, issues a broken ESQL/C command to the PostgreSQL
server, here from our own debug 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 )   ORDER BY 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?


You need to issue a ROLLBACK. then you'll be able to open another transaction.

But how do you issue a ROLLBACK to a different pid?

--
Angular momentum makes the world go 'round.
--------------8C1B531799232DDF0EE3735E--