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 | |
parent | 08b23fb70ad1bd0fd024ab81be50f8daf04eb8b2 (diff) |
sql fixes
Diffstat (limited to 'src/exchangedb')
-rw-r--r-- | src/exchangedb/drop0001.sql | 17 | ||||
-rw-r--r-- | src/exchangedb/plugin_exchangedb_postgres.c | 13 |
2 files changed, 10 insertions, 20 deletions
diff --git a/src/exchangedb/drop0001.sql b/src/exchangedb/drop0001.sql index 507393e57..54338f02c 100644 --- a/src/exchangedb/drop0001.sql +++ b/src/exchangedb/drop0001.sql @@ -1,6 +1,6 @@ -- -- This file is part of TALER --- Copyright (C) 2014--2020 Taler Systems SA +-- Copyright (C) 2014--2021 Taler Systems SA -- -- TALER is free software; you can redistribute it and/or modify it under the -- terms of the GNU General Public License as published by the Free Software @@ -22,25 +22,20 @@ BEGIN; -- Unlike the other SQL files, it SHOULD be updated to reflect the -- latest requirements for dropping tables. - --- Drops for exchange-0003.sql +-- Drops for exchange-0001.sql DROP TABLE IF EXISTS revolving_work_shards CASCADE; - - --- Drops for exchange-0002.sql DROP TABLE IF EXISTS auditors CASCADE; DROP TABLE IF EXISTS auditor_denom_sigs CASCADE; DROP TABLE IF EXISTS exchange_sign_keys CASCADE; DROP TABLE IF EXISTS wire_accounts CASCADE; DROP TABLE IF EXISTS signkey_revocations CASCADE; DROP TABLE IF EXISTS work_shards CASCADE; - --- Drops for 0001.sql DROP TABLE IF EXISTS prewire CASCADE; DROP TABLE IF EXISTS recoup CASCADE; DROP TABLE IF EXISTS recoup_refresh CASCADE; DROP TABLE IF EXISTS aggregation_tracking CASCADE; DROP TABLE IF EXISTS wire_out CASCADE; +DROP TABLE IF EXISTS wire_targets CASCADE; DROP TABLE IF EXISTS wire_fee CASCADE; DROP TABLE IF EXISTS deposits CASCADE; DROP TABLE IF EXISTS refunds CASCADE; @@ -59,11 +54,5 @@ DROP TABLE IF EXISTS denominations CASCADE; -- Unregister patch (exchange-0001.sql) SELECT _v.unregister_patch('exchange-0001'); --- Unregister patch (exchange-0002.sql) -SELECT _v.unregister_patch('exchange-0002'); - --- Unregister patch (exchange-0003.sql) -SELECT _v.unregister_patch('exchange-0003'); - -- And we're out of here... COMMIT; 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;", |