first take, kludge solution, sentinel approach(it's imperative that your program should not allow inputting of sentinel value):
select coalesce(a, -2147483648) = coalesce(b, -2147483648) as is_equal -- a little postgresism
let's say you forgot to block the sentinel value on your program, the user inputted -2147483648 on the B field, and A is null. the code above reports true, should report false, should not report true nor null.
what's the most concise way to compare equality on nullable fields? A == B should just report either true or false only, regardless if the field(s) are nullable or not.
Probably IS [NOT] DISTINCT FROM will help here.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With