OSDN Git Service

Remove some trailing whitespaces and other minor stylistic issues.
authorJulien Rouhaud <julien.rouhaud@free.fr>
Sat, 6 Nov 2021 06:27:10 +0000 (14:27 +0800)
committerKyotaro Horiguchi <horikyota.ntt@gmail.com>
Thu, 25 Nov 2021 10:37:02 +0000 (19:37 +0900)
expected/store.out
expected/store_2.out
pg_store_plans.c
pgsp_explain.c
pgsp_json.c
pgsp_json_text.c
sql/store.sql

index 8e16380..a99f5e2 100644 (file)
@@ -81,7 +81,7 @@ BEGIN
              WHERE s.query = 'SELECT count(*) FROM (SELECT * FROM t1) AS x'
              ORDER BY p.calls
     LOOP
-         IF first then
+      IF first then
         s = r.q || E'\n  totalcalls=' || totalcalls ||
             ' , totalrows=' || totalrows || E'\n';
         first := false;
index 8a347b5..a4c35a7 100644 (file)
@@ -81,7 +81,7 @@ BEGIN
              WHERE s.query = 'SELECT count(*) FROM (SELECT * FROM t1) AS x'
              ORDER BY p.calls
     LOOP
-         IF first then
+      IF first then
         s = r.q || E'\n  totalcalls=' || totalcalls ||
             ' , totalrows=' || totalrows || E'\n';
         first := false;
index 4938663..4023fcb 100644 (file)
@@ -559,7 +559,7 @@ pgsp_shmem_startup(void)
                        goto error;
 
                /* Encoding is the only field we can easily sanity-check */
-       if (!PG_VALID_BE_ENCODING(temp.encoding))
+               if (!PG_VALID_BE_ENCODING(temp.encoding))
                        goto error;
 
                /* Previous incarnation might have had a larger plan_size */
@@ -724,7 +724,7 @@ pgsp_ExecutorStart(QueryDesc *queryDesc, int eflags)
                                                                                 );
                MemoryContextSwitchTo(oldcxt);
        }
-       
+
 }
 
 /*
@@ -785,7 +785,7 @@ pgsp_ExecutorEnd(QueryDesc *queryDesc)
                InstrEndLoop(queryDesc->totaltime);
 
                if (pgsp_enabled() &&
-                       queryDesc->totaltime->total >= 
+                       queryDesc->totaltime->total >=
                        (double)min_duration / 1000.0)
                {
                        ExplainState *es     = NewExplainState();
@@ -796,7 +796,7 @@ pgsp_ExecutorEnd(QueryDesc *queryDesc)
                        es->buffers = (es->analyze && log_buffers);
                        es->timing = (es->analyze && log_timing);
                        es->format = EXPLAIN_FORMAT_JSON;
-       
+
                        ExplainBeginOutput(es);
                        ExplainPrintPlan(es, queryDesc);
                        if (log_triggers)
@@ -934,7 +934,7 @@ store_entry(char *plan, uint32 queryId, queryid_t queryId_pgss,
                                                                                 plan_len,
                                                                                 shared_state->plan_size - 1);
 
-       
+
        /* Look up the hash table entry with shared lock. */
        LWLockAcquire(shared_state->lock, LW_SHARED);
 
