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"
", 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)