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

From: DXScale452 <dxscale452(at)yahoo(dot)com>
To: pgsql-general(at)postgresql(dot)org
Subject: ERROR: current transaction is aborted, commands ignored until end of transaction block
Date: 2006-10-16 13:54:31
Message-ID: 20061016135431.74324.qmail@web51611.mail.yahoo.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-general

OS: Linux CentOS 4.4
PostgreSQL Version: 8.1.4
Error: current transaction is aborted, commands ignored until end of transaction block

I have seen this error in your forums... but in those cases... the values being inserted were erronious
.... therefore the transaction aborted

I cannot give the exact details in the code for the sake of confidentiality.
Here is the best example i can give

(ALGORITHMIC FORM)

-----------------------------------------------
-----------------------------------------------
int main()
{
int Ret = 0;
Ret = Connection_function(connection_object);
Check_Return(Ret); // Exit On Any Errors

Ret = Transaction("BEGIN");
Check_Return(Ret);

// Check_Return() will exit on any errors

// Error checking is done after each select or insert....

Ret = Query_SELECT(table1); // if value found in table... dont insert.... else... Insert into table
Check_Return(Ret);
Ret = Query_SELECT(table2); // if value found in table... dont insert.... else... Insert into table
Check_Return(Ret);
Ret = Query_SELECT(table3); // if value found in table... dont insert.... else... Insert into table
Check_Return(Ret);
Ret = Query_SELECT(table4); // if value found in table... dont insert.... else... Insert into table
Check_Return(Ret);

Ret = Transaction("COMMIT");
Check_Return(Ret);

return 0;
}

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

That is basically it.... sorry if its long and if there are any stupid mistakes
this is the quick and dirty version....

Here is my problem....
When i'm inside the transaction block....
It always fails on the second table
during a select query...

even if i output the exact syntax of the insert statement and follow the exact order of inserting....
Then manually insert it into the database With a transaction block .... it doesnt fail...
something to do with the database integration in C++ ?

if if i swap the ordering of any of these tables.... the second in the list always fail...

HERE is the syntax of the statements before the fail
-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_
SELECT value FROM table1
INSERT INTO table1 (numeric_type, value_description) VALUES (0,'Description')
SELECT value FROM table2
ERROR: current transaction is aborted, commands ignored until end of transaction block
-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_

even if i placed table2 first and then table1.... table1 would fail (the second select statement always fails)
the tables are empty to begin with... so in effect... there should be a statement like this instead of the ERROR

At least this is what i expect...
-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_
SELECT value FROM table1

INSERT INTO table1 (numeric_type, value_description) VALUES (0,'Description')

SELECT value FROM table2
INSERT INTO table2 (numeric_type, value_description) VALUES (0,'Description')
-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_

If i remove the transaction block.... everything works without a problem....
these statements dont have bugs... they have been thoroughly checked....
also considering they work without a transaction block tells me the statements are ok....

Please Help.... could this be a bug ?

Thanks in advance,

Regards,
Scale

Responses

Browse pgsql-general by date

  From Date Subject
Next Message Martijn van Oosterhout 2006-10-16 14:19:02 Re: ERROR: current transaction is aborted, commands ignored until end of transaction block
Previous Message Merlin Moncure 2006-10-16 13:31:58 Re: more anti-postgresql FUD