* Build equality expression that can be evaluated using ExecQual(), returning * true if the expression context's inner/outer tuples are equal. Datums in * the inner/outer slots are assumed to be in the same order and quantity as * the 'eqfunctions' parameter. NULLs are treated as equal. * * desc: tuple descriptor of the to-be-compared tuples * lops: the slot ops for the inner tuple slots
| 4189 | * parent: parent executor node |
| 4190 | */ |
| 4191 | ExprState * |
| 4192 | ExecBuildParamSetEqual(TupleDesc desc, |
| 4193 | const TupleTableSlotOps *lops, |
| 4194 | const TupleTableSlotOps *rops, |
| 4195 | const Oid *eqfunctions, |
| 4196 | const Oid *collations, |
| 4197 | const List *param_exprs, |
| 4198 | PlanState *parent) |
| 4199 | { |
| 4200 | ExprState *state = makeNode(ExprState); |
| 4201 | ExprEvalStep scratch = {0}; |
| 4202 | int maxatt = list_length(param_exprs); |
| 4203 | List *adjust_jumps = NIL; |
| 4204 | ListCell *lc; |
| 4205 | |
| 4206 | state->expr = NULL; |
| 4207 | state->flags = EEO_FLAG_IS_QUAL; |
| 4208 | state->parent = parent; |
| 4209 | |
| 4210 | scratch.resvalue = &state->resvalue; |
| 4211 | scratch.resnull = &state->resnull; |
| 4212 | |
| 4213 | /* push deform steps */ |
| 4214 | scratch.opcode = EEOP_INNER_FETCHSOME; |
| 4215 | scratch.d.fetch.last_var = maxatt; |
| 4216 | scratch.d.fetch.fixed = false; |
| 4217 | scratch.d.fetch.known_desc = desc; |
| 4218 | scratch.d.fetch.kind = lops; |
| 4219 | if (ExecComputeSlotInfo(state, &scratch)) |
| 4220 | ExprEvalPushStep(state, &scratch); |
| 4221 | |
| 4222 | scratch.opcode = EEOP_OUTER_FETCHSOME; |
| 4223 | scratch.d.fetch.last_var = maxatt; |
| 4224 | scratch.d.fetch.fixed = false; |
| 4225 | scratch.d.fetch.known_desc = desc; |
| 4226 | scratch.d.fetch.kind = rops; |
| 4227 | if (ExecComputeSlotInfo(state, &scratch)) |
| 4228 | ExprEvalPushStep(state, &scratch); |
| 4229 | |
| 4230 | for (int attno = 0; attno < maxatt; attno++) |
| 4231 | { |
| 4232 | Form_pg_attribute att = TupleDescAttr(desc, attno); |
| 4233 | Oid foid = eqfunctions[attno]; |
| 4234 | Oid collid = collations[attno]; |
| 4235 | FmgrInfo *finfo; |
| 4236 | FunctionCallInfo fcinfo; |
| 4237 | AclResult aclresult; |
| 4238 | |
| 4239 | /* Check permission to call function */ |
| 4240 | aclresult = pg_proc_aclcheck(foid, GetUserId(), ACL_EXECUTE); |
| 4241 | if (aclresult != ACLCHECK_OK) |
| 4242 | aclcheck_error(aclresult, OBJECT_FUNCTION, get_func_name(foid)); |
| 4243 | |
| 4244 | InvokeFunctionExecuteHook(foid); |
| 4245 | |
| 4246 | /* Set up the primary fmgr lookup information */ |
| 4247 | finfo = palloc0(sizeof(FmgrInfo)); |
| 4248 | fcinfo = palloc0(SizeForFunctionCallInfo(2)); |
no test coverage detected