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

Function make_distinct_op

src/backend/parser/parse_expr.c:3114–3140  ·  view source on GitHub ↗

* make the node for an IS DISTINCT FROM operator */

Source from the content-addressed store, hash-verified

3112 * make the node for an IS DISTINCT FROM operator
3113 */
3114static Expr *
3115make_distinct_op(ParseState *pstate, List *opname, Node *ltree, Node *rtree,
3116 int location)
3117{
3118 Expr *result;
3119
3120 result = make_op(pstate, opname, ltree, rtree,
3121 pstate->p_last_srf, location);
3122 if (((OpExpr *) result)->opresulttype != BOOLOID)
3123 ereport(ERROR,
3124 (errcode(ERRCODE_DATATYPE_MISMATCH),
3125 errmsg("IS DISTINCT FROM requires = operator to yield boolean"),
3126 parser_errposition(pstate, location)));
3127 if (((OpExpr *) result)->opretset)
3128 ereport(ERROR,
3129 (errcode(ERRCODE_DATATYPE_MISMATCH),
3130 /* translator: %s is name of a SQL construct, eg NULLIF */
3131 errmsg("%s must not return a set", "IS DISTINCT FROM"),
3132 parser_errposition(pstate, location)));
3133
3134 /*
3135 * We rely on DistinctExpr and OpExpr being same struct
3136 */
3137 NodeSetTag(result, T_DistinctExpr);
3138
3139 return result;
3140}
3141
3142/*
3143 * Produce a NullTest node from an IS [NOT] DISTINCT FROM NULL construct

Callers 2

transformAExprDistinctFunction · 0.85
make_row_distinct_opFunction · 0.85

Calls 4

make_opFunction · 0.85
parser_errpositionFunction · 0.85
errcodeFunction · 0.50
errmsgFunction · 0.50

Tested by

no test coverage detected