Postgres 16 support for PGSM
* PG16 requires changes around one of the hooks, ifdef added * Meson build file addedpull/419/head
parent
726556dbaf
commit
38ee75cc60
2
Makefile
2
Makefile
|
@ -21,7 +21,7 @@ REGRESS = basic version guc pgsm_query_id functions counters relations database
|
|||
PG_CONFIG ?= pg_config
|
||||
|
||||
ifdef USE_PGXS
|
||||
MAJORVERSION := $(shell pg_config --version | awk {'print $$2'} | cut -f1 -d".")
|
||||
MAJORVERSION := $(shell $(PG_CONFIG) --version | awk {'print $$2'} | cut -f1 -d".")
|
||||
PGXS := $(shell $(PG_CONFIG) --pgxs)
|
||||
include $(PGXS)
|
||||
else
|
||||
|
|
|
@ -0,0 +1,54 @@
|
|||
# Copyright (c) 2022-2023, PostgreSQL Global Development Group
|
||||
|
||||
pg_stat_monitor_sources = files(
|
||||
'pg_stat_monitor.c',
|
||||
)
|
||||
|
||||
pg_stat_monitor = shared_module('pg_stat_monitor',
|
||||
pg_stat_monitor_sources,
|
||||
kwargs: contrib_mod_args + {
|
||||
'dependencies': contrib_mod_args['dependencies'],
|
||||
},
|
||||
)
|
||||
contrib_targets += pg_stat_monitor
|
||||
|
||||
install_data(
|
||||
'pg_stat_monitor.control',
|
||||
'pg_stat_monitor--2.0.sql',
|
||||
'pg_stat_monitor--1.0--2.0.sql',
|
||||
kwargs: contrib_data_args,
|
||||
)
|
||||
|
||||
tests += {
|
||||
'name': 'pg_stat_monitor',
|
||||
'sd': meson.current_source_dir(),
|
||||
'bd': meson.current_build_dir(),
|
||||
'regress': {
|
||||
'sql': [
|
||||
'application_name',
|
||||
'application_name_unique',
|
||||
'basic',
|
||||
'cmd_type',
|
||||
'counters',
|
||||
'database',
|
||||
'error_insert',
|
||||
'error',
|
||||
'functions',
|
||||
'guc',
|
||||
'histogram',
|
||||
'pgsqm_query_id',
|
||||
'relations',
|
||||
'rows',
|
||||
'state',
|
||||
'tags',
|
||||
'top_query',
|
||||
'user',
|
||||
'version'
|
||||
],
|
||||
'regress_args': ['--temp-config', files('pg_stat_monitor.conf')],
|
||||
# Disabled because these tests require
|
||||
# "shared_preload_libraries=pg_stat_monitor", which typical
|
||||
# runningcheck users do not have (e.g. buildfarm clients).
|
||||
'runningcheck': false,
|
||||
},
|
||||
}
|
|
@ -164,7 +164,11 @@ DECLARE_HOOK(void pgsm_ExecutorStart, QueryDesc *queryDesc, int eflags);
|
|||
DECLARE_HOOK(void pgsm_ExecutorRun, QueryDesc *queryDesc, ScanDirection direction, uint64 count, bool execute_once);
|
||||
DECLARE_HOOK(void pgsm_ExecutorFinish, QueryDesc *queryDesc);
|
||||
DECLARE_HOOK(void pgsm_ExecutorEnd, QueryDesc *queryDesc);
|
||||
#if PG_VERSION_NUM < 160000
|
||||
DECLARE_HOOK(bool pgsm_ExecutorCheckPerms, List *rt, bool abort);
|
||||
#else
|
||||
DECLARE_HOOK(bool pgsm_ExecutorCheckPerms, List *rt, List *rp, bool abort);
|
||||
#endif
|
||||
|
||||
#if PG_VERSION_NUM >= 140000
|
||||
DECLARE_HOOK(PlannedStmt *pgsm_planner_hook, Query *parse, const char *query_string, int cursorOptions, ParamListInfo boundParams);
|
||||
|
@ -783,7 +787,11 @@ pgsm_ExecutorEnd(QueryDesc *queryDesc)
|
|||
}
|
||||
|
||||
static bool
|
||||
#if PG_VERSION_NUM < 160000
|
||||
pgsm_ExecutorCheckPerms(List *rt, bool abort)
|
||||
#else
|
||||
pgsm_ExecutorCheckPerms(List *rt, List *rp, bool abort)
|
||||
#endif
|
||||
{
|
||||
ListCell *lr = NULL;
|
||||
int i = 0;
|
||||
|
@ -827,7 +835,11 @@ pgsm_ExecutorCheckPerms(List *rt, bool abort)
|
|||
num_relations = i;
|
||||
|
||||
if (prev_ExecutorCheckPerms_hook)
|
||||
#if PG_VERSION_NUM < 160000
|
||||
return prev_ExecutorCheckPerms_hook(rt, abort);
|
||||
#else
|
||||
return prev_ExecutorCheckPerms_hook(rt, rp, abort);
|
||||
#endif
|
||||
|
||||
return true;
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue