* Transform a "row IS DISTINCT FROM row" construct * * The input RowExprs are already transformed */
| 3068 | * The input RowExprs are already transformed |
| 3069 | */ |
| 3070 | static Node * |
| 3071 | make_row_distinct_op(ParseState *pstate, List *opname, |
| 3072 | RowExpr *lrow, RowExpr *rrow, |
| 3073 | int location) |
| 3074 | { |
| 3075 | Node *result = NULL; |
| 3076 | List *largs = lrow->args; |
| 3077 | List *rargs = rrow->args; |
| 3078 | ListCell *l, |
| 3079 | *r; |
| 3080 | |
| 3081 | if (list_length(largs) != list_length(rargs)) |
| 3082 | ereport(ERROR, |
| 3083 | (errcode(ERRCODE_SYNTAX_ERROR), |
| 3084 | errmsg("unequal number of entries in row expressions"), |
| 3085 | parser_errposition(pstate, location))); |
| 3086 | |
| 3087 | forboth(l, largs, r, rargs) |
| 3088 | { |
| 3089 | Node *larg = (Node *) lfirst(l); |
| 3090 | Node *rarg = (Node *) lfirst(r); |
| 3091 | Node *cmp; |
| 3092 | |
| 3093 | cmp = (Node *) make_distinct_op(pstate, opname, larg, rarg, location); |
| 3094 | if (result == NULL) |
| 3095 | result = cmp; |
| 3096 | else |
| 3097 | result = (Node *) makeBoolExpr(OR_EXPR, |
| 3098 | list_make2(result, cmp), |
| 3099 | location); |
| 3100 | } |
| 3101 | |
| 3102 | if (result == NULL) |
| 3103 | { |
| 3104 | /* zero-length rows? Generate constant FALSE */ |
| 3105 | result = makeBoolConst(false, false); |
| 3106 | } |
| 3107 | |
| 3108 | return result; |
| 3109 | } |
| 3110 | |
| 3111 | /* |
| 3112 | * make the node for an IS DISTINCT FROM operator |
no test coverage detected