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.
This commit is contained in:
Christian Decker
2021-10-07 13:30:49 +02:00
committed by Rusty Russell
parent 8d3861ee29
commit b9c602c7e4

View File

@@ -3371,7 +3371,9 @@ wallet_payment_list(const tal_t *ctx,
", partid" ", partid"
", local_offer_id" ", local_offer_id"
" FROM payments" " FROM payments"
" WHERE (payment_hash = ? OR ?) AND (status = ? OR ?)" " WHERE"
" (payment_hash = ? OR 1=?) AND"
" (status = ? OR 1=?)"
" ORDER BY id;")); " ORDER BY id;"));
if (payment_hash) if (payment_hash)