diff --git a/Makefile b/Makefile index c7b98b1..023e13a 100644 --- a/Makefile +++ b/Makefile @@ -18,30 +18,27 @@ REGRESS = basic version guc counters relations database top_query application_na # NO_INSTALLCHECK = 1 -ifdef USE_PGXS PG_CONFIG = pg_config -PG_VERSION := $(shell pg_config --version) +PG_VERSION := $(shell pg_config --version | awk {'print $$1 $$2'}) MAJOR := $(shell echo $(PG_VERSION) | sed -e 's/\.[^./]*$$//') -all: - echo $(MAJOR) - -ifneq (,$(findstring PostgreSQL 14,$(MAJOR))) +ifneq (,$(findstring PostgreSQL14,$(MAJOR))) CP := $(shell cp pg_stat_monitor--1.0.13.dat pg_stat_monitor--1.0.sql) endif -ifneq (,$(findstring PostgreSQL 13,$(MAJOR))) +ifneq (,$(findstring PostgreSQL13,$(MAJOR))) CP := $(shell cp pg_stat_monitor--1.0.13.dat pg_stat_monitor--1.0.sql) endif -ifneq (,$(findstring PostgreSQL 12,$(MAJOR))) +ifneq (,$(findstring PostgreSQL12,$(MAJOR))) CP := $(shell cp pg_stat_monitor--1.0.dat pg_stat_monitor--1.0.sql) endif -ifneq (,$(findstring PostgreSQL 11,$(MAJOR))) +ifneq (,$(findstring PostgreSQL11,$(MAJOR))) CP := $(shell cp pg_stat_monitor--1.0.dat pg_stat_monitor--1.0.sql) endif +ifdef USE_PGXS PGXS := $(shell $(PG_CONFIG) --pgxs) include $(PGXS) else diff --git a/pg_stat_monitor.c b/pg_stat_monitor.c index 5fb38eb..f08e716 100644 --- a/pg_stat_monitor.c +++ b/pg_stat_monitor.c @@ -1779,7 +1779,7 @@ pg_stat_monitor_internal(FunctionCallInfo fcinfo, if (enc != query_txt) pfree(enc); /* plan at column number 7 */ - if (planid && tmp.planinfo.plan_text) + if (planid && strlen(tmp.planinfo.plan_text) > 0) values[i++] = CStringGetTextDatum(tmp.planinfo.plan_text); else nulls[i++] = true;