From ece60b55de373c495e8508cdda89518282aa5517 Mon Sep 17 00:00:00 2001 From: lsv Date: Fri, 12 Sep 2025 14:59:39 +0500 Subject: [PATCH] View change last timestamp for functions MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Выводит время последнего изменения функции/процедуры, если включено track_commit_timestamp=on. --- include/schema/pgFunction.h | 9 ++++++++- schema/pgFunction.cpp | 8 +++++++- 2 files changed, 15 insertions(+), 2 deletions(-) diff --git a/include/schema/pgFunction.h b/include/schema/pgFunction.h index 31f3c08..d705e5c 100644 --- a/include/schema/pgFunction.h +++ b/include/schema/pgFunction.h @@ -194,6 +194,13 @@ public: { return isWindow; } + void iSetTimestampCommit(wxString& ts) + { + timestampCommit=ts; + } + wxString GetTimestampCommit() { + return timestampCommit; + } void iSetIsWindow(bool b) { isWindow = b; @@ -259,7 +266,7 @@ protected: pgFunction(pgSchema *newSchema, int newType, const wxString &newName = wxT("")); private: - wxString returnType, language, volatility, parallel, source, bin; + wxString returnType, language, volatility, parallel, source, bin, timestampCommit; wxArrayString argNamesArray, argTypesArray, argModesArray, argDefsArray; bool returnAsSet, secureDefiner, isStrict, isWindow, isLeakProof; long argCount, cost, rows, argDefValCount, procType; diff --git a/schema/pgFunction.cpp b/schema/pgFunction.cpp index 2e2a694..e31d7f2 100644 --- a/schema/pgFunction.cpp +++ b/schema/pgFunction.cpp @@ -423,6 +423,7 @@ void pgFunction::ShowTreeDetail(ctlTree *browser, frmMain *form, ctlListView *pr } properties->AppendItem(_("ACL"), GetAcl()); + if (!GetTimestampCommit().IsEmpty()) properties->AppendItem(_("Last change timestamp"), GetTimestampCommit()); properties->AppendYesNoItem(_("System function?"), GetSystemObject()); properties->AppendItem(_("Comment"), firstLineOnly(GetComment())); @@ -702,6 +703,10 @@ pgFunction *pgFunctionFactory::AppendFunctions(pgObject *obj, pgSchema *schema, { sqlprokind= wxT("case when proisagg then 'a' when proiswindow then 'w' else 'f' end prokind, "); } + if (obj->GetConnection()->HasFeature(FEATURE_TRACK_COMMIT_TS)) + sqlprokind+="pg_xact_commit_timestamp(pr.xmin) ts, "; + else + sqlprokind+="null ts, "; functions = obj->GetDatabase()->ExecuteSet( wxT("SELECT pr.oid, pr.xmin, pr.*,lanname, pg_get_function_result(pr.oid) AS typname, typns.nspname AS typnsp, ") +sqlprokind+ argNamesCol + argDefsCol + proConfigCol + proType + @@ -824,7 +829,8 @@ pgFunction *pgFunctionFactory::AppendFunctions(pgObject *obj, pgSchema *schema, } else function->iSetIsWindow(false); - + wxString timestamp = functions->GetVal("ts"); + function->iSetTimestampCommit(timestamp); // Now iterate the arguments and build the arrays wxString type, name, mode; size_t nArgsIN = 0;