diff options
author | Christian Grothoff <christian@grothoff.org> | 2021-10-29 19:13:47 +0200 |
---|---|---|
committer | Christian Grothoff <christian@grothoff.org> | 2021-10-29 19:13:47 +0200 |
commit | 22e7dabef196b968ae78333cf7e760bef16b2490 (patch) | |
tree | ffdbd361b37fd779c3e1834b5afd3085511aa49a /src/exchangedb/plugin_exchangedb_postgres.c | |
parent | 08b23fb70ad1bd0fd024ab81be50f8daf04eb8b2 (diff) | |
download | exchange-22e7dabef196b968ae78333cf7e760bef16b2490.tar.xz |
sql fixes
Diffstat (limited to 'src/exchangedb/plugin_exchangedb_postgres.c')
-rw-r--r-- | src/exchangedb/plugin_exchangedb_postgres.c | 13 |
1 files changed, 7 insertions, 6 deletions
diff --git a/src/exchangedb/plugin_exchangedb_postgres.c b/src/exchangedb/plugin_exchangedb_postgres.c index 27870f524..ab84ddfc4 100644 --- a/src/exchangedb/plugin_exchangedb_postgres.c +++ b/src/exchangedb/plugin_exchangedb_postgres.c @@ -361,8 +361,9 @@ prepare_statements (struct PostgresClosure *pg) ",kyc_ok" ",wire_target_serial_id AS payment_target_uuid" " FROM reserves" - " JOIN reserves_in USING (reserve_uuid)" - " JOIN wire_targets USING (wire_target_serial_id)" + " JOIN reserves_in ri USING (reserve_uuid)" + " JOIN wire_targets wt " + " ON (ri.wire_source_serial_id = wt.wire_target_serial_id)" " WHERE reserve_pub=$1" " LIMIT 1;", 1), @@ -375,7 +376,7 @@ prepare_statements (struct PostgresClosure *pg) /* Used in #postgres_get_kyc_status() */ GNUNET_PQ_make_prepare ("get_kyc_status", "SELECT" - ",kyc_ok" + " kyc_ok" ",wire_target_serial_id AS payment_target_uuid" " FROM wire_targets" " WHERE payto_uri=$1" @@ -384,7 +385,7 @@ prepare_statements (struct PostgresClosure *pg) /* Used in #postgres_select_kyc_status() */ GNUNET_PQ_make_prepare ("select_kyc_status", "SELECT" - ",kyc_ok" + " kyc_ok" ",h_payto" " FROM wire_targets" " WHERE" @@ -400,10 +401,10 @@ prepare_statements (struct PostgresClosure *pg) ") VALUES " "($1)" " ON CONFLICT (wire_target_serial_id) DO " - " (SELECT " + "(SELECT " " kyc_ok" " ,wire_target_serial_id" - " )" + ")" " RETURNING " " FALSE AS kyc_ok" " wire_target_serial_id;", |