@@ -961,10 +961,10 @@ store_entry(char *plan, uint32 queryId, queryid_t queryId_pgss,
         * Grab the spinlock while updating the counters (see comment about
         * locking rules at the head of the file)
         */
-       
+
        e = (volatile StatEntry *) entry;
        SpinLockAcquire(&e->mutex);
-       
+
        e->queryid = queryId_pgss;
 
        /* "Unstick" entry if it was previously sticky */
@@ -973,7 +973,7 @@ store_entry(char *plan, uint32 queryId, queryid_t queryId_pgss,
                e->counters.usage = USAGE_INIT;
                e->counters.first_call = GetCurrentTimestamp();
        }
-       
+
        e->counters.calls += 1;
        e->counters.total_time += total_time;
        if (e->counters.calls == 1)
@@ -1022,7 +1022,7 @@ store_entry(char *plan, uint32 queryId, queryid_t queryId_pgss,
        memcpy(entry->plan, shorten_plan, plan_len);
        entry->plan_len = plan_len;
        entry->plan[plan_len] = '\0';
-       
+
        SpinLockRelease(&e->mutex);
 
        LWLockRelease(shared_state->lock);
@@ -1149,7 +1149,7 @@ pg_store_plans(PG_FUNCTION_ARGS)
                                default:
                                        break;
                        }
-                       
+
                        estr = (char *)
                                pg_do_encoding_conversion((unsigned char *) pstr,
                                                                                  strlen(pstr),
@@ -1161,7 +1161,7 @@ pg_store_plans(PG_FUNCTION_ARGS)
                                pfree(estr);
                        if (pstr != entry->plan)
                                pfree(pstr);
-                       
+
                }
                else
                        values[i++] = CStringGetTextDatum("<insufficient privilege>");
@@ -1384,7 +1384,7 @@ pg_store_plans_hash_query(PG_FUNCTION_ARGS)
 {
        PG_RETURN_OID(hash_query(text_to_cstring(PG_GETARG_TEXT_P(0))));
 }
-               
+
 Datum
 pg_store_plans_shorten(PG_FUNCTION_ARGS)
 {
index 76346b4..6f4ccad 100644 (file)
@@ -81,7 +81,7 @@ pgspExplainTriggers(ExplainState *es, QueryDesc *queryDesc)
                routerels = queryDesc->estate->es_tuple_routing_result_relations;
                targrels = queryDesc->estate->es_trig_target_relations;
 #endif
-               
+
                pgspExplainOpenGroup("Triggers", "Triggers", false, es);
 
 #if PG_VERSION_NUM < 140000
@@ -111,7 +111,7 @@ pgspExplainTriggers(ExplainState *es, QueryDesc *queryDesc)
                        rInfo = (ResultRelInfo *) lfirst(l);
                        report_triggers(rInfo, show_relname, es);
                }
-               
+
                pgspExplainCloseGroup("Triggers", "Triggers", false, es);
        }
 }
@@ -128,7 +128,7 @@ pgspExplainOpenGroup(const char *objtype, const char *labelname,
                appendStringInfoString(es->str, ": ");
        }
        appendStringInfoChar(es->str, labeled ? '{' : '[');
-       
+
        GROUPING_STACK(es) = lcons_int(0, GROUPING_STACK(es));
        es->indent++;
 }
index 1808a18..0b32d17 100644 (file)
@@ -109,7 +109,7 @@ word_table propfields[] =
        {P_WorkersPlanned,      "{" ,"Workers Planned",         NULL, true,  NULL,                              SETTER(workers_planned)},
        {P_WorkersLaunched, "}" ,"Workers Launched",    NULL, true,  NULL,                              SETTER(workers_launched)},
        {P_InnerUnique,         "?" ,"Inner Unique",            NULL, true,  NULL,                              SETTER(inner_unique)},
-                                                                                                                 
+
        /* Values of these properties are ignored on normalization */
        {P_FunctionCall,        "y" ,"Function Call",           NULL, false, NULL,                              SETTER(func_call)},
        {P_StartupCost,         "1" ,"Startup Cost",            NULL, false, NULL,                              SETTER(startup_cost)},
@@ -314,7 +314,7 @@ word_table *
 search_word_table(word_table *tbl, const char *word, int mode)
 {
        word_table *p;
-       
+
        bool longname =
                (mode == PGSP_JSON_SHORTEN || mode == PGSP_JSON_NORMALIZE);
 
@@ -439,7 +439,7 @@ norm_yylex(char *str, core_YYSTYPE *yylval, YYLTYPE *yylloc, core_yyscan_t yysca
                return -1;
        }
        PG_END_TRY();
-       
+
        /*
         * '?' alone is assumed to be an IDENT.  If there's a real
         * operator '?', this should be confused but there's hardly be.
@@ -509,7 +509,7 @@ normalize_expr(char *expr, bool preserve_space)
                if (lastloc >= 0)
                {
                        int i, i2;
-                       
+
                        /* Skipping preceding whitespaces */
                        for(i = lastloc ; i < start && IS_WSCHAR(expr[i]) ; i++);
 
@@ -554,7 +554,7 @@ normalize_expr(char *expr, bool preserve_space)
                         */
                        if (tok > 0 &&
                                i2 < start &&
-                               (preserve_space || 
+                               (preserve_space ||
                                 (tok >= IDENT && lasttok >= IDENT &&
                                  !IS_CONST(tok) && !IS_CONST(lasttok))))
                                *wp++ = ' ';
@@ -575,7 +575,7 @@ normalize_expr(char *expr, bool preserve_space)
                 */
                if (tok == '-')
                        tok = norm_yylex(expr, &yylval, &yylloc, yyscanner);
-               
+
                /* Exit on parse error. */
                if (tok < 0)
                {
@@ -586,7 +586,7 @@ normalize_expr(char *expr, bool preserve_space)
                if (IS_CONST(tok))
                {
                        YYLTYPE end;
-                       
+
                        tok = norm_yylex(expr, &yylval, &end, yyscanner);
 
                        /* Exit on parse error. */
@@ -607,7 +607,8 @@ normalize_expr(char *expr, bool preserve_space)
                                end++;
                        }
 
-                       while (expr[end - 1] == ' ') end--;                     
+                       while (expr[end - 1] == ' ')
+                               end--;
 
                        *wp++ = '?';
                        yylloc = end;
@@ -767,7 +768,7 @@ json_ofstart(void *state, char *fname, bool isnull)
                ereport(DEBUG1,
                                (errmsg("JSON parser encoutered unknown field name: \"%s\".", fname),
                                 errdetail_log("INPUT: \"%s\"", ctx->org_string)));
-       }               
+       }
 
        ctx->remove = (ctx->mode == PGSP_JSON_NORMALIZE &&
                                   (!p || !p->normalize_use));
@@ -949,7 +950,7 @@ yaml_ofstart(void *state, char *fname, bool isnull)
                ereport(DEBUG1,
                                (errmsg("Short JSON parser encoutered unknown field name: \"%s\".", fname),
                                 errdetail_log("INPUT: \"%s\"", ctx->org_string)));
-       }               
+       }
        s = (p ? p->longname : fname);
 
        if (!bms_is_member(ctx->level, ctx->first))
@@ -1067,7 +1068,7 @@ xml_ofstart(void *state, char *fname, bool isnull)
                ereport(DEBUG1,
                                (errmsg("Short JSON parser encoutered unknown field name: \"%s\".", fname),
                                 errdetail_log("INPUT: \"%s\"", ctx->org_string)));
-       }               
+       }
        s = (p ? p->longname : fname);
 
        /*
@@ -1107,7 +1108,7 @@ xml_ofend(void *state, char *fname, bool isnull)
 
        p =     search_word_table(propfields, fname, ctx->mode);
        s = (p ? p->longname : fname);
-       
+
        appendStringInfoString(ctx->dest, "</");
        appendStringInfoString(ctx->dest, escape_xml(hyphenate_words(ctx, s)));
        appendStringInfoChar(ctx->dest, '>');
@@ -1229,7 +1230,7 @@ run_pg_parse_json(JsonLexContext *lex, JsonSemAction *sem)
 
                ecxt = MemoryContextSwitchTo(ccxt);
                errdata = CopyErrorData();
-               
+
                if (errdata->sqlerrcode == ERRCODE_INVALID_TEXT_REPRESENTATION)
                {
                        FlushErrorState();
@@ -1319,7 +1320,7 @@ pgsp_json_inflate(char *json)
                if (ctx.dest->len > 0 &&
                        ctx.dest->data[ctx.dest->len - 1] != '\n')
                        appendStringInfoChar(ctx.dest, '\n');
-               
+
                if (ctx.dest->len == 0)
                        appendStringInfoString(ctx.dest, "<Input was not JSON>");
                else
@@ -1355,7 +1356,7 @@ pgsp_json_yamlize(char *json)
                if (ctx.dest->len > 0 &&
                        ctx.dest->data[ctx.dest->len - 1] != '\n')
                        appendStringInfoChar(ctx.dest, '\n');
-               
+
                if (ctx.dest->len == 0)
                        appendStringInfoString(ctx.dest, "<Input was not JSON>");
                else
@@ -1397,7 +1398,7 @@ pgsp_json_xmlize(char *json)
                if (ctx.dest->len > start_len &&
                        ctx.dest->data[ctx.dest->len - 1] != '\n')
                        appendStringInfoChar(ctx.dest, '\n');
-               
+
                if (ctx.dest->len == start_len)
                {
                        resetStringInfo(ctx.dest);
index 72a219b..263dce7 100644 (file)
@@ -85,7 +85,7 @@ SETTERDECL(node_type)
 SETTERDECL(strategy)
 {
        word_table *p;
-       
+
        p = search_word_table(strategies, val, PGSP_JSON_TEXTIZE);
 
        if (!p)
@@ -311,7 +311,7 @@ print_prop_if_nz(StringInfo s, char *prepstr,
                print_prop(s, prepstr, prop, level, exind);
 }
 
-static void 
+static void
 print_current_node(pgspParserContext *ctx)
 {
        node_vals *v = ctx->nodevals;
@@ -326,7 +326,7 @@ print_current_node(pgspParserContext *ctx)
         * would be named T_Worker if there were in node.h. So it needs a special
         * treat.
         */
-       
+
        if (v->node_type == T_Invalid && !HASSTRING(v->worker_number))
                return;
 
@@ -403,7 +403,7 @@ print_current_node(pgspParserContext *ctx)
                                appendStringInfoString(s, "Worker");
                                print_prop_if_exists(s, " ", v->worker_number, 0, 0);
 
-                               /* 
+                               /*
                                 * "Worker"s are individual JSON objects in a JSON list but
                                 * should be printed as just a property in text
                                 * representaion. Correct indent using exind here.
@@ -466,7 +466,7 @@ print_current_node(pgspParserContext *ctx)
                appendStringInfoSpaces(s, TEXT_INDENT_DETAILS(level, exind));
                appendStringInfoString(s, str);
        }
-               
+
        print_propstr_if_exists(s, "Output: ", v->output, level, exind);
        print_propstr_if_exists(s, "Group Key: ", v->group_key, level, exind);
        print_groupingsets_if_exists(s, v->grouping_sets, level, exind);
@@ -489,7 +489,7 @@ print_current_node(pgspParserContext *ctx)
                if (v->repeatable_seed)
                        appendStringInfo(s, " REPEATABLE (%s)", v->repeatable_seed);
        }
-       
+
        print_propstr_if_exists(s, "Sort Key: ", v->sort_key, level, exind);
        if (HASSTRING(v->sort_method))
        {
@@ -699,7 +699,7 @@ print_current_node(pgspParserContext *ctx)
                /* Feed a line if any of Buffers: items has been shown */
                if (comma)
                        appendStringInfoString(s, "\n");
-                       
+
                appendStringInfoSpaces(s, TEXT_INDENT_DETAILS(level, exind));
                appendStringInfoString(s, "I/O Timings: ");
 
@@ -810,7 +810,7 @@ json_text_objend(void *state)
                }
 
                /* Move working grouping set into nodevals */
-               ctx->nodevals->grouping_sets = 
+               ctx->nodevals->grouping_sets =
                        lappend(v->grouping_sets, ctx->tmp_gset);
                ctx->tmp_gset = NULL;
        }
@@ -819,7 +819,7 @@ json_text_objend(void *state)
        ctx->level--;
 }
 
-static void 
+static void
 json_text_arrstart(void *state)
 {
        pgspParserContext *ctx = (pgspParserContext *)state;
@@ -1031,7 +1031,7 @@ pgsp_json_textize(char *json)
                if (ctx.dest->len > 0 &&
                        ctx.dest->data[ctx.dest->len - 1] != '\n')
                        appendStringInfoChar(ctx.dest, '\n');
-               
+
                if (ctx.dest->len == 0)
                        appendStringInfoString(ctx.dest, "<Input was not JSON>");
                else
index f246c57..f65c462 100644 (file)
@@ -43,7 +43,7 @@ BEGIN
              WHERE s.query = 'SELECT count(*) FROM (SELECT * FROM t1) AS x'
              ORDER BY p.calls
     LOOP
-         IF first then
+      IF first then
         s = r.q || E'\n  totalcalls=' || totalcalls ||
             ' , totalrows=' || totalrows || E'\n';
         first := false;