Hi all;

Attached is a simple patch that sets the state on a failed connection to a
08-class status.

Thanks to RhodiumToad on #postgresql for helping spot the problem.

Best Wishes,
Chris Travers
--- dbdimp.c.old	2009-12-16 17:00:13.861919463 -0800
+++ dbdimp.c	2009-12-16 17:00:24.548918948 -0800
@@ -185,8 +185,8 @@
 	connstatus = PQstatus(imp_dbh->conn);
 	if (CONNECTION_OK != connstatus) {
 		TRACE_PQERRORMESSAGE;
-		pg_error(aTHX_ dbh, connstatus, PQerrorMessage(imp_dbh->conn));
 		strncpy(imp_dbh->sqlstate, "08006", 6); /* "CONNECTION FAILURE" */
+		pg_error(aTHX_ dbh, connstatus, PQerrorMessage(imp_dbh->conn));
 		TRACE_PQFINISH;
 		PQfinish(imp_dbh->conn);
 		sv_free((SV *)imp_dbh->savepoints);

Reply via email to