* Emit expressions specified in the given relation's reltarget. * * This is used for deparsing the given relation as a subquery. */
| 1477 | * This is used for deparsing the given relation as a subquery. |
| 1478 | */ |
| 1479 | static void |
| 1480 | deparseSubqueryTargetList(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 |
no test coverage detected