MCPcopy Create free account
hub / github.com/apache/cloudberry / compatible_oper

Function compatible_oper

src/backend/parser/parse_oper.c:461–490  ·  view source on GitHub ↗

compatible_oper() * given an opname and input datatypes, find a compatible binary operator * * This is tighter than oper() because it will not return an operator that * requires coercion of the input datatypes (but binary-compatible operators * are accepted). Otherwise, the semantics are the same. */

Source from the content-addressed store, hash-verified

459 * are accepted). Otherwise, the semantics are the same.
460 */
461Operator
462compatible_oper(ParseState *pstate, List *op, Oid arg1, Oid arg2,
463 bool noError, int location)
464{
465 Operator optup;
466 Form_pg_operator opform;
467
468 /* oper() will find the best available match */
469 optup = oper(pstate, op, arg1, arg2, noError, location);
470 if (optup == (Operator) NULL)
471 return (Operator) NULL; /* must be noError case */
472
473 /* but is it good enough? */
474 opform = (Form_pg_operator) GETSTRUCT(optup);
475 if (IsBinaryCoercible(arg1, opform->oprleft) &&
476 IsBinaryCoercible(arg2, opform->oprright))
477 return optup;
478
479 /* nope... */
480 ReleaseSysCache(optup);
481
482 if (!noError)
483 ereport(ERROR,
484 (errcode(ERRCODE_UNDEFINED_FUNCTION),
485 errmsg("operator requires run-time type coercion: %s",
486 op_signature_string(op, 'b', arg1, arg2)),
487 parser_errposition(pstate, location)));
488
489 return (Operator) NULL;
490}
491
492/* compatible_oper_opid() -- get OID of a binary operator
493 *

Callers 1

compatible_oper_opidFunction · 0.85

Calls 7

operFunction · 0.85
IsBinaryCoercibleFunction · 0.85
ReleaseSysCacheFunction · 0.85
op_signature_stringFunction · 0.85
parser_errpositionFunction · 0.85
errcodeFunction · 0.50
errmsgFunction · 0.50

Tested by

no test coverage detected