From bc19c99c0b98176eda701cd36e7afdad15c136cc Mon Sep 17 00:00:00 2001 From: Ibrar Ahmed Date: Tue, 15 Nov 2022 18:11:10 +0000 Subject: [PATCH] PG-306: The bucket start time should be timestamp instead of TEXT. --- pg_stat_monitor--1.0--2.0.sql | 2 +- pg_stat_monitor--1.0.sql | 8 ++++---- pg_stat_monitor--2.0.sql | 2 +- pg_stat_monitor.c | 2 +- 4 files changed, 7 insertions(+), 7 deletions(-) diff --git a/pg_stat_monitor--1.0--2.0.sql b/pg_stat_monitor--1.0--2.0.sql index dbfc8bb..5c2cbfa 100644 --- a/pg_stat_monitor--1.0--2.0.sql +++ b/pg_stat_monitor--1.0--2.0.sql @@ -30,7 +30,7 @@ CREATE FUNCTION pg_stat_monitor_internal( OUT elevel int, OUT sqlcode TEXT, OUT message text, - OUT bucket_start_time text, + OUT bucket_start_time timestamp, OUT calls int8, -- 16 diff --git a/pg_stat_monitor--1.0.sql b/pg_stat_monitor--1.0.sql index 0321479..186d29a 100644 --- a/pg_stat_monitor--1.0.sql +++ b/pg_stat_monitor--1.0.sql @@ -139,7 +139,7 @@ CREATE FUNCTION pg_stat_monitor_internal( OUT elevel int, OUT sqlcode TEXT, OUT message text, - OUT bucket_start_time text, + OUT bucket_start_time timestamp, OUT calls int8, -- 16 @@ -190,7 +190,7 @@ $$ BEGIN CREATE VIEW pg_stat_monitor AS SELECT bucket, - bucket_start_time AS bucket_start_time, + bucket_start_time::text AS bucket_start_time, userid::regrole, datname, '0.0.0.0'::inet + client_ip AS client_ip, @@ -247,7 +247,7 @@ $$ BEGIN CREATE VIEW pg_stat_monitor AS SELECT bucket, - bucket_start_time AS bucket_start_time, + bucket_start_time::text AS bucket_start_time, userid::regrole, datname, '0.0.0.0'::inet + client_ip AS client_ip, @@ -307,7 +307,7 @@ $$ BEGIN CREATE VIEW pg_stat_monitor AS SELECT bucket, - bucket_start_time AS bucket_start_time, + bucket_start_time::text AS bucket_start_time, userid::regrole, datname, '0.0.0.0'::inet + client_ip AS client_ip, diff --git a/pg_stat_monitor--2.0.sql b/pg_stat_monitor--2.0.sql index 339469a..1e87873 100644 --- a/pg_stat_monitor--2.0.sql +++ b/pg_stat_monitor--2.0.sql @@ -126,7 +126,7 @@ CREATE FUNCTION pg_stat_monitor_internal( OUT elevel int, OUT sqlcode TEXT, OUT message text, - OUT bucket_start_time text, + OUT bucket_start_time timestamp, OUT calls int8, -- 16 diff --git a/pg_stat_monitor.c b/pg_stat_monitor.c index 76cf180..6a22bdc 100644 --- a/pg_stat_monitor.c +++ b/pg_stat_monitor.c @@ -1845,7 +1845,7 @@ pg_stat_monitor_internal(FunctionCallInfo fcinfo, values[i++] = CStringGetTextDatum(tmp.error.message); /* bucket_start_time at column number 15 */ - values[i++] = CStringGetTextDatum(pgss->bucket_start_time[entry->key.bucket_id]); + values[i++] = CStringGetDatum(pgss->bucket_start_time[entry->key.bucket_id]); if (tmp.calls.calls == 0) { /* Query of pg_stat_monitor itslef started from zero count */