Mechanical code beautification ruleutils_15.c

Relevant PG commit:
23e7b38bfe396f919fdb66057174d29e17086418
pg_15_iso_fix
naisila 2022-07-25 16:44:23 +03:00
parent b2e0df4eb7
commit 3e4f6ae315
1 changed files with 23 additions and 20 deletions

View File

@ -4984,7 +4984,7 @@ isSimpleNode(Node *node, Node *parentNode, int prettyFlags)
case T_GroupingFunc: /* own parentheses */ case T_GroupingFunc: /* own parentheses */
case T_WindowFunc: /* own parentheses */ case T_WindowFunc: /* own parentheses */
case T_CaseExpr: /* other separators */ case T_CaseExpr: /* other separators */
case T_JsonExpr: /* own parentheses */ case T_JsonExpr: /* own parentheses */
return true; return true;
default: default:
return false; return false;
@ -5179,8 +5179,8 @@ get_json_format(JsonFormat *format, StringInfo buf)
if (format->encoding != JS_ENC_DEFAULT) if (format->encoding != JS_ENC_DEFAULT)
{ {
const char *encoding = const char *encoding =
format->encoding == JS_ENC_UTF16 ? "UTF16" : format->encoding == JS_ENC_UTF16 ? "UTF16" :
format->encoding == JS_ENC_UTF32 ? "UTF32" : "UTF8"; format->encoding == JS_ENC_UTF32 ? "UTF32" : "UTF8";
appendStringInfo(buf, " ENCODING %s", encoding); appendStringInfo(buf, " ENCODING %s", encoding);
} }
@ -6522,7 +6522,8 @@ get_rule_expr(Node *node, deparse_context *context,
if (jexpr->passing_values) if (jexpr->passing_values)
{ {
ListCell *lc1, *lc2; ListCell *lc1,
*lc2;
bool needcomma = false; bool needcomma = false;
appendStringInfoString(buf, " PASSING "); appendStringInfoString(buf, " PASSING ");
@ -6897,7 +6898,7 @@ get_json_constructor(JsonConstructorExpr *ctor, deparse_context *context,
if (nargs > 0) if (nargs > 0)
{ {
const char *sep = ctor->type == JSCTOR_JSON_OBJECT && const char *sep = ctor->type == JSCTOR_JSON_OBJECT &&
(nargs % 2) != 0 ? " : " : ", "; (nargs % 2) != 0 ? " : " : ", ";
appendStringInfoString(buf, sep); appendStringInfoString(buf, sep);
} }
@ -7045,7 +7046,8 @@ get_agg_expr_helper(Aggref *aggref, deparse_context *context,
if (is_json_objectagg) if (is_json_objectagg)
{ {
if (i > 2) if (i > 2)
break; /* skip ABSENT ON NULL and WITH UNIQUE args */ break; /* skip ABSENT ON NULL and WITH UNIQUE
* args */
appendStringInfoString(buf, " : "); appendStringInfoString(buf, " : ");
} }
@ -7951,16 +7953,16 @@ get_json_table_nested_columns(TableFunc *tf, Node *node,
} }
else else
{ {
JsonTableParent *n = castNode(JsonTableParent, node); JsonTableParent *n = castNode(JsonTableParent, node);
if (needcomma) if (needcomma)
appendStringInfoChar(context->buf, ','); appendStringInfoChar(context->buf, ',');
appendStringInfoChar(context->buf, ' '); appendStringInfoChar(context->buf, ' ');
appendContextKeyword(context, "NESTED PATH ", 0, 0, 0); appendContextKeyword(context, "NESTED PATH ", 0, 0, 0);
get_const_expr(n->path, context, -1); get_const_expr(n->path, context, -1);
appendStringInfo(context->buf, " AS %s", quote_identifier(n->name)); appendStringInfo(context->buf, " AS %s", quote_identifier(n->name));
get_json_table_columns(tf, n, context, showimplicit); get_json_table_columns(tf, n, context, showimplicit);
} }
} }
@ -7990,17 +7992,17 @@ get_json_table_plan(TableFunc *tf, Node *node, deparse_context *context,
} }
else else
{ {
JsonTableParent *n = castNode(JsonTableParent, node); JsonTableParent *n = castNode(JsonTableParent, node);
appendStringInfoString(context->buf, quote_identifier(n->name)); appendStringInfoString(context->buf, quote_identifier(n->name));
if (n->child) if (n->child)
{ {
appendStringInfoString(context->buf, appendStringInfoString(context->buf,
n->outerJoin ? " OUTER " : " INNER "); n->outerJoin ? " OUTER " : " INNER ");
get_json_table_plan(tf, n->child, context, get_json_table_plan(tf, n->child, context,
IsA(n->child, JsonTableSibling)); IsA(n->child, JsonTableSibling));
} }
} }
if (parenthesize) if (parenthesize)
@ -8139,7 +8141,8 @@ get_json_table(TableFunc *tf, deparse_context *context, bool showimplicit)
if (jexpr->passing_values) if (jexpr->passing_values)
{ {
ListCell *lc1, *lc2; ListCell *lc1,
*lc2;
bool needcomma = false; bool needcomma = false;
appendStringInfoChar(buf, ' '); appendStringInfoChar(buf, ' ');