summaryrefslogtreecommitdiff
path: root/src/exchangedb/plugin_exchangedb_postgres.c
diff options
context:
space:
mode:
authorChristian Grothoff <christian@grothoff.org>2021-01-10 00:54:12 +0100
committerChristian Grothoff <christian@grothoff.org>2021-01-10 00:54:12 +0100
commitca66a1d1af2412e3ad04c18150db7a259dc69b5e (patch)
tree83421873e49eec67f7012b4e21b21f31a3c9fa3a /src/exchangedb/plugin_exchangedb_postgres.c
parent02ecf68a3d9edde9ef48650f64b7332af845beee (diff)
downloadexchange-ca66a1d1af2412e3ad04c18150db7a259dc69b5e.tar.gz
exchange-ca66a1d1af2412e3ad04c18150db7a259dc69b5e.tar.bz2
exchange-ca66a1d1af2412e3ad04c18150db7a259dc69b5e.zip
fix major bug with SQL statement missing ORDER BY freshcoin_index resulting in possible link failures (but usually lucky with old DB schema)
Diffstat (limited to 'src/exchangedb/plugin_exchangedb_postgres.c')
-rw-r--r--src/exchangedb/plugin_exchangedb_postgres.c9
1 files changed, 7 insertions, 2 deletions
diff --git a/src/exchangedb/plugin_exchangedb_postgres.c b/src/exchangedb/plugin_exchangedb_postgres.c
index d8dbd224..b81fb7c1 100644
--- a/src/exchangedb/plugin_exchangedb_postgres.c
+++ b/src/exchangedb/plugin_exchangedb_postgres.c
@@ -794,7 +794,7 @@ postgres_get_session (void *cls)
",h_coin_ev"
",ev_sig"
") SELECT rcx.melt_serial_id, $2, $3, "
- " denominations_serial, $5, $6, $7 "
+ " denominations_serial, $5, $6, $7"
" FROM denominations"
" CROSS JOIN rcx"
" WHERE denom_pub_hash=$4;",
@@ -1108,7 +1108,7 @@ postgres_get_session (void *cls)
" (SELECT known_coin_id "
" FROM known_coins"
" WHERE coin_pub=$1)"
- " ORDER BY tp.transfer_pub",
+ " ORDER BY tp.transfer_pub, rrc.freshcoin_index ASC",
1),
/* Used in #postgres_lookup_wire_transfer */
GNUNET_PQ_make_prepare ("lookup_transactions",
@@ -2323,6 +2323,11 @@ postgres_preflight (void *cls,
};
(void) cls;
+ if (NULL == session)
+ {
+ GNUNET_break (0);
+ return;
+ }
if (NULL == session->transaction_name)
return; /* all good */
if (GNUNET_OK ==