From b8005d3089592a7ec2640e94b8eee4b5b8e0ce23 Mon Sep 17 00:00:00 2001 From: Teodor Sigaev Date: Thu, 20 May 2021 16:07:39 +0300 Subject: [PATCH 1/4] add log/ to gitignore. Roman Zharkov --- .gitignore | 1 + 1 file changed, 1 insertion(+) diff --git a/.gitignore b/.gitignore index 46eea3c..b09edda 100644 --- a/.gitignore +++ b/.gitignore @@ -9,3 +9,4 @@ temp diffs etc results +log/ -- 2.37.3 From 0652f9e858cacb087201f7ab658101bcba7a31a9 Mon Sep 17 00:00:00 2001 From: Teodor Sigaev Date: Wed, 18 Jan 2023 16:10:43 +0300 Subject: [PATCH 2/4] v16 support. Dmitry Koval --- plantuner.c | 23 ++++++++++++++++++++--- 1 file changed, 20 insertions(+), 3 deletions(-) diff --git a/plantuner.c b/plantuner.c index f87dcea..0c07b7f 100644 --- a/plantuner.c +++ b/plantuner.c @@ -35,6 +35,9 @@ #include #include #include +#if PG_VERSION_NUM >= 160000 +#include +#endif #include #include #include @@ -149,9 +152,23 @@ indexesAssign(const char * newval, bool doit, GucSource source, { char *curname = (char *) lfirst(l); #if PG_VERSION_NUM >= 90200 - Oid indexOid = RangeVarGetRelid( - makeRangeVarFromNameList(stringToQualifiedNameList(curname)), - NoLock, true); + List *cur_namelist; + Oid indexOid; + +#if PG_VERSION_NUM >= 160000 + ErrorSaveContext escontext = {T_ErrorSaveContext}; + + cur_namelist = stringToQualifiedNameList(curname, (Node *) &escontext); + + /* bad name list syntax */ + if (cur_namelist == NIL) + continue; +#else + cur_namelist = stringToQualifiedNameList(curname); +#endif + + indexOid = RangeVarGetRelid(makeRangeVarFromNameList(cur_namelist), + NoLock, true); #else Oid indexOid = RangeVarGetRelid( makeRangeVarFromNameList(stringToQualifiedNameList(curname)), -- 2.37.3 From cb16288a6f76346628dc6e4b9f177a767fdf7f8e Mon Sep 17 00:00:00 2001 From: Teodor Sigaev Date: Mon, 24 Apr 2023 18:18:29 +0300 Subject: [PATCH 3/4] Add meson build. Maxim Orlov --- meson.build | 32 ++++++++++++++++++++++++++++++++ 1 file changed, 32 insertions(+) create mode 100644 meson.build diff --git a/meson.build b/meson.build new file mode 100644 index 0000000..40324a1 --- /dev/null +++ b/meson.build @@ -0,0 +1,32 @@ +# Copyright (c) 2023, Postgres Professional + +plantuner_sources = files( + 'plantuner.c' +) + +if host_system == 'windows' + plantuner_sources += rc_lib_gen.process(win32ver_rc, extra_args: [ + '--NAME', 'plantuner', + '--FILEDESC', 'plantuner - provides hints for the planner that can disable or enable indexes for query execution',]) +endif + +plantuner = shared_module('plantuner', + plantuner_sources, + kwargs: contrib_mod_args, +) +contrib_targets += plantuner + +install_data( + kwargs: contrib_data_args, +) + +tests += { + 'name': 'plantuner', + 'sd': meson.current_source_dir(), + 'bd': meson.current_build_dir(), + 'regress': { + 'sql': [ + 'plantuner', + ], + }, +} -- 2.37.3 From 0c1bf0a90a4ae17db6b0232aa9258a2ce28604f3 Mon Sep 17 00:00:00 2001 From: Teodor Sigaev Date: Tue, 2 Apr 2024 14:43:02 +0300 Subject: [PATCH 4/4] Replace BackendIds with 0-based ProcNumbers Marina Polyakova --- plantuner.c | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/plantuner.c b/plantuner.c index 0c07b7f..e454698 100644 --- a/plantuner.c +++ b/plantuner.c @@ -102,7 +102,12 @@ indexesAssign(const char * newval, bool doit, GucSource source, * follow work could be done only in normal processing because of * accsess to system catalog */ - if (MyBackendId == InvalidBackendId || !IsUnderPostmaster || +#if PG_VERSION_NUM >= 170000 + if (MyProcNumber == INVALID_PROC_NUMBER || +#else + if (MyBackendId == InvalidBackendId || +#endif + !IsUnderPostmaster || !IsTransactionState()) { /* reset init state */ -- 2.37.3