Greg Stark <gsstark@mit.edu> writes:
> Hm. I wonder if there are cases of people using functions like this with
> user-defined volatile functions depending on the function's side effects
> happening the correct number of times. Or do volatile functions not get
> inlined like this?
SQL functions can't have side effects, at least not if they are simple
SELECTs, which is the only kind that gets inlined.
> To do it I think you would need a iseq() function that compared NULLs as being
> equal.
No, just
CASE WHEN (col = checkval) OR (col IS NULL AND checkval IS NULL)...
regards, tom lane