Kim Johan Andersson <kimjand@xxxxxxxxx> writes: > So my question here is, how to go about handling the more interesting > cases, where we are passed a FuncExpr (instead of a Const)? > Is it even possible to return something useful in this case? Doesn't look like it to me. You could check whether the RHS is a range constructor function call, but there's a big semantic problem: int4_range(NULL, ...) converts to a range with an infinite bound, not a null bound. So translating that to "indxvar >= NULL" would give the wrong answers. And generally speaking, if the argument isn't a constant then you're not going to be able to be sure that it doesn't produce NULL. I guess you could produce something like indxvar >= coalesce(argument, minimum-value-of-type) in cases where the data type has an identifiable minimum resp. maximum value, but that'd make the whole affair annoyingly data-type-specific. Not sure it's worth going there. regards, tom lane