commit 2dbf82c73bd5f7644d06f7ddc1b24941dfa6d44b
parent bb60c5298a0a562244e57b989e3bfcf5c57f832d
Author: Florian Dold <dold@taler.net>
Date: Sun, 6 Sep 2026 12:41:06 +0200
charities: return a conflict when issued receipts prevent deletion
Handle PostgreSQL restrict_violation for the ON DELETE RESTRICT receipt
reference, so refusing deletion follows the existing conflict response.
Diffstat:
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/src/donaudb/delete_charity.sql b/src/donaudb/delete_charity.sql
@@ -28,7 +28,7 @@ BEGIN
WHERE charity_id=in_charity_id;
out_found = FOUND;
EXCEPTION
- WHEN foreign_key_violation THEN
+ WHEN foreign_key_violation OR restrict_violation THEN
-- receipts_issued references this charity with ON DELETE RESTRICT,
-- because receipts_issued.receipt_hash is the idempotence key of
-- POST /batch-issue and must outlive the charity row.