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

Function LookupOperName

src/backend/parser/parse_oper.c:100–137  ·  view source on GitHub ↗

* LookupOperName * Given a possibly-qualified operator name and exact input datatypes, * look up the operator. * * Pass oprleft = InvalidOid for a prefix op. * * If the operator name is not schema-qualified, it is sought in the current * namespace search path. * * If the operator is not found, we return InvalidOid if noError is true, * else raise an error. pstate and location are used

Source from the content-addressed store, hash-verified

98 * error position; pass NULL/-1 if not available.
99 */
100Oid
101LookupOperName(ParseState *pstate, List *opername, Oid oprleft, Oid oprright,
102 bool noError, int location)
103{
104 Oid result;
105
106 result = OpernameGetOprid(opername, oprleft, oprright);
107 if (OidIsValid(result))
108 return result;
109
110 /* we don't use op_error here because only an exact match is wanted */
111 if (!noError)
112 {
113 char oprkind;
114
115 if (!OidIsValid(oprleft))
116 oprkind = 'l';
117 else if (OidIsValid(oprright))
118 oprkind = 'b';
119 else
120 {
121 ereport(ERROR,
122 (errcode(ERRCODE_SYNTAX_ERROR),
123 errmsg("postfix operators are not supported"),
124 parser_errposition(pstate, location)));
125 oprkind = 0; /* keep compiler quiet */
126 }
127
128 ereport(ERROR,
129 (errcode(ERRCODE_UNDEFINED_FUNCTION),
130 errmsg("operator does not exist: %s",
131 op_signature_string(opername, oprkind,
132 oprleft, oprright)),
133 parser_errposition(pstate, location)));
134 }
135
136 return InvalidOid;
137}
138
139/*
140 * LookupOperWithArgs

Callers 4

DefineOpClassFunction · 0.85
LookupOperWithArgsFunction · 0.85
AggregateCreateFunction · 0.85
OperatorLookupFunction · 0.85

Calls 5

OpernameGetOpridFunction · 0.85
parser_errpositionFunction · 0.85
op_signature_stringFunction · 0.85
errcodeFunction · 0.50
errmsgFunction · 0.50

Tested by

no test coverage detected