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

Function binary_oper_exact

src/backend/parser/parse_oper.c:273–309  ·  view source on GitHub ↗

binary_oper_exact() * Check for an "exact" match to the specified operand types. * * If one operand is an unknown literal, assume it should be taken to be * the same type as the other operand for this purpose. Also, consider * the possibility that the other operand is a domain type that needs to * be reduced to its base type to find an "exact" match. */

Source from the content-addressed store, hash-verified

271 * be reduced to its base type to find an "exact" match.
272 */
273static Oid
274binary_oper_exact(List *opname, Oid arg1, Oid arg2)
275{
276 Oid result;
277 bool was_unknown = false;
278
279 /* Unspecified type for one of the arguments? then use the other */
280 if ((arg1 == UNKNOWNOID) && (arg2 != InvalidOid))
281 {
282 arg1 = arg2;
283 was_unknown = true;
284 }
285 else if ((arg2 == UNKNOWNOID) && (arg1 != InvalidOid))
286 {
287 arg2 = arg1;
288 was_unknown = true;
289 }
290
291 result = OpernameGetOprid(opname, arg1, arg2);
292 if (OidIsValid(result))
293 return result;
294
295 if (was_unknown)
296 {
297 /* arg1 and arg2 are the same here, need only look at arg1 */
298 Oid basetype = getBaseType(arg1);
299
300 if (basetype != arg1)
301 {
302 result = OpernameGetOprid(opname, basetype, basetype);
303 if (OidIsValid(result))
304 return result;
305 }
306 }
307
308 return InvalidOid;
309}
310
311
312/* oper_select_candidate()

Callers 1

operFunction · 0.85

Calls 2

OpernameGetOpridFunction · 0.85
getBaseTypeFunction · 0.85

Tested by

no test coverage detected