diff options
author | Timofey Koolin <rekby@users.noreply.github.com> | 2024-04-08 13:16:35 +0300 |
---|---|---|
committer | GitHub <noreply@github.com> | 2024-04-08 13:16:35 +0300 |
commit | 20ee051fca60c937a9c7a44f9ddd63f4db32e314 (patch) | |
tree | 59ce1462bcfd70b1da5956e308be1d5f9633c511 | |
parent | 7ccec7095a02bb365cb4574a9de97ad068dbdcaf (diff) | |
download | ydb-20ee051fca60c937a9c7a44f9ddd63f4db32e314.tar.gz |
patches for zabbix and wiki (#2912)
-rw-r--r-- | ydb/library/yql/parser/pg_catalog/catalog.cpp | 33 | ||||
-rw-r--r-- | ydb/library/yql/sql/pg/pg_sql.cpp | 19 |
2 files changed, 51 insertions, 1 deletions
diff --git a/ydb/library/yql/parser/pg_catalog/catalog.cpp b/ydb/library/yql/parser/pg_catalog/catalog.cpp index cacdd231542..e90826b73cb 100644 --- a/ydb/library/yql/parser/pg_catalog/catalog.cpp +++ b/ydb/library/yql/parser/pg_catalog/catalog.cpp @@ -5,6 +5,7 @@ #include <util/string/builder.h> #include <util/string/cast.h> #include <util/string/split.h> +#include <util/system/env.h> #include <library/cpp/resource/resource.h> namespace NYql::NPg { @@ -1429,7 +1430,7 @@ ui32 FindOperator(const THashMap<TString, TVector<ui32>>& operatorsByName, const return operId; } - + // for example, some operators are based on SQL system_functions.sql return 0; } @@ -1611,6 +1612,36 @@ struct TCatalog { #include "columns.generated.h" }) { + if ( GetEnv("YDB_EXPERIMENTAL_PG") == "1"){ + // zabbix config + AllStaticTables.push_back( + {{"public", "config"}, ERelKind::Relation, 100001} + ); + AllStaticColumns.push_back( + {"public", "config", "configid", "bigint"} + ); + AllStaticColumns.push_back( + {"public", "config", "server_check_interval", "integer"} + ); + + AllStaticColumns.push_back( + {"public", "config", "dbversion_status", "text"} + ); + + // zabbix dbversion + AllStaticTables.push_back( + {{"public", "dbversion"}, ERelKind::Relation, 100002} + ); + AllStaticColumns.push_back( + {"public", "dbversion", "dbversionid", "bigint"} + ); + AllStaticColumns.push_back( + {"public", "dbversion", "mandatory", "integer"} + ); + AllStaticColumns.push_back( + {"public", "dbversion", "mandatory", "optional"} + ); + } THashSet<ui32> usedTableOids; for (const auto& t : AllStaticTables) { StaticColumns.insert(std::make_pair(t, TVector<TColumnInfo>())); diff --git a/ydb/library/yql/sql/pg/pg_sql.cpp b/ydb/library/yql/sql/pg/pg_sql.cpp index 5e52477864f..8fdaf80a148 100644 --- a/ydb/library/yql/sql/pg/pg_sql.cpp +++ b/ydb/library/yql/sql/pg/pg_sql.cpp @@ -475,6 +475,7 @@ public: "escape_string_warning", // zabbix "bytea_output", // zabbix "datestyle", // pgadmin 4 + "timezone", // mediawiki NULL, }; @@ -2486,6 +2487,13 @@ public: if (varName == "standard_conforming_strings"){ return "on"; } + if (varName == "search_path"){ + auto searchPath = Settings.GUCSettings->Get("search_path"); + return searchPath ? *searchPath : "public"; + } + if (varName == "default_transaction_read_only"){ + return "off"; // mediawiki + } if (varName == "transaction_isolation"){ return "serializable"; } @@ -3724,6 +3732,17 @@ public: return L(A("Null")); } + // for zabbix https://github.com/ydb-platform/ydb/issues/2904 + if (name == "pg_try_advisory_lock" || name == "pg_try_advisory_lock_shared" || name == "pg_advisory_unlock" || name == "pg_try_advisory_xact_lock" || name == "pg_try_advisory_xact_lock_shared"){ + AddWarning(TIssuesIds::PG_COMPAT, name + " function forced to return OK without waiting and without really lock/unlock"); + return L(A("PgConst"), QA("true"), L(A("PgType"), QA("bool"))); + } + + if (name == "pg_advisory_lock" || name == "pg_advisory_lock_shared" || name == "pg_advisory_unlock_all" || name == "pg_advisory_xact_lock" || name == "pg_advisory_xact_lock_shared"){ + AddWarning(TIssuesIds::PG_COMPAT, name + " function forced to return OK without waiting and without really lock/unlock"); + return L(A("Null")); + } + const bool isAggregateFunc = NYql::NPg::HasAggregation(name, NYql::NPg::EAggKind::Normal); const bool hasReturnSet = NYql::NPg::HasReturnSetProc(name); |