Adds for_each_from to ruleutils_14.c

Relevant PG commit:
56fe008996bc1a547ce60c8dddd2ca821cac163e
pull/5209/head
Halil Ozan Akgul 2021-08-16 13:20:27 +03:00 committed by Sait Talha Nisanci
parent beb49f0d53
commit 69aa240b99
1 changed files with 3 additions and 5 deletions

View File

@ -5064,7 +5064,7 @@ get_rule_expr(Node *node, deparse_context *context,
{ {
BoolExpr *expr = (BoolExpr *) node; BoolExpr *expr = (BoolExpr *) node;
Node *first_arg = linitial(expr->args); Node *first_arg = linitial(expr->args);
ListCell *arg = list_second_cell(expr->args); ListCell *arg;
switch (expr->boolop) switch (expr->boolop)
{ {
@ -5073,12 +5073,11 @@ get_rule_expr(Node *node, deparse_context *context,
appendStringInfoChar(buf, '('); appendStringInfoChar(buf, '(');
get_rule_expr_paren(first_arg, context, get_rule_expr_paren(first_arg, context,
false, node); false, node);
while (arg) for_each_from(arg, expr->args, 1)
{ {
appendStringInfoString(buf, " AND "); appendStringInfoString(buf, " AND ");
get_rule_expr_paren((Node *) lfirst(arg), context, get_rule_expr_paren((Node *) lfirst(arg), context,
false, node); false, node);
arg = lnext(expr->args, arg);
} }
if (!PRETTY_PAREN(context)) if (!PRETTY_PAREN(context))
appendStringInfoChar(buf, ')'); appendStringInfoChar(buf, ')');
@ -5089,12 +5088,11 @@ get_rule_expr(Node *node, deparse_context *context,
appendStringInfoChar(buf, '('); appendStringInfoChar(buf, '(');
get_rule_expr_paren(first_arg, context, get_rule_expr_paren(first_arg, context,
false, node); false, node);
while (arg) for_each_from(arg, expr->args, 1)
{ {
appendStringInfoString(buf, " OR "); appendStringInfoString(buf, " OR ");
get_rule_expr_paren((Node *) lfirst(arg), context, get_rule_expr_paren((Node *) lfirst(arg), context,
false, node); false, node);
arg = lnext(expr->args, arg);
} }
if (!PRETTY_PAREN(context)) if (!PRETTY_PAREN(context))
appendStringInfoChar(buf, ')'); appendStringInfoChar(buf, ')');