commit 9352178de88df325368c869e7108892ceec9ffbf
parent 5280edff6a66e8e12b84fdbbd1a36a2b5b19dadc
Author: Christian Grothoff <christian@grothoff.org>
Date: Wed, 15 Apr 2026 23:30:17 +0200
fix #11348
Diffstat:
3 files changed, 42 insertions(+), 7 deletions(-)
diff --git a/src/backenddb/insert_instance.c b/src/backenddb/insert_instance.c
@@ -27,12 +27,13 @@
#include "helper.h"
enum GNUNET_DB_QueryStatus
-TALER_MERCHANTDB_insert_instance (struct TALER_MERCHANTDB_PostgresContext *pg,
- const struct TALER_MerchantPublicKeyP *merchant_pub,
- const struct TALER_MerchantPrivateKeyP *merchant_priv,
- const struct TALER_MERCHANTDB_InstanceSettings *is,
- const struct TALER_MERCHANTDB_InstanceAuthSettings *ias,
- bool validation_needed)
+TALER_MERCHANTDB_insert_instance (
+ struct TALER_MERCHANTDB_PostgresContext *pg,
+ const struct TALER_MerchantPublicKeyP *merchant_pub,
+ const struct TALER_MerchantPrivateKeyP *merchant_priv,
+ const struct TALER_MERCHANTDB_InstanceSettings *is,
+ const struct TALER_MERCHANTDB_InstanceAuthSettings *ias,
+ bool validation_needed)
{
struct GNUNET_PQ_QueryParam params[] = {
GNUNET_PQ_query_param_auto_from_type (merchant_pub),
@@ -98,7 +99,7 @@ TALER_MERCHANTDB_insert_instance (struct TALER_MERCHANTDB_PostgresContext *pg,
",validation_needed"
",default_wire_transfer_rounding_interval)"
"VALUES"
- "($1,$2,$3,$4,$5,$6::TEXT::JSONB,$7::TEXT::JSONB,$8,$9,$10,$11,"
+ "($1,$2,$3,LOWER($4),$5,$6::TEXT::JSONB,$7::TEXT::JSONB,$8,$9,$10,$11,"
"$12,$13,$14,$15,$16,$17,$18,$19::time_rounder_interval)");
PREPARE (pg,
"insert_keys",
diff --git a/src/backenddb/sql-schema/merchant-0035.sql b/src/backenddb/sql-schema/merchant-0035.sql
@@ -0,0 +1,33 @@
+--
+-- This file is part of TALER
+-- Copyright (C) 2026 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
+-- Foundation; either version 3, or (at your option) any later version.
+--
+-- TALER is distributed in the hope that it will be useful, but WITHOUT ANY
+-- WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR
+-- A PARTICULAR PURPOSE. See the GNU General Public License for more details.
+--
+-- You should have received a copy of the GNU General Public License along with
+-- TALER; see the file COPYING. If not, see <http://www.gnu.org/licenses/>
+
+-- @file merchant-0035.sql
+-- @brief Force all merchant_ids to be lower-case.
+-- @author Christian Grothoff
+
+BEGIN;
+
+-- Check patch versioning is in place.
+SELECT _v.register_patch('merchant-0035', NULL, NULL);
+
+SET search_path TO merchant;
+
+-- Note: this could theoretically fail if there are
+-- already merchant IDs that only differ by case.
+-- In that case, a manual migration is required.
+UPDATE merchant_instances
+ SET merchant_id = LOWER(merchant_id);
+
+COMMIT;
diff --git a/src/backenddb/sql-schema/meson.build b/src/backenddb/sql-schema/meson.build
@@ -39,6 +39,7 @@ sqlfiles = [
'merchant-0032.sql',
'merchant-0033.sql',
'merchant-0034.sql',
+ 'merchant-0035.sql',
'procedures.sql',
'versioning.sql',
]