commit 8782e65d5e53965459cc3d90efc1270f012ca225
parent 3903c8bae8dadb0887cb9347bcc719b03a2c73a1
Author: Christian Grothoff <christian@grothoff.org>
Date: Wed, 5 Aug 2026 23:01:53 +0200
fix on conflict clause that still referenced removed merchant_serial column
Diffstat:
2 files changed, 48 insertions(+), 1 deletion(-)
diff --git a/src/backenddb/update_unit.sql b/src/backenddb/update_unit.sql
@@ -152,7 +152,7 @@ BEGIN
new_unit_allow_fraction,
new_unit_precision_level,
new_unit_active)
- ON CONFLICT (merchant_serial, builtin_unit_serial)
+ ON CONFLICT (builtin_unit_serial)
DO UPDATE SET override_allow_fraction = EXCLUDED.override_allow_fraction
, override_precision_level = EXCLUDED.override_precision_level
, override_active = EXCLUDED.override_active;
diff --git a/src/testing/test_merchant_api.c b/src/testing/test_merchant_api.c
@@ -878,6 +878,53 @@ run (void *cls,
NULL,
NULL,
MHD_HTTP_CONFLICT),
+ /* Per-instance override of a *builtin* unit (#12); only the policy
+ flags may be changed, hence all name arguments must be NULL. */
+ TALER_TESTING_cmd_merchant_patch_unit ("patch-unit-builtin",
+ merchant_url,
+ "SizeUnitCm",
+ NULL,
+ NULL,
+ NULL,
+ NULL,
+ false,
+ 0,
+ true,
+ MHD_HTTP_NO_CONTENT),
+ TALER_TESTING_cmd_merchant_get_unit ("get-unit-builtin-patched",
+ merchant_url,
+ "SizeUnitCm",
+ MHD_HTTP_OK,
+ "patch-unit-builtin"),
+ /* second PATCH must update the existing override row */
+ TALER_TESTING_cmd_merchant_patch_unit ("patch-unit-builtin-again",
+ merchant_url,
+ "SizeUnitCm",
+ NULL,
+ NULL,
+ NULL,
+ NULL,
+ true,
+ 2,
+ true,
+ MHD_HTTP_NO_CONTENT),
+ TALER_TESTING_cmd_merchant_get_unit ("get-unit-builtin-repatched",
+ merchant_url,
+ "SizeUnitCm",
+ MHD_HTTP_OK,
+ "patch-unit-builtin-again"),
+ /* renaming a builtin unit remains a conflict */
+ TALER_TESTING_cmd_merchant_patch_unit ("patch-unit-builtin-rename-denied",
+ merchant_url,
+ "SizeUnitCm",
+ "centimetres",
+ "cm",
+ NULL,
+ NULL,
+ true,
+ 2,
+ true,
+ MHD_HTTP_CONFLICT),
TALER_TESTING_cmd_merchant_post_units ("post-unit-bucket",
merchant_url,
"BucketCustomUnit",