SPUG: perl/psql error

Peter Darley pdarley at kinesis-cem.com
Wed Dec 22 14:59:12 CST 2004


Umar,
	PostgreSQL doesn't currently have a way to recover from an error in a
transaction, so any statement after one that causes an error is rejected and
doesn't do anything if it's in the same transaction.
	Usually DBD::Pg will be set to Autocommit=true, so every time you prepare
and execute a statement, DO a statement, etc. the driver will start a new
transaction for your statement, and this will never come up.
	It seems like you're setting autocommit=false, probably in your connect
statement, or you're sending an explicit 'begin' statement, and not
'commit'ing it.  If you don't need explicit transactions, it's better to
just have autocommit turned on.  If you do need to control your own
transactions (because you're doing related inserts/updates/whatever) you
need to also keep track of any failures, 'rollback' the current transaction,
fix whatever the problem was, and start the transaction over.
	The finish() won't effect this.  If you're seeing this persist past
disconnect()'s, that would be pretty strange.
	If any of this doesn't make any sense, or doesn't fit what you're seeing,
let me know and I can try to help you work out what's going on.
Thanks,
Peter Darley

-----Original Message-----
From: spug-list-bounces at mail.pm.org
[mailto:spug-list-bounces at mail.pm.org]On Behalf Of Umar Cheema
Sent: Wednesday, December 22, 2004 12:23 PM
To: spug-list at mail.pm.org
Subject: SPUG: perl/psql error


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

Has anyone seen this error before?

I am using Perl/DBI with PostgreSQL and it seems like if psql encounters
an error (syntax or even a constraint), it doesn't allow any other
commands/statements to be executed after that?

I am calling finish() and disconnect() appropriately on statement handles
and dbh object.

Any ideas?

Thanks,
Umar

_____________________________________________________________
Seattle Perl Users Group Mailing List
     POST TO: spug-list at mail.pm.org
SUBSCRIPTION: http://mail.pm.org/mailman/listinfo/spug-list
    MEETINGS: 3rd Tuesdays, Location: Amazon.com Pac-Med
    WEB PAGE: http://seattleperl.org/



More information about the spug-list mailing list