merchant

Merchant backend to process payments, run by merchants
Log | Files | Refs | Submodules | README | LICENSE

commit b09beb56b1be7171e4501c516dd8b3edda4bbcec
parent 4cfb16be3807e0da08ccce8593f9d4e67ba8fbc1
Author: Christian Grothoff <christian@grothoff.org>
Date:   Sat, 18 Apr 2026 23:02:49 +0200

-fix SQL bugs

Diffstat:
Msrc/backenddb/pg_insert_deposit_confirmation.sql | 8++++----
Msrc/backenddb/pg_insert_transfer_details.sql | 4++--
Msrc/backenddb/pg_statistics_examples.sql | 6+++---
Msrc/backenddb/pg_update_product_group.sql | 2+-
Msrc/backenddb/update_product_group.c | 13+++++++------
5 files changed, 17 insertions(+), 16 deletions(-)

diff --git a/src/backenddb/pg_insert_deposit_confirmation.sql b/src/backenddb/pg_insert_deposit_confirmation.sql @@ -158,10 +158,10 @@ ELSE -- Same deposit, but total amount increased, store this! UPDATE merchant_deposit_confirmations - SET total_without_fee = in_total_without_fee - ,exchange_sig = in_exchange_sig - ,signkey_serial = my_signkey_serial; - out_deposit_confirmation_serial = my_record.deposit_confirmation_serial; + SET total_without_fee = in_total_without_fee + ,exchange_sig = in_exchange_sig + ,signkey_serial = my_signkey_serial + WHERE out_deposit_confirmation_serial = my_record.deposit_confirmation_serial; END IF; diff --git a/src/backenddb/pg_insert_transfer_details.sql b/src/backenddb/pg_insert_transfer_details.sql @@ -200,8 +200,8 @@ LOOP PERFORM FROM merchant_deposits md WHERE md.deposit_confirmation_serial=my_decose - AND settlement_retry_needed - OR settlement_wtid IS NULL; + AND (settlement_retry_needed + OR (settlement_wtid IS NULL) ); IF NOT FOUND THEN -- must be all done, clear flag diff --git a/src/backenddb/pg_statistics_examples.sql b/src/backenddb/pg_statistics_examples.sql @@ -56,14 +56,14 @@ VALUES ('deposits' ,'sales (before refunds)' ,'amount' - ,ARRAY(SELECT generate_series (1, 10, 1)) || ARRAY(SELECT generate_series (60, 180, 60)), + ,ARRAY(SELECT generate_series (1, 10, 1)) || ARRAY(SELECT generate_series (60, 180, 60)) ,array_fill (1, ARRAY[10]) || array_fill (5, ARRAY[3]) ), ('products-sold' ,'number of products sold' ,'number' - ,ARRAY(SELECT generate_series (1, 10, 1)) || [60], - ,array_fill (1, ARRAY[10]) || [10] + ,ARRAY(SELECT generate_series (1, 10, 1)) || ARRAY[60] + ,array_fill (1, ARRAY[10]) || ARRAY[10] ) ON CONFLICT DO NOTHING; diff --git a/src/backenddb/pg_update_product_group.sql b/src/backenddb/pg_update_product_group.sql @@ -19,7 +19,7 @@ SET search_path TO merchant; DROP FUNCTION IF EXISTS merchant_do_update_product_group; CREATE FUNCTION merchant_do_update_product_group ( IN in_instance_id TEXT, - IN in_product_group_serial TEXT, + IN in_product_group_serial INT8, IN in_name TEXT, IN in_description TEXT, OUT out_conflict BOOL, diff --git a/src/backenddb/update_product_group.c b/src/backenddb/update_product_group.c @@ -27,12 +27,13 @@ enum GNUNET_DB_QueryStatus -TALER_MERCHANTDB_update_product_group (struct TALER_MERCHANTDB_PostgresContext *pg, - const char *instance_id, - uint64_t product_group_id, - const char *name, - const char *description, - bool *conflict) +TALER_MERCHANTDB_update_product_group ( + struct TALER_MERCHANTDB_PostgresContext *pg, + const char *instance_id, + uint64_t product_group_id, + const char *name, + const char *description, + bool *conflict) { struct GNUNET_PQ_QueryParam params[] = { GNUNET_PQ_query_param_string (instance_id),