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;
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;
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 */
);
MemoryContextSwitchTo(oldcxt);
}
-
+
}
/*
InstrEndLoop(queryDesc->totaltime);
if (pgsp_enabled() &&
- queryDesc->totaltime->total >=
+ queryDesc->totaltime->total >=
(double)min_duration / 1000.0)
{
ExplainState *es = NewExplainState();
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)
plan_len,
shared_state->plan_size - 1);
-
+
/* Look up the hash table entry with shared lock. */
LWLockAcquire(shared_state->lock, LW_SHARED);
* 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 */
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)
memcpy(entry->plan, shorten_plan, plan_len);
entry->plan_len = plan_len;
entry->plan[plan_len] = '\0';
-
+
SpinLockRelease(&e->mutex);
LWLockRelease(shared_state->lock);
default:
break;
}
-
+
estr = (char *)
pg_do_encoding_conversion((unsigned char *) pstr,
strlen(pstr),
pfree(estr);
if (pstr != entry->plan)
pfree(pstr);
-
+
}
else
values[i++] = CStringGetTextDatum("<insufficient privilege>");
{
PG_RETURN_OID(hash_query(text_to_cstring(PG_GETARG_TEXT_P(0))));
}
-
+
Datum
pg_store_plans_shorten(PG_FUNCTION_ARGS)
{
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
rInfo = (ResultRelInfo *) lfirst(l);
report_triggers(rInfo, show_relname, es);
}
-
+
pgspExplainCloseGroup("Triggers", "Triggers", false, es);
}
}
appendStringInfoString(es->str, ": ");
}
appendStringInfoChar(es->str, labeled ? '{' : '[');
-
+
GROUPING_STACK(es) = lcons_int(0, GROUPING_STACK(es));
es->indent++;
}
{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)},
search_word_table(word_table *tbl, const char *word, int mode)
{
word_table *p;
-
+
bool longname =
(mode == PGSP_JSON_SHORTEN || mode == PGSP_JSON_NORMALIZE);
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.
if (lastloc >= 0)
{
int i, i2;
-
+
/* Skipping preceding whitespaces */
for(i = lastloc ; i < start && IS_WSCHAR(expr[i]) ; i++);
*/
if (tok > 0 &&
i2 < start &&
- (preserve_space ||
+ (preserve_space ||
(tok >= IDENT && lasttok >= IDENT &&
!IS_CONST(tok) && !IS_CONST(lasttok))))
*wp++ = ' ';
*/
if (tok == '-')
tok = norm_yylex(expr, &yylval, &yylloc, yyscanner);
-
+
/* Exit on parse error. */
if (tok < 0)
{
if (IS_CONST(tok))
{
YYLTYPE end;
-
+
tok = norm_yylex(expr, &yylval, &end, yyscanner);
/* Exit on parse error. */
end++;
}
- while (expr[end - 1] == ' ') end--;
+ while (expr[end - 1] == ' ')
+ end--;
*wp++ = '?';
yylloc = end;
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));
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))
ereport(DEBUG1,
(errmsg("Short JSON parser encoutered unknown field name: \"%s\".", fname),
errdetail_log("INPUT: \"%s\"", ctx->org_string)));
- }
+ }
s = (p ? p->longname : fname);
/*
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, '>');
ecxt = MemoryContextSwitchTo(ccxt);
errdata = CopyErrorData();
-
+
if (errdata->sqlerrcode == ERRCODE_INVALID_TEXT_REPRESENTATION)
{
FlushErrorState();
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
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
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);
SETTERDECL(strategy)
{
word_table *p;
-
+
p = search_word_table(strategies, val, PGSP_JSON_TEXTIZE);
if (!p)
print_prop(s, prepstr, prop, level, exind);
}
-static void
+static void
print_current_node(pgspParserContext *ctx)
{
node_vals *v = ctx->nodevals;
* 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;
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.
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);
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))
{
/* 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: ");
}
/* 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;
}
ctx->level--;
}
-static void
+static void
json_text_arrstart(void *state)
{
pgspParserContext *ctx = (pgspParserContext *)state;
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
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;