21 .
name =
"test_custom_var_stats",
33#define PGSTAT_KIND_TEST_CUSTOM_VAR_STATS 25
38#define PGSTAT_CUSTOM_VAR_STATS_IDX(name) hash_bytes_extended((const unsigned char *) name, strlen(name), 0)
73 .
name =
"test_custom_var_stats",
74 .fixed_amount =
false,
75 .write_to_file =
true,
76 .track_entry_count =
true,
77 .accessed_across_databases =
true,
179 (
errcode(ERRCODE_NAME_TOO_LONG),
180 errmsg(
"custom statistic name \"%s\" is too long", stat_name),
193 memset(&shared_entry->
stats, 0,
sizeof(shared_entry->
stats));
272 elog(
ERROR,
"test_custom_stats_var_report: return type is not composite");
285 bool nulls[2] = {
false,
false};
static Datum values[MAXATTR]
int errdetail(const char *fmt,...)
int errcode(int sqlerrcode)
int errmsg(const char *fmt,...)
#define ereport(elevel,...)
TupleDesc BlessTupleDesc(TupleDesc tupdesc)
#define PG_GETARG_TEXT_PP(n)
TypeFuncClass get_call_result_type(FunctionCallInfo fcinfo, Oid *resultTypeId, TupleDesc *resultTupleDesc)
#define SRF_IS_FIRSTCALL()
#define SRF_PERCALL_SETUP()
#define SRF_RETURN_NEXT(_funcctx, _result)
#define SRF_FIRSTCALL_INIT()
static Datum HeapTupleGetDatum(const HeapTupleData *tuple)
#define SRF_RETURN_DONE(_funcctx)
HeapTuple heap_form_tuple(TupleDesc tupleDescriptor, const Datum *values, const bool *isnull)
bool process_shared_preload_libraries_in_progress
static MemoryContext MemoryContextSwitchTo(MemoryContext context)
PgStat_EntryRef * pgstat_prep_pending_entry(PgStat_Kind kind, Oid dboid, uint64 objid, bool *created_entry)
void * pgstat_fetch_entry(PgStat_Kind kind, Oid dboid, uint64 objid)
void pgstat_register_kind(PgStat_Kind kind, const PgStat_KindInfo *kind_info)
void pgstat_request_entry_refs_gc(void)
bool pgstat_drop_entry(PgStat_Kind kind, Oid dboid, uint64 objid)
void pgstat_unlock_entry(PgStat_EntryRef *entry_ref)
bool pgstat_lock_entry(PgStat_EntryRef *entry_ref, bool nowait)
PgStat_EntryRef * pgstat_get_entry_ref_locked(PgStat_Kind kind, Oid dboid, uint64 objid, bool nowait)
static Datum Int64GetDatum(int64 X)
static Datum PointerGetDatum(const void *X)
MemoryContext multi_call_memory_ctx
PgStat_StatCustomVarEntry stats
PgStatShared_Common header
PgStatShared_Common * shared_stats
PG_FUNCTION_INFO_V1(test_custom_stats_var_create)
Datum test_custom_stats_var_update(PG_FUNCTION_ARGS)
struct PgStatShared_CustomVarEntry PgStatShared_CustomVarEntry
Datum test_custom_stats_var_drop(PG_FUNCTION_ARGS)
static const PgStat_KindInfo custom_stats
struct PgStat_StatCustomVarEntry PgStat_StatCustomVarEntry
PG_MODULE_MAGIC_EXT(.name="test_custom_var_stats",.version=PG_VERSION)
Datum test_custom_stats_var_create(PG_FUNCTION_ARGS)
Datum test_custom_stats_var_report(PG_FUNCTION_ARGS)
static bool test_custom_stats_var_flush_pending_cb(PgStat_EntryRef *entry_ref, bool nowait)
static PgStat_StatCustomVarEntry * test_custom_stats_var_fetch_entry(const char *stat_name)
#define PGSTAT_KIND_TEST_CUSTOM_VAR_STATS
#define PGSTAT_CUSTOM_VAR_STATS_IDX(name)
text * cstring_to_text(const char *s)
char * text_to_cstring(const text *t)