There's already code to effectively handle <> operators. Just the PartClauseInfo.op_is_ne needs to be set to true. get_matching_list_bounds() then handles that by taking the inverse of the partitions matching the equality operator.
Effectively, I think that's the attached patch.
I think there is a thinko here.
+ switch (btest->booltesttype) + { + case IS_NOT_TRUE: + *noteq = true; + /* fall through */ + case IS_TRUE: + *outconst = (Expr *) makeBoolConst(true, false); + break; + case IS_NOT_FALSE: + *noteq = true; + /* fall through */ + case IS_FALSE: + *outconst = (Expr *) makeBoolConst(false, false); + break; + default: + Assert(false); /* hmm? */ + return PARTCLAUSE_UNSUPPORTED; + }
The *outconst should be set to true in case IS_NOT_FALSE and set to false in case IS_NOT_TRUE, something like:
switch (btest->booltesttype) { - case IS_NOT_TRUE: + case IS_NOT_FALSE: *noteq = true; /* fall through */ case IS_TRUE: *outconst = (Expr *) makeBoolConst(true, false); break; - case IS_NOT_FALSE: + case IS_NOT_TRUE: *noteq = true; /* fall through */ case IS_FALSE: