From b9c602c7e47019e7742a89e77f1d22e8eff8bb76 Mon Sep 17 00:00:00 2001 From: Christian Decker Date: Thu, 7 Oct 2021 13:30:49 +0200 Subject: [PATCH] db: Fix a syntax error with the optional parameters SQL doesn't really allow `a OR 1` as a clause since `1` is not a boolean expression. Moving it into `a OR 1=1` however is valid again. --- wallet/wallet.c | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/wallet/wallet.c b/wallet/wallet.c index 61e392ab9..5bd20a7bd 100644 --- a/wallet/wallet.c +++ b/wallet/wallet.c @@ -3371,7 +3371,9 @@ wallet_payment_list(const tal_t *ctx, ", partid" ", local_offer_id" " FROM payments" - " WHERE (payment_hash = ? OR ?) AND (status = ? OR ?)" + " WHERE" + " (payment_hash = ? OR 1=?) AND" + " (status = ? OR 1=?)" " ORDER BY id;")); if (payment_hash)