Re: troubleshooting PGError - Mailing list pgsql-general

From David Johnston
Subject Re: troubleshooting PGError
Date
Msg-id 00c301cc9fe4$dc85fc30$9591f490$@yahoo.com
Whole thread Raw
In response to troubleshooting PGError  (slavix <mikerin.slava@gmail.com>)
List pgsql-general
-----Original Message-----
From: pgsql-general-owner@postgresql.org
[mailto:pgsql-general-owner@postgresql.org] On Behalf Of slavix
Sent: Wednesday, November 09, 2011 12:03 AM
To: pgsql-general@postgresql.org
Subject: [GENERAL] troubleshooting PGError

Hello,
I am new to postgres, but need to resolve this error:

PGError: ERROR:  current transaction is aborted, commands ignored until end
of transaction block
: SELECT  1 FROM "trades"  WHERE ("trades"."uuid" =
'bc8d86e6-0a8d-11e1-a345-001d09203579' AND "trades"."id" != 25) LIMIT
1

Don't know what is the problem, tried running the same query in pgAdmin and
the query runs fine..
I don't know what the error actually is since the error message is not
clear. Any ideas on how to investigate this?

thank you.

--------------------------------

The error message is very clear; if you understand what a transaction is.

You are executing a number of statements in a single transaction and one of
previous ones failed.  You should see another error message earlier that was
the true failure.  All this message is saying that because the transaction
had a failure all subsequent statements that belong to the same transaction
will be ignored since, at the end of the transaction, everything is going to
be rolled-back anyway.

If you are still confused you need to provide more details about your
programming environment and all the statements that you are bundling into
the same transaction at the statement shown; and a significant section of
the PostgreSQL log file would help as well.

This normally doesn't show up since you usually want to stop processing a
transaction as soon as a failure occurs.   If you provide the entire
transaction to PostgreSQL all at once then PostgreSQL will normally stop
processing as soon as it encounters an error and will return that error.
However, if you take manual control of the transaction in your programming
environment then if you attempt to execute additional statements even after
an error is thrown PostgreSQL will throw the error you are seeing saying
that, in effect, your attempt to execute a statement is pointless.

David J.




pgsql-general by date:

Previous
From: Alban Hertroys
Date:
Subject: Re: Returning a row from a function with an appended array field
Next
From: "J.V."
Date:
Subject: PostgreSQL uninstall fails