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

Function deparseSubqueryTargetList

contrib/postgres_fdw/deparse.c:1479–1505  ·  view source on GitHub ↗

* Emit expressions specified in the given relation's reltarget. * * This is used for deparsing the given relation as a subquery. */

Source from the content-addressed store, hash-verified

1477 * This is used for deparsing the given relation as a subquery.
1478 */
1479static void
1480deparseSubqueryTargetList(deparse_expr_cxt *context)
1481{
1482 StringInfo buf = context->buf;
1483 RelOptInfo *foreignrel = context->foreignrel;
1484 bool first;
1485 ListCell *lc;
1486
1487 /* Should only be called in these cases. */
1488 Assert(IS_SIMPLE_REL(foreignrel) || IS_JOIN_REL(foreignrel));
1489
1490 first = true;
1491 foreach(lc, foreignrel->reltarget->exprs)
1492 {
1493 Node *node = (Node *) lfirst(lc);
1494
1495 if (!first)
1496 appendStringInfoString(buf, ", ");
1497 first = false;
1498
1499 deparseExpr((Expr *) node, context);
1500 }
1501
1502 /* Don't generate bad syntax if no expressions */
1503 if (first)
1504 appendStringInfoString(buf, "NULL");
1505}
1506
1507/*
1508 * Construct FROM clause for given relation

Callers 1

deparseSelectSqlFunction · 0.85

Calls 3

appendStringInfoStringFunction · 0.85
deparseExprFunction · 0.85
foreachFunction · 0.50

Tested by

no test coverage detected