#define STICKY_DECREASE_FACTOR (0.50) /* factor for sticky entries */
#define USAGE_DEALLOC_PERCENT 5 /* free this % of entries at once */
-/* In PostgreSQL 11, queryid becomes a uint64 internally.
- */
+/* In PostgreSQL 11, queryid becomes a uint64 internally. */
#if PG_VERSION_NUM >= 110000
typedef uint64 queryid_t;
#define PGSP_NO_QUERYID UINT64CONST(0)
&plan_storage,
PLAN_STORAGE_FILE,
plan_storage_options,
- PGC_USERSET,
+ PGC_POSTMASTER,
0,
NULL,
NULL,
{
bool found;
HASHCTL info;
- FILE *file;
+ FILE *file = NULL;
FILE *pfile = NULL;
uint32 header;
int32 num;
{
values[i++] = Int64GetDatumFast(queryid);
values[i++] = Int64GetDatumFast(planid);
+
+ /* fill queryid_stat_statements with the same value with queryid */
if (api_version == PGSP_V1_5)
- values[i++] = ObjectIdGetDatum(queryid);
+ values[i++] = Int64GetDatumFast(queryid);
}
else
{
- values[i++] = Int64GetDatumFast(0);
- values[i++] = Int64GetDatumFast(0);
+ nulls[i++] = true; /* queryid */
+ nulls[i++] = true; /* planid */
+
+ /* queryid_stat_statemetns*/
if (api_version == PGSP_V1_5)
- values[i++] = Int64GetDatumFast(0);
+ nulls[i++] = true;
}
if (is_allowed_role || entry->key.userid == userid)
mstr = pgsp_json_xmlize(pstr);
break;
default:
+ mstr = pstr;
break;
}
entries = palloc(hash_get_num_entries(hash_table) * sizeof(pgspEntry *));
i = 0;
+ tottextlen = 0;
+ nvalidtexts = 0;
+
hash_seq_init(&hash_seq, hash_table);
while ((entry = hash_seq_search(&hash_seq)) != NULL)
{