* Deparse IS [NOT] NULL expression. */
| 3036 | * Deparse IS [NOT] NULL expression. |
| 3037 | */ |
| 3038 | static void |
| 3039 | deparseNullTest(NullTest *node, deparse_expr_cxt *context) |
| 3040 | { |
| 3041 | StringInfo buf = context->buf; |
| 3042 | |
| 3043 | appendStringInfoChar(buf, '('); |
| 3044 | deparseExpr(node->arg, context); |
| 3045 | |
| 3046 | /* |
| 3047 | * For scalar inputs, we prefer to print as IS [NOT] NULL, which is |
| 3048 | * shorter and traditional. If it's a rowtype input but we're applying a |
| 3049 | * scalar test, must print IS [NOT] DISTINCT FROM NULL to be semantically |
| 3050 | * correct. |
| 3051 | */ |
| 3052 | if (node->argisrow || !type_is_rowtype(exprType((Node *) node->arg))) |
| 3053 | { |
| 3054 | if (node->nulltesttype == IS_NULL) |
| 3055 | appendStringInfoString(buf, " IS NULL)"); |
| 3056 | else |
| 3057 | appendStringInfoString(buf, " IS NOT NULL)"); |
| 3058 | } |
| 3059 | else |
| 3060 | { |
| 3061 | if (node->nulltesttype == IS_NULL) |
| 3062 | appendStringInfoString(buf, " IS NOT DISTINCT FROM NULL)"); |
| 3063 | else |
| 3064 | appendStringInfoString(buf, " IS DISTINCT FROM NULL)"); |
| 3065 | } |
| 3066 | } |
| 3067 | |
| 3068 | /* |
| 3069 | * Deparse ARRAY[...] construct. |
no test coverage detected