Issue - (#52): Create a function to return the build version.

Jira: PG-142
pull/55/head
Ibrar Ahmed 2020-10-12 17:54:44 +00:00
parent 6170d1f77c
commit b23df84af9
2 changed files with 22 additions and 4 deletions

View File

@ -9,6 +9,11 @@ RETURNS void
AS 'MODULE_PATHNAME'
LANGUAGE C PARALLEL SAFE;
CREATE FUNCTION pg_stat_monitor_version()
RETURNS text
AS 'MODULE_PATHNAME'
LANGUAGE C PARALLEL SAFE;
CREATE FUNCTION pg_stat_monitor(IN showtext boolean,
OUT bucket int,
OUT userid oid,
@ -19,7 +24,6 @@ CREATE FUNCTION pg_stat_monitor(IN showtext boolean,
OUT query text,
OUT bucket_start_time timestamptz,
OUT plan_calls int8,
OUT plan_total_time float8,
OUT plan_min_time float8,

View File

@ -16,6 +16,8 @@
PG_MODULE_MAGIC;
#define BUILD_VERSION "0.6.0"
/*---- Initicalization Function Declarations ----*/
void _PG_init(void);
void _PG_fini(void);
@ -45,6 +47,7 @@ static ExecutorEnd_hook_type prev_ExecutorEnd = NULL;
static ProcessUtility_hook_type prev_ProcessUtility = NULL;
PG_FUNCTION_INFO_V1(pg_stat_monitor_version);
PG_FUNCTION_INFO_V1(pg_stat_monitor_reset);
PG_FUNCTION_INFO_V1(pg_stat_monitor_1_2);
PG_FUNCTION_INFO_V1(pg_stat_monitor_1_3);
@ -194,6 +197,17 @@ _PG_fini(void)
hash_entry_reset();
}
/*
* Select the version of pg_stat_monitor.
*/
Datum
pg_stat_monitor_version(PG_FUNCTION_ARGS)
{
PG_RETURN_TEXT_P(cstring_to_text(BUILD_VERSION));
}
#define PG_STAT_STATEMENTS_COLS 38 /* maximum of above */
/*
* Post-parse-analysis hook: mark query with a queryId
*/