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

Function deparseNullTest

contrib/postgres_fdw/deparse.c:3038–3066  ·  view source on GitHub ↗

* Deparse IS [NOT] NULL expression. */

Source from the content-addressed store, hash-verified

3036 * Deparse IS [NOT] NULL expression.
3037 */
3038static void
3039deparseNullTest(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.

Callers 1

deparseExprFunction · 0.85

Calls 5

appendStringInfoCharFunction · 0.85
deparseExprFunction · 0.85
type_is_rowtypeFunction · 0.85
exprTypeFunction · 0.85
appendStringInfoStringFunction · 0.85

Tested by

no test coverage detected