summaryrefslogtreecommitdiff
path: root/src/exchangedb/plugin_exchangedb_postgres.c
diff options
context:
space:
mode:
authorChristian Grothoff <christian@grothoff.org>2018-03-12 11:39:31 +0100
committerChristian Grothoff <christian@grothoff.org>2018-03-12 11:39:31 +0100
commitcb623d44cba8b60a0d5120dbfeefe93fac2f79ff (patch)
treef0ea72961d56178365aaf1c31ca92c7b7bac48e0 /src/exchangedb/plugin_exchangedb_postgres.c
parenta166ca7fece8bbe3c66dcf0217cc81d20d185ab0 (diff)
downloadexchange-cb623d44cba8b60a0d5120dbfeefe93fac2f79ff.tar.gz
exchange-cb623d44cba8b60a0d5120dbfeefe93fac2f79ff.tar.bz2
exchange-cb623d44cba8b60a0d5120dbfeefe93fac2f79ff.zip
ensure transaction_name is also set for deferred_wire_out transaction, re-use postgres_start logic
Diffstat (limited to 'src/exchangedb/plugin_exchangedb_postgres.c')
-rw-r--r--src/exchangedb/plugin_exchangedb_postgres.c21
1 files changed, 8 insertions, 13 deletions
diff --git a/src/exchangedb/plugin_exchangedb_postgres.c b/src/exchangedb/plugin_exchangedb_postgres.c
index d6a9b283..6c633055 100644
--- a/src/exchangedb/plugin_exchangedb_postgres.c
+++ b/src/exchangedb/plugin_exchangedb_postgres.c
@@ -1560,7 +1560,6 @@ postgres_start (void *cls,
PQerrorMessage (session->conn));
GNUNET_break (0);
PQclear (result);
- session->transaction_name = NULL;
return GNUNET_SYSERR;
}
PQclear (result);
@@ -4852,19 +4851,13 @@ postgres_start_deferred_wire_out (void *cls,
PGresult *result;
ExecStatusType ex;
- result = PQexec (session->conn,
- "START TRANSACTION ISOLATION LEVEL SERIALIZABLE");
- if (PGRES_COMMAND_OK !=
- (ex = PQresultStatus (result)))
- {
- TALER_LOG_ERROR ("Failed to start transaction (%s): %s\n",
- PQresStatus (ex),
- PQerrorMessage (session->conn));
- GNUNET_break (0);
- PQclear (result);
+ postgres_preflight (cls,
+ session);
+ if (GNUNET_OK !=
+ postgres_start (cls,
+ session,
+ "deferred wire out"))
return GNUNET_SYSERR;
- }
- PQclear (result);
result = PQexec (session->conn,
"SET CONSTRAINTS wire_out_ref DEFERRED");
if (PGRES_COMMAND_OK !=
@@ -4875,6 +4868,8 @@ postgres_start_deferred_wire_out (void *cls,
PQerrorMessage (session->conn));
GNUNET_break (0);
PQclear (result);
+ postgres_rollback (cls,
+ session);
return GNUNET_SYSERR;
}
PQclear (result);