* make the node for an IS DISTINCT FROM operator */
| 3112 | * make the node for an IS DISTINCT FROM operator |
| 3113 | */ |
| 3114 | static Expr * |
| 3115 | make_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 |
no test coverage detected