aboutsummaryrefslogtreecommitdiff
path: root/src/exchangedb/pg_select_refunds_by_coin.c
diff options
context:
space:
mode:
Diffstat (limited to 'src/exchangedb/pg_select_refunds_by_coin.c')
-rw-r--r--src/exchangedb/pg_select_refunds_by_coin.c20
1 files changed, 12 insertions, 8 deletions
diff --git a/src/exchangedb/pg_select_refunds_by_coin.c b/src/exchangedb/pg_select_refunds_by_coin.c
index 6510ae4a2..84b63a719 100644
--- a/src/exchangedb/pg_select_refunds_by_coin.c
+++ b/src/exchangedb/pg_select_refunds_by_coin.c
@@ -138,15 +138,19 @@ TEH_PG_select_refunds_by_coin (
// FIXME-Joseph
PREPARE (pg,
"get_refunds_by_coin_and_contract",
+ "WITH rc AS MATERIALIZED("
"SELECT"
- " ref.amount_with_fee_val"
- ",ref.amount_with_fee_frac"
- " FROM refunds ref"
- " JOIN deposits dep"
- " USING (coin_pub,deposit_serial_id)"
- " WHERE ref.coin_pub=$1"
- " AND dep.merchant_pub=$2"
- " AND dep.h_contract_terms=$3;");
+ " * FROM refunds ref"
+ "WHERE ref.coin_pub=$1"
+ "AND dep.merchant_pub=$2"
+ "AND dep.h_contract_terms=$3"
+ ")"
+ "SELECT"
+ " ref.amount_with_fee_val"
+ " ,ref.amount_with_fee_frac"
+ "FROM deposits dep"
+ "JOIN rc"
+ " USING (coin_pub,deposit_serial_id)");
}
qs = GNUNET_PQ_eval_prepared_multi_select (pg->conn,
"get_refunds_by_coin_and_contract",