aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorvvvv <vvvv@ydb.tech>2023-09-29 19:37:45 +0300
committervvvv <vvvv@ydb.tech>2023-09-29 20:51:46 +0300
commit317a3cd8d45132dc3a55a9dcb2fb971ae7880158 (patch)
tree4ace1a406d9f2cd1e645d3ad1f53166fbab7fa89
parent7b0cc702c3872ab9f05472f76de1d3ee7eed22cf (diff)
downloadydb-317a3cd8d45132dc3a55a9dcb2fb971ae7880158.tar.gz
YQL-16602 support of conversions in catalog, start transaction during
init
-rw-r--r--ydb/library/yql/parser/pg_catalog/CMakeLists.darwin-x86_64.txt14
-rw-r--r--ydb/library/yql/parser/pg_catalog/CMakeLists.linux-aarch64.txt14
-rw-r--r--ydb/library/yql/parser/pg_catalog/CMakeLists.linux-x86_64.txt14
-rw-r--r--ydb/library/yql/parser/pg_catalog/CMakeLists.windows-x86_64.txt14
-rw-r--r--ydb/library/yql/parser/pg_catalog/catalog.cpp73
-rw-r--r--ydb/library/yql/parser/pg_catalog/catalog.h10
-rw-r--r--ydb/library/yql/parser/pg_catalog/ut/catalog_ut.cpp11
-rw-r--r--ydb/library/yql/parser/pg_catalog/ya.make1
-rw-r--r--ydb/library/yql/parser/pg_wrapper/CMakeLists.darwin-x86_64.txt2
-rw-r--r--ydb/library/yql/parser/pg_wrapper/CMakeLists.linux-aarch64.txt2
-rw-r--r--ydb/library/yql/parser/pg_wrapper/CMakeLists.linux-x86_64.txt2
-rw-r--r--ydb/library/yql/parser/pg_wrapper/CMakeLists.windows-x86_64.txt2
-rw-r--r--ydb/library/yql/parser/pg_wrapper/conversion.cpp12
-rw-r--r--ydb/library/yql/parser/pg_wrapper/parser.cpp7
-rw-r--r--ydb/library/yql/parser/pg_wrapper/postgresql/src/backend/access/transam/xlog.c2
-rw-r--r--ydb/library/yql/parser/pg_wrapper/postgresql/src/backend/catalog/namespace.c2
-rw-r--r--ydb/library/yql/parser/pg_wrapper/postgresql/src/backend/utils/cache/inval.c2
-rw-r--r--ydb/library/yql/parser/pg_wrapper/postgresql/src/include/catalog/pg_conversion.dat405
-rw-r--r--ydb/library/yql/parser/pg_wrapper/recovery.cpp13
-rw-r--r--ydb/library/yql/parser/pg_wrapper/thread_inits.c6
-rw-r--r--ydb/library/yql/parser/pg_wrapper/ya.make2
21 files changed, 603 insertions, 7 deletions
diff --git a/ydb/library/yql/parser/pg_catalog/CMakeLists.darwin-x86_64.txt b/ydb/library/yql/parser/pg_catalog/CMakeLists.darwin-x86_64.txt
index c7770a93c7..b7a477d159 100644
--- a/ydb/library/yql/parser/pg_catalog/CMakeLists.darwin-x86_64.txt
+++ b/ydb/library/yql/parser/pg_catalog/CMakeLists.darwin-x86_64.txt
@@ -61,6 +61,12 @@ get_built_tool_path(
tools/rescompiler/bin
rescompiler
)
+get_built_tool_path(
+ TOOL_rescompiler_bin
+ TOOL_rescompiler_dependency
+ tools/rescompiler/bin
+ rescompiler
+)
add_library(yql-parser-pg_catalog)
target_link_libraries(yql-parser-pg_catalog PUBLIC
@@ -88,6 +94,7 @@ target_sources(yql-parser-pg_catalog.global PRIVATE
${CMAKE_BINARY_DIR}/ydb/library/yql/parser/pg_catalog/69148841cb58a458173a42fc4a2d34a5.cpp
${CMAKE_BINARY_DIR}/ydb/library/yql/parser/pg_catalog/ec0b500b671e1ef6896201d71c27c3a9.cpp
${CMAKE_BINARY_DIR}/ydb/library/yql/parser/pg_catalog/35d2aa467812d7360a78c1fae061c821.cpp
+ ${CMAKE_BINARY_DIR}/ydb/library/yql/parser/pg_catalog/d248668b32b6a4d36f76898f91cda187.cpp
)
resources(yql-parser-pg_catalog.global
${CMAKE_BINARY_DIR}/ydb/library/yql/parser/pg_catalog/eadca93c2963e941669f9c2a2aa57764.cpp
@@ -152,3 +159,10 @@ resources(yql-parser-pg_catalog.global
KEYS
pg_amop.dat
)
+resources(yql-parser-pg_catalog.global
+ ${CMAKE_BINARY_DIR}/ydb/library/yql/parser/pg_catalog/d248668b32b6a4d36f76898f91cda187.cpp
+ INPUTS
+ ${CMAKE_SOURCE_DIR}/ydb/library/yql/parser/pg_wrapper/postgresql/src/include/catalog/pg_conversion.dat
+ KEYS
+ pg_conversion.dat
+)
diff --git a/ydb/library/yql/parser/pg_catalog/CMakeLists.linux-aarch64.txt b/ydb/library/yql/parser/pg_catalog/CMakeLists.linux-aarch64.txt
index 8e351488eb..fc69e701c9 100644
--- a/ydb/library/yql/parser/pg_catalog/CMakeLists.linux-aarch64.txt
+++ b/ydb/library/yql/parser/pg_catalog/CMakeLists.linux-aarch64.txt
@@ -61,6 +61,12 @@ get_built_tool_path(
tools/rescompiler/bin
rescompiler
)
+get_built_tool_path(
+ TOOL_rescompiler_bin
+ TOOL_rescompiler_dependency
+ tools/rescompiler/bin
+ rescompiler
+)
add_library(yql-parser-pg_catalog)
target_link_libraries(yql-parser-pg_catalog PUBLIC
@@ -90,6 +96,7 @@ target_sources(yql-parser-pg_catalog.global PRIVATE
${CMAKE_BINARY_DIR}/ydb/library/yql/parser/pg_catalog/69148841cb58a458173a42fc4a2d34a5.cpp
${CMAKE_BINARY_DIR}/ydb/library/yql/parser/pg_catalog/ec0b500b671e1ef6896201d71c27c3a9.cpp
${CMAKE_BINARY_DIR}/ydb/library/yql/parser/pg_catalog/35d2aa467812d7360a78c1fae061c821.cpp
+ ${CMAKE_BINARY_DIR}/ydb/library/yql/parser/pg_catalog/d248668b32b6a4d36f76898f91cda187.cpp
)
resources(yql-parser-pg_catalog.global
${CMAKE_BINARY_DIR}/ydb/library/yql/parser/pg_catalog/eadca93c2963e941669f9c2a2aa57764.cpp
@@ -154,3 +161,10 @@ resources(yql-parser-pg_catalog.global
KEYS
pg_amop.dat
)
+resources(yql-parser-pg_catalog.global
+ ${CMAKE_BINARY_DIR}/ydb/library/yql/parser/pg_catalog/d248668b32b6a4d36f76898f91cda187.cpp
+ INPUTS
+ ${CMAKE_SOURCE_DIR}/ydb/library/yql/parser/pg_wrapper/postgresql/src/include/catalog/pg_conversion.dat
+ KEYS
+ pg_conversion.dat
+)
diff --git a/ydb/library/yql/parser/pg_catalog/CMakeLists.linux-x86_64.txt b/ydb/library/yql/parser/pg_catalog/CMakeLists.linux-x86_64.txt
index 8e351488eb..fc69e701c9 100644
--- a/ydb/library/yql/parser/pg_catalog/CMakeLists.linux-x86_64.txt
+++ b/ydb/library/yql/parser/pg_catalog/CMakeLists.linux-x86_64.txt
@@ -61,6 +61,12 @@ get_built_tool_path(
tools/rescompiler/bin
rescompiler
)
+get_built_tool_path(
+ TOOL_rescompiler_bin
+ TOOL_rescompiler_dependency
+ tools/rescompiler/bin
+ rescompiler
+)
add_library(yql-parser-pg_catalog)
target_link_libraries(yql-parser-pg_catalog PUBLIC
@@ -90,6 +96,7 @@ target_sources(yql-parser-pg_catalog.global PRIVATE
${CMAKE_BINARY_DIR}/ydb/library/yql/parser/pg_catalog/69148841cb58a458173a42fc4a2d34a5.cpp
${CMAKE_BINARY_DIR}/ydb/library/yql/parser/pg_catalog/ec0b500b671e1ef6896201d71c27c3a9.cpp
${CMAKE_BINARY_DIR}/ydb/library/yql/parser/pg_catalog/35d2aa467812d7360a78c1fae061c821.cpp
+ ${CMAKE_BINARY_DIR}/ydb/library/yql/parser/pg_catalog/d248668b32b6a4d36f76898f91cda187.cpp
)
resources(yql-parser-pg_catalog.global
${CMAKE_BINARY_DIR}/ydb/library/yql/parser/pg_catalog/eadca93c2963e941669f9c2a2aa57764.cpp
@@ -154,3 +161,10 @@ resources(yql-parser-pg_catalog.global
KEYS
pg_amop.dat
)
+resources(yql-parser-pg_catalog.global
+ ${CMAKE_BINARY_DIR}/ydb/library/yql/parser/pg_catalog/d248668b32b6a4d36f76898f91cda187.cpp
+ INPUTS
+ ${CMAKE_SOURCE_DIR}/ydb/library/yql/parser/pg_wrapper/postgresql/src/include/catalog/pg_conversion.dat
+ KEYS
+ pg_conversion.dat
+)
diff --git a/ydb/library/yql/parser/pg_catalog/CMakeLists.windows-x86_64.txt b/ydb/library/yql/parser/pg_catalog/CMakeLists.windows-x86_64.txt
index c7770a93c7..b7a477d159 100644
--- a/ydb/library/yql/parser/pg_catalog/CMakeLists.windows-x86_64.txt
+++ b/ydb/library/yql/parser/pg_catalog/CMakeLists.windows-x86_64.txt
@@ -61,6 +61,12 @@ get_built_tool_path(
tools/rescompiler/bin
rescompiler
)
+get_built_tool_path(
+ TOOL_rescompiler_bin
+ TOOL_rescompiler_dependency
+ tools/rescompiler/bin
+ rescompiler
+)
add_library(yql-parser-pg_catalog)
target_link_libraries(yql-parser-pg_catalog PUBLIC
@@ -88,6 +94,7 @@ target_sources(yql-parser-pg_catalog.global PRIVATE
${CMAKE_BINARY_DIR}/ydb/library/yql/parser/pg_catalog/69148841cb58a458173a42fc4a2d34a5.cpp
${CMAKE_BINARY_DIR}/ydb/library/yql/parser/pg_catalog/ec0b500b671e1ef6896201d71c27c3a9.cpp
${CMAKE_BINARY_DIR}/ydb/library/yql/parser/pg_catalog/35d2aa467812d7360a78c1fae061c821.cpp
+ ${CMAKE_BINARY_DIR}/ydb/library/yql/parser/pg_catalog/d248668b32b6a4d36f76898f91cda187.cpp
)
resources(yql-parser-pg_catalog.global
${CMAKE_BINARY_DIR}/ydb/library/yql/parser/pg_catalog/eadca93c2963e941669f9c2a2aa57764.cpp
@@ -152,3 +159,10 @@ resources(yql-parser-pg_catalog.global
KEYS
pg_amop.dat
)
+resources(yql-parser-pg_catalog.global
+ ${CMAKE_BINARY_DIR}/ydb/library/yql/parser/pg_catalog/d248668b32b6a4d36f76898f91cda187.cpp
+ INPUTS
+ ${CMAKE_SOURCE_DIR}/ydb/library/yql/parser/pg_wrapper/postgresql/src/include/catalog/pg_conversion.dat
+ KEYS
+ pg_conversion.dat
+)
diff --git a/ydb/library/yql/parser/pg_catalog/catalog.cpp b/ydb/library/yql/parser/pg_catalog/catalog.cpp
index 9cf5f35183..d6f7d6690f 100644
--- a/ydb/library/yql/parser/pg_catalog/catalog.cpp
+++ b/ydb/library/yql/parser/pg_catalog/catalog.cpp
@@ -38,6 +38,8 @@ using TAmOps = THashMap<std::tuple<ui32, ui32, ui32, ui32>, TAmOpDesc>;
using TAmProcs = THashMap<std::tuple<ui32, ui32, ui32, ui32>, TAmProcDesc>;
+using TConversions = THashMap<std::pair<TString, TString>, TConversionDesc>;
+
bool IsCompatibleTo(ui32 actualTypeId, ui32 expectedTypeId, const TTypes& types) {
if (actualTypeId == expectedTypeId) {
return true;
@@ -372,7 +374,9 @@ public:
} else if (key == "prosrc") {
LastProc.Src = value;
} else if (key == "prolang") {
- IsSupported = false;
+ if (value != "c") {
+ IsSupported = false;
+ }
} else if (key == "proargtypes") {
TVector<TString> strArgs;
Split(value, " ", strArgs);
@@ -1092,6 +1096,46 @@ private:
bool IsSupported = true;
};
+class TConversionsParser : public TParser {
+public:
+ TConversionsParser(TConversions& conversions, const THashMap<TString, TVector<ui32>>& procByName)
+ : Conversions(conversions)
+ , ProcByName(procByName)
+ {}
+
+ void OnKey(const TString& key, const TString& value) override {
+ if (key == "oid") {
+ LastConversion.ConversionId = FromString<ui32>(value);
+ } else if (key == "conforencoding") {
+ Y_ENSURE(value.StartsWith("PG_"));
+ LastConversion.From = value.substr(3);
+ } else if (key == "contoencoding") {
+ Y_ENSURE(value.StartsWith("PG_"));
+ LastConversion.To = value.substr(3);
+ } else if (key == "conproc") {
+ auto found = ProcByName.FindPtr(value);
+ if (found && found->size() == 1) {
+ LastConversion.ProcId = found->front();
+ }
+ }
+ }
+
+ void OnFinish() override {
+ if (LastConversion.ProcId) {
+ Conversions[std::make_pair(LastConversion.From, LastConversion.To)] = LastConversion;
+ }
+
+ LastConversion = TConversionDesc();
+ }
+
+private:
+ TConversions& Conversions;
+
+ const THashMap<TString, TVector<ui32>>& ProcByName;
+
+ TConversionDesc LastConversion;
+};
+
TOperators ParseOperators(const TString& dat, const THashMap<TString, ui32>& typeByName,
const TTypes& types, const THashMap<TString, TVector<ui32>>& procByName, const TProcs& procs) {
TOperators ret;
@@ -1163,6 +1207,13 @@ TAmProcs ParseAmProcs(const TString& dat, const THashMap<TString, ui32>& typeByN
return ret;
}
+TConversions ParseConversions(const TString& dat, const THashMap<TString, TVector<ui32>>& procByName) {
+ TConversions ret;
+ TConversionsParser parser(ret, procByName);
+ parser.Do(dat);
+ return ret;
+}
+
struct TCatalog {
TCatalog() {
TString typeData;
@@ -1183,6 +1234,8 @@ struct TCatalog {
Y_ENSURE(NResource::FindExact("pg_amproc.dat", &amProcData));
TString amOpData;
Y_ENSURE(NResource::FindExact("pg_amop.dat", &amOpData));
+ TString conversionData;
+ Y_ENSURE(NResource::FindExact("pg_conversion.dat", &conversionData));
THashMap<ui32, TLazyTypeInfo> lazyTypeInfos;
Types = ParseTypes(typeData, lazyTypeInfos);
for (const auto& [k, v] : Types) {
@@ -1333,6 +1386,8 @@ struct TCatalog {
}
}
}
+
+ Conversions = ParseConversions(conversionData, ProcByName);
}
static const TCatalog& Instance() {
@@ -1347,6 +1402,7 @@ struct TCatalog {
TOpClasses OpClasses;
TAmOps AmOps;
TAmProcs AmProcs;
+ TConversions Conversions;
THashMap<TString, TVector<ui32>> ProcByName;
THashMap<TString, ui32> TypeByName;
THashMap<std::pair<ui32, ui32>, ui32> CastsByDir;
@@ -2421,6 +2477,21 @@ const TAmProcDesc& LookupAmProc(ui32 familyId, ui32 num, ui32 leftType, ui32 rig
return *amProcPtr;
}
+bool HasConversion(const TString& from, const TString& to) {
+ const auto &catalog = TCatalog::Instance();
+ return catalog.Conversions.contains(std::make_pair(from, to));
+}
+
+const TConversionDesc& LookupConversion(const TString& from, const TString& to) {
+ const auto& catalog = TCatalog::Instance();
+ auto convPtr = catalog.Conversions.FindPtr(std::make_pair(from, to));
+ if (!convPtr) {
+ throw yexception() << "No such conversion from " << from << " to " << to;
+ }
+
+ return *convPtr;
+}
+
bool IsCompatibleTo(ui32 actualType, ui32 expectedType) {
const auto& catalog = TCatalog::Instance();
return IsCompatibleTo(actualType, expectedType, catalog.Types);
diff --git a/ydb/library/yql/parser/pg_catalog/catalog.h b/ydb/library/yql/parser/pg_catalog/catalog.h
index db1c629657..a26d2740c4 100644
--- a/ydb/library/yql/parser/pg_catalog/catalog.h
+++ b/ydb/library/yql/parser/pg_catalog/catalog.h
@@ -195,6 +195,13 @@ enum class EHashAmProcNum {
Hash = 1
};
+struct TConversionDesc {
+ ui32 ConversionId = 0;
+ TString From;
+ TString To;
+ ui32 ProcId = 0;
+};
+
const TProcDesc& LookupProc(const TString& name, const TVector<ui32>& argTypeIds);
const TProcDesc& LookupProc(ui32 procId, const TVector<ui32>& argTypeIds);
const TProcDesc& LookupProc(ui32 procId);
@@ -230,6 +237,9 @@ const TAmOpDesc& LookupAmOp(ui32 familyId, ui32 strategy, ui32 leftType, ui32 ri
bool HasAmProc(ui32 familyId, ui32 num, ui32 leftType, ui32 rightType);
const TAmProcDesc& LookupAmProc(ui32 familyId, ui32 num, ui32 leftType, ui32 rightType);
+bool HasConversion(const TString& from, const TString& to);
+const TConversionDesc& LookupConversion(const TString& from, const TString& to);
+
bool IsCompatibleTo(ui32 actualType, ui32 expectedType);
inline bool IsArrayType(const TTypeDesc& typeDesc) noexcept {
diff --git a/ydb/library/yql/parser/pg_catalog/ut/catalog_ut.cpp b/ydb/library/yql/parser/pg_catalog/ut/catalog_ut.cpp
index 045518a3b9..38ca396901 100644
--- a/ydb/library/yql/parser/pg_catalog/ut/catalog_ut.cpp
+++ b/ydb/library/yql/parser/pg_catalog/ut/catalog_ut.cpp
@@ -197,3 +197,14 @@ Y_UNIT_TEST_SUITE(TOpClassesTests) {
UNIT_ASSERT_VALUES_EQUAL(ret.FamilyId, 1977);
}
}
+
+Y_UNIT_TEST_SUITE(TConversionTests) {
+ Y_UNIT_TEST(TestMissing) {
+ UNIT_ASSERT_EXCEPTION(LookupConversion("foo", "bar"), yexception);
+ }
+
+ Y_UNIT_TEST(TestOk) {
+ auto procId = LookupConversion("LATIN1", "UTF8").ProcId;
+ UNIT_ASSERT_VALUES_EQUAL(LookupProc(procId).Name, "iso8859_1_to_utf8");
+ }
+}
diff --git a/ydb/library/yql/parser/pg_catalog/ya.make b/ydb/library/yql/parser/pg_catalog/ya.make
index aa0bff4170..b408a46914 100644
--- a/ydb/library/yql/parser/pg_catalog/ya.make
+++ b/ydb/library/yql/parser/pg_catalog/ya.make
@@ -9,6 +9,7 @@ RESOURCE(../pg_wrapper/postgresql/src/include/catalog/pg_opfamily.dat pg_opfamil
RESOURCE(../pg_wrapper/postgresql/src/include/catalog/pg_opclass.dat pg_opclass.dat)
RESOURCE(../pg_wrapper/postgresql/src/include/catalog/pg_amproc.dat pg_amproc.dat)
RESOURCE(../pg_wrapper/postgresql/src/include/catalog/pg_amop.dat pg_amop.dat)
+RESOURCE(../pg_wrapper/postgresql/src/include/catalog/pg_conversion.dat pg_conversion.dat)
SRCS(
catalog.cpp
diff --git a/ydb/library/yql/parser/pg_wrapper/CMakeLists.darwin-x86_64.txt b/ydb/library/yql/parser/pg_wrapper/CMakeLists.darwin-x86_64.txt
index d3a83e16e7..d740c6709f 100644
--- a/ydb/library/yql/parser/pg_wrapper/CMakeLists.darwin-x86_64.txt
+++ b/ydb/library/yql/parser/pg_wrapper/CMakeLists.darwin-x86_64.txt
@@ -147,6 +147,7 @@ target_sources(yql-parser-pg_wrapper PRIVATE
${CMAKE_SOURCE_DIR}/ydb/library/yql/parser/pg_wrapper/arena_ctx.cpp
${CMAKE_SOURCE_DIR}/ydb/library/yql/parser/pg_wrapper/arrow.cpp
${CMAKE_SOURCE_DIR}/ydb/library/yql/parser/pg_wrapper/arrow_impl.cpp
+ ${CMAKE_SOURCE_DIR}/ydb/library/yql/parser/pg_wrapper/conversion.cpp
${CMAKE_SOURCE_DIR}/ydb/library/yql/parser/pg_wrapper/parser.cpp
${CMAKE_SOURCE_DIR}/ydb/library/yql/parser/pg_wrapper/thread_inits.c
${CMAKE_SOURCE_DIR}/ydb/library/yql/parser/pg_wrapper/comp_factory.cpp
@@ -156,6 +157,7 @@ target_sources(yql-parser-pg_wrapper PRIVATE
${CMAKE_SOURCE_DIR}/ydb/library/yql/parser/pg_wrapper/pg_kernels.1.cpp
${CMAKE_SOURCE_DIR}/ydb/library/yql/parser/pg_wrapper/pg_kernels.2.cpp
${CMAKE_SOURCE_DIR}/ydb/library/yql/parser/pg_wrapper/pg_kernels.3.cpp
+ ${CMAKE_SOURCE_DIR}/ydb/library/yql/parser/pg_wrapper/recovery.cpp
${CMAKE_SOURCE_DIR}/ydb/library/yql/parser/pg_wrapper/superuser.cpp
${CMAKE_SOURCE_DIR}/ydb/library/yql/parser/pg_wrapper/config.cpp
${CMAKE_SOURCE_DIR}/ydb/library/yql/parser/pg_wrapper/cost_mocks.cpp
diff --git a/ydb/library/yql/parser/pg_wrapper/CMakeLists.linux-aarch64.txt b/ydb/library/yql/parser/pg_wrapper/CMakeLists.linux-aarch64.txt
index bc73fa2d01..12f45af138 100644
--- a/ydb/library/yql/parser/pg_wrapper/CMakeLists.linux-aarch64.txt
+++ b/ydb/library/yql/parser/pg_wrapper/CMakeLists.linux-aarch64.txt
@@ -146,6 +146,7 @@ target_sources(yql-parser-pg_wrapper PRIVATE
${CMAKE_SOURCE_DIR}/ydb/library/yql/parser/pg_wrapper/arena_ctx.cpp
${CMAKE_SOURCE_DIR}/ydb/library/yql/parser/pg_wrapper/arrow.cpp
${CMAKE_SOURCE_DIR}/ydb/library/yql/parser/pg_wrapper/arrow_impl.cpp
+ ${CMAKE_SOURCE_DIR}/ydb/library/yql/parser/pg_wrapper/conversion.cpp
${CMAKE_SOURCE_DIR}/ydb/library/yql/parser/pg_wrapper/parser.cpp
${CMAKE_SOURCE_DIR}/ydb/library/yql/parser/pg_wrapper/thread_inits.c
${CMAKE_SOURCE_DIR}/ydb/library/yql/parser/pg_wrapper/comp_factory.cpp
@@ -155,6 +156,7 @@ target_sources(yql-parser-pg_wrapper PRIVATE
${CMAKE_SOURCE_DIR}/ydb/library/yql/parser/pg_wrapper/pg_kernels.1.cpp
${CMAKE_SOURCE_DIR}/ydb/library/yql/parser/pg_wrapper/pg_kernels.2.cpp
${CMAKE_SOURCE_DIR}/ydb/library/yql/parser/pg_wrapper/pg_kernels.3.cpp
+ ${CMAKE_SOURCE_DIR}/ydb/library/yql/parser/pg_wrapper/recovery.cpp
${CMAKE_SOURCE_DIR}/ydb/library/yql/parser/pg_wrapper/superuser.cpp
${CMAKE_SOURCE_DIR}/ydb/library/yql/parser/pg_wrapper/config.cpp
${CMAKE_SOURCE_DIR}/ydb/library/yql/parser/pg_wrapper/cost_mocks.cpp
diff --git a/ydb/library/yql/parser/pg_wrapper/CMakeLists.linux-x86_64.txt b/ydb/library/yql/parser/pg_wrapper/CMakeLists.linux-x86_64.txt
index 76ad65b8e2..38925c93a5 100644
--- a/ydb/library/yql/parser/pg_wrapper/CMakeLists.linux-x86_64.txt
+++ b/ydb/library/yql/parser/pg_wrapper/CMakeLists.linux-x86_64.txt
@@ -148,6 +148,7 @@ target_sources(yql-parser-pg_wrapper PRIVATE
${CMAKE_SOURCE_DIR}/ydb/library/yql/parser/pg_wrapper/arena_ctx.cpp
${CMAKE_SOURCE_DIR}/ydb/library/yql/parser/pg_wrapper/arrow.cpp
${CMAKE_SOURCE_DIR}/ydb/library/yql/parser/pg_wrapper/arrow_impl.cpp
+ ${CMAKE_SOURCE_DIR}/ydb/library/yql/parser/pg_wrapper/conversion.cpp
${CMAKE_SOURCE_DIR}/ydb/library/yql/parser/pg_wrapper/parser.cpp
${CMAKE_SOURCE_DIR}/ydb/library/yql/parser/pg_wrapper/thread_inits.c
${CMAKE_SOURCE_DIR}/ydb/library/yql/parser/pg_wrapper/comp_factory.cpp
@@ -157,6 +158,7 @@ target_sources(yql-parser-pg_wrapper PRIVATE
${CMAKE_SOURCE_DIR}/ydb/library/yql/parser/pg_wrapper/pg_kernels.1.cpp
${CMAKE_SOURCE_DIR}/ydb/library/yql/parser/pg_wrapper/pg_kernels.2.cpp
${CMAKE_SOURCE_DIR}/ydb/library/yql/parser/pg_wrapper/pg_kernels.3.cpp
+ ${CMAKE_SOURCE_DIR}/ydb/library/yql/parser/pg_wrapper/recovery.cpp
${CMAKE_SOURCE_DIR}/ydb/library/yql/parser/pg_wrapper/superuser.cpp
${CMAKE_SOURCE_DIR}/ydb/library/yql/parser/pg_wrapper/config.cpp
${CMAKE_SOURCE_DIR}/ydb/library/yql/parser/pg_wrapper/cost_mocks.cpp
diff --git a/ydb/library/yql/parser/pg_wrapper/CMakeLists.windows-x86_64.txt b/ydb/library/yql/parser/pg_wrapper/CMakeLists.windows-x86_64.txt
index e70d3c9a44..433e46b638 100644
--- a/ydb/library/yql/parser/pg_wrapper/CMakeLists.windows-x86_64.txt
+++ b/ydb/library/yql/parser/pg_wrapper/CMakeLists.windows-x86_64.txt
@@ -162,6 +162,7 @@ target_sources(yql-parser-pg_wrapper PRIVATE
${CMAKE_SOURCE_DIR}/ydb/library/yql/parser/pg_wrapper/arena_ctx.cpp
${CMAKE_SOURCE_DIR}/ydb/library/yql/parser/pg_wrapper/arrow.cpp
${CMAKE_SOURCE_DIR}/ydb/library/yql/parser/pg_wrapper/arrow_impl.cpp
+ ${CMAKE_SOURCE_DIR}/ydb/library/yql/parser/pg_wrapper/conversion.cpp
${CMAKE_SOURCE_DIR}/ydb/library/yql/parser/pg_wrapper/parser.cpp
${CMAKE_SOURCE_DIR}/ydb/library/yql/parser/pg_wrapper/thread_inits.c
${CMAKE_SOURCE_DIR}/ydb/library/yql/parser/pg_wrapper/comp_factory.cpp
@@ -171,6 +172,7 @@ target_sources(yql-parser-pg_wrapper PRIVATE
${CMAKE_SOURCE_DIR}/ydb/library/yql/parser/pg_wrapper/pg_kernels.1.cpp
${CMAKE_SOURCE_DIR}/ydb/library/yql/parser/pg_wrapper/pg_kernels.2.cpp
${CMAKE_SOURCE_DIR}/ydb/library/yql/parser/pg_wrapper/pg_kernels.3.cpp
+ ${CMAKE_SOURCE_DIR}/ydb/library/yql/parser/pg_wrapper/recovery.cpp
${CMAKE_SOURCE_DIR}/ydb/library/yql/parser/pg_wrapper/superuser.cpp
${CMAKE_SOURCE_DIR}/ydb/library/yql/parser/pg_wrapper/config.cpp
${CMAKE_SOURCE_DIR}/ydb/library/yql/parser/pg_wrapper/cost_mocks.cpp
diff --git a/ydb/library/yql/parser/pg_wrapper/conversion.cpp b/ydb/library/yql/parser/pg_wrapper/conversion.cpp
new file mode 100644
index 0000000000..7b754647a7
--- /dev/null
+++ b/ydb/library/yql/parser/pg_wrapper/conversion.cpp
@@ -0,0 +1,12 @@
+#include "pg_compat.h"
+
+extern "C" {
+#include "catalog/namespace.h"
+#include "mb/pg_wchar.h"
+}
+
+#include <ydb/library/yql/parser/pg_catalog/catalog.h>
+
+Oid FindDefaultConversionProc(int32 for_encoding, int32 to_encoding) {
+ return NYql::NPg::LookupConversion(pg_encoding_to_char(for_encoding), pg_encoding_to_char(to_encoding)).ProcId;
+}
diff --git a/ydb/library/yql/parser/pg_wrapper/parser.cpp b/ydb/library/yql/parser/pg_wrapper/parser.cpp
index 036844c5ef..a22a0cc81a 100644
--- a/ydb/library/yql/parser/pg_wrapper/parser.cpp
+++ b/ydb/library/yql/parser/pg_wrapper/parser.cpp
@@ -16,6 +16,7 @@
#undef SIZEOF_SIZE_T
extern "C" {
#include "postgres.h"
+#include "access/xact.h"
#include "mb/pg_wchar.h"
#include "nodes/pg_list.h"
#include "nodes/parsenodes.h"
@@ -30,6 +31,7 @@ extern "C" {
#include "port/pg_crc32c.h"
#include "postmaster/postmaster.h"
#include "storage/latch.h"
+#include "storage/proc.h"
#include "miscadmin.h"
#include "thread_inits.h"
#undef Abs
@@ -228,6 +230,7 @@ extern "C" void setup_pg_thread_cleanup() {
free_current_locale_conv();
ResourceOwnerDelete(CurrentResourceOwner);
MemoryContextDelete(TopMemoryContext);
+ free(MyProc);
}
};
@@ -250,4 +253,8 @@ extern "C" void setup_pg_thread_cleanup() {
MyLatch = &LocalLatchData;
InitLatch(MyLatch);
InitializeLatchWaitSet();
+
+ MyProc = (PGPROC*)malloc(sizeof(PGPROC));
+ Zero(*MyProc);
+ StartTransactionCommand();
};
diff --git a/ydb/library/yql/parser/pg_wrapper/postgresql/src/backend/access/transam/xlog.c b/ydb/library/yql/parser/pg_wrapper/postgresql/src/backend/access/transam/xlog.c
index c89d3f92a6..a9c96836ab 100644
--- a/ydb/library/yql/parser/pg_wrapper/postgresql/src/backend/access/transam/xlog.c
+++ b/ydb/library/yql/parser/pg_wrapper/postgresql/src/backend/access/transam/xlog.c
@@ -8291,7 +8291,7 @@ CheckRecoveryConsistency(void)
* variables the first time we see that recovery is finished.
*/
bool
-RecoveryInProgress(void)
+RecoveryInProgress_original(void)
{
/*
* We check shared state each time only until we leave recovery mode. We
diff --git a/ydb/library/yql/parser/pg_wrapper/postgresql/src/backend/catalog/namespace.c b/ydb/library/yql/parser/pg_wrapper/postgresql/src/backend/catalog/namespace.c
index ce51729bf6..1088fc19df 100644
--- a/ydb/library/yql/parser/pg_wrapper/postgresql/src/backend/catalog/namespace.c
+++ b/ydb/library/yql/parser/pg_wrapper/postgresql/src/backend/catalog/namespace.c
@@ -3752,7 +3752,7 @@ get_conversion_oid(List *name, bool missing_ok)
* FindDefaultConversionProc - find default encoding conversion proc
*/
Oid
-FindDefaultConversionProc(int32 for_encoding, int32 to_encoding)
+FindDefaultConversionProc_original(int32 for_encoding, int32 to_encoding)
{
Oid proc;
ListCell *l;
diff --git a/ydb/library/yql/parser/pg_wrapper/postgresql/src/backend/utils/cache/inval.c b/ydb/library/yql/parser/pg_wrapper/postgresql/src/backend/utils/cache/inval.c
index 90fa36298d..3d1e614af8 100644
--- a/ydb/library/yql/parser/pg_wrapper/postgresql/src/backend/utils/cache/inval.c
+++ b/ydb/library/yql/parser/pg_wrapper/postgresql/src/backend/utils/cache/inval.c
@@ -704,7 +704,7 @@ InvalidateSystemCachesExtended(bool debug_discard)
* This should be called as the first step in processing a transaction.
*/
void
-AcceptInvalidationMessages(void)
+AcceptInvalidationMessages_original(void)
{
ReceiveSharedInvalidMessages(LocalExecuteInvalidationMessage,
InvalidateSystemCaches);
diff --git a/ydb/library/yql/parser/pg_wrapper/postgresql/src/include/catalog/pg_conversion.dat b/ydb/library/yql/parser/pg_wrapper/postgresql/src/include/catalog/pg_conversion.dat
new file mode 100644
index 0000000000..d8ba3a6c52
--- /dev/null
+++ b/ydb/library/yql/parser/pg_wrapper/postgresql/src/include/catalog/pg_conversion.dat
@@ -0,0 +1,405 @@
+#----------------------------------------------------------------------
+#
+# pg_conversion.dat
+# Initial contents of the pg_conversion system catalog.
+#
+# Portions Copyright (c) 1996-2021, PostgreSQL Global Development Group
+# Portions Copyright (c) 1994, Regents of the University of California
+#
+# src/include/catalog/pg_conversion.dat
+#
+#----------------------------------------------------------------------
+
+# Note: conforencoding and contoencoding must match the spelling of
+# the labels used in the enum pg_enc in mb/pg_wchar.h.
+
+[
+
+{ oid => '4402', descr => 'conversion for KOI8R to MULE_INTERNAL',
+ conname => 'koi8_r_to_mic', conforencoding => 'PG_KOI8R',
+ contoencoding => 'PG_MULE_INTERNAL', conproc => 'koi8r_to_mic' },
+{ oid => '4403', descr => 'conversion for MULE_INTERNAL to KOI8R',
+ conname => 'mic_to_koi8_r', conforencoding => 'PG_MULE_INTERNAL',
+ contoencoding => 'PG_KOI8R', conproc => 'mic_to_koi8r' },
+{ oid => '4404', descr => 'conversion for ISO-8859-5 to MULE_INTERNAL',
+ conname => 'iso_8859_5_to_mic', conforencoding => 'PG_ISO_8859_5',
+ contoencoding => 'PG_MULE_INTERNAL', conproc => 'iso_to_mic' },
+{ oid => '4405', descr => 'conversion for MULE_INTERNAL to ISO-8859-5',
+ conname => 'mic_to_iso_8859_5', conforencoding => 'PG_MULE_INTERNAL',
+ contoencoding => 'PG_ISO_8859_5', conproc => 'mic_to_iso' },
+{ oid => '4406', descr => 'conversion for WIN1251 to MULE_INTERNAL',
+ conname => 'windows_1251_to_mic', conforencoding => 'PG_WIN1251',
+ contoencoding => 'PG_MULE_INTERNAL', conproc => 'win1251_to_mic' },
+{ oid => '4407', descr => 'conversion for MULE_INTERNAL to WIN1251',
+ conname => 'mic_to_windows_1251', conforencoding => 'PG_MULE_INTERNAL',
+ contoencoding => 'PG_WIN1251', conproc => 'mic_to_win1251' },
+{ oid => '4408', descr => 'conversion for WIN866 to MULE_INTERNAL',
+ conname => 'windows_866_to_mic', conforencoding => 'PG_WIN866',
+ contoencoding => 'PG_MULE_INTERNAL', conproc => 'win866_to_mic' },
+{ oid => '4409', descr => 'conversion for MULE_INTERNAL to WIN866',
+ conname => 'mic_to_windows_866', conforencoding => 'PG_MULE_INTERNAL',
+ contoencoding => 'PG_WIN866', conproc => 'mic_to_win866' },
+{ oid => '4410', descr => 'conversion for KOI8R to WIN1251',
+ conname => 'koi8_r_to_windows_1251', conforencoding => 'PG_KOI8R',
+ contoencoding => 'PG_WIN1251', conproc => 'koi8r_to_win1251' },
+{ oid => '4411', descr => 'conversion for WIN1251 to KOI8R',
+ conname => 'windows_1251_to_koi8_r', conforencoding => 'PG_WIN1251',
+ contoencoding => 'PG_KOI8R', conproc => 'win1251_to_koi8r' },
+{ oid => '4412', descr => 'conversion for KOI8R to WIN866',
+ conname => 'koi8_r_to_windows_866', conforencoding => 'PG_KOI8R',
+ contoencoding => 'PG_WIN866', conproc => 'koi8r_to_win866' },
+{ oid => '4413', descr => 'conversion for WIN866 to KOI8R',
+ conname => 'windows_866_to_koi8_r', conforencoding => 'PG_WIN866',
+ contoencoding => 'PG_KOI8R', conproc => 'win866_to_koi8r' },
+{ oid => '4414', descr => 'conversion for WIN866 to WIN1251',
+ conname => 'windows_866_to_windows_1251', conforencoding => 'PG_WIN866',
+ contoencoding => 'PG_WIN1251', conproc => 'win866_to_win1251' },
+{ oid => '4415', descr => 'conversion for WIN1251 to WIN866',
+ conname => 'windows_1251_to_windows_866', conforencoding => 'PG_WIN1251',
+ contoencoding => 'PG_WIN866', conproc => 'win1251_to_win866' },
+{ oid => '4416', descr => 'conversion for ISO-8859-5 to KOI8R',
+ conname => 'iso_8859_5_to_koi8_r', conforencoding => 'PG_ISO_8859_5',
+ contoencoding => 'PG_KOI8R', conproc => 'iso_to_koi8r' },
+{ oid => '4417', descr => 'conversion for KOI8R to ISO-8859-5',
+ conname => 'koi8_r_to_iso_8859_5', conforencoding => 'PG_KOI8R',
+ contoencoding => 'PG_ISO_8859_5', conproc => 'koi8r_to_iso' },
+{ oid => '4418', descr => 'conversion for ISO-8859-5 to WIN1251',
+ conname => 'iso_8859_5_to_windows_1251', conforencoding => 'PG_ISO_8859_5',
+ contoencoding => 'PG_WIN1251', conproc => 'iso_to_win1251' },
+{ oid => '4419', descr => 'conversion for WIN1251 to ISO-8859-5',
+ conname => 'windows_1251_to_iso_8859_5', conforencoding => 'PG_WIN1251',
+ contoencoding => 'PG_ISO_8859_5', conproc => 'win1251_to_iso' },
+{ oid => '4420', descr => 'conversion for ISO-8859-5 to WIN866',
+ conname => 'iso_8859_5_to_windows_866', conforencoding => 'PG_ISO_8859_5',
+ contoencoding => 'PG_WIN866', conproc => 'iso_to_win866' },
+{ oid => '4421', descr => 'conversion for WIN866 to ISO-8859-5',
+ conname => 'windows_866_to_iso_8859_5', conforencoding => 'PG_WIN866',
+ contoencoding => 'PG_ISO_8859_5', conproc => 'win866_to_iso' },
+{ oid => '4422', descr => 'conversion for EUC_CN to MULE_INTERNAL',
+ conname => 'euc_cn_to_mic', conforencoding => 'PG_EUC_CN',
+ contoencoding => 'PG_MULE_INTERNAL', conproc => 'euc_cn_to_mic' },
+{ oid => '4423', descr => 'conversion for MULE_INTERNAL to EUC_CN',
+ conname => 'mic_to_euc_cn', conforencoding => 'PG_MULE_INTERNAL',
+ contoencoding => 'PG_EUC_CN', conproc => 'mic_to_euc_cn' },
+{ oid => '4424', descr => 'conversion for EUC_JP to SJIS',
+ conname => 'euc_jp_to_sjis', conforencoding => 'PG_EUC_JP',
+ contoencoding => 'PG_SJIS', conproc => 'euc_jp_to_sjis' },
+{ oid => '4425', descr => 'conversion for SJIS to EUC_JP',
+ conname => 'sjis_to_euc_jp', conforencoding => 'PG_SJIS',
+ contoencoding => 'PG_EUC_JP', conproc => 'sjis_to_euc_jp' },
+{ oid => '4426', descr => 'conversion for EUC_JP to MULE_INTERNAL',
+ conname => 'euc_jp_to_mic', conforencoding => 'PG_EUC_JP',
+ contoencoding => 'PG_MULE_INTERNAL', conproc => 'euc_jp_to_mic' },
+{ oid => '4427', descr => 'conversion for SJIS to MULE_INTERNAL',
+ conname => 'sjis_to_mic', conforencoding => 'PG_SJIS',
+ contoencoding => 'PG_MULE_INTERNAL', conproc => 'sjis_to_mic' },
+{ oid => '4428', descr => 'conversion for MULE_INTERNAL to EUC_JP',
+ conname => 'mic_to_euc_jp', conforencoding => 'PG_MULE_INTERNAL',
+ contoencoding => 'PG_EUC_JP', conproc => 'mic_to_euc_jp' },
+{ oid => '4429', descr => 'conversion for MULE_INTERNAL to SJIS',
+ conname => 'mic_to_sjis', conforencoding => 'PG_MULE_INTERNAL',
+ contoencoding => 'PG_SJIS', conproc => 'mic_to_sjis' },
+{ oid => '4430', descr => 'conversion for EUC_KR to MULE_INTERNAL',
+ conname => 'euc_kr_to_mic', conforencoding => 'PG_EUC_KR',
+ contoencoding => 'PG_MULE_INTERNAL', conproc => 'euc_kr_to_mic' },
+{ oid => '4431', descr => 'conversion for MULE_INTERNAL to EUC_KR',
+ conname => 'mic_to_euc_kr', conforencoding => 'PG_MULE_INTERNAL',
+ contoencoding => 'PG_EUC_KR', conproc => 'mic_to_euc_kr' },
+{ oid => '4432', descr => 'conversion for EUC_TW to BIG5',
+ conname => 'euc_tw_to_big5', conforencoding => 'PG_EUC_TW',
+ contoencoding => 'PG_BIG5', conproc => 'euc_tw_to_big5' },
+{ oid => '4433', descr => 'conversion for BIG5 to EUC_TW',
+ conname => 'big5_to_euc_tw', conforencoding => 'PG_BIG5',
+ contoencoding => 'PG_EUC_TW', conproc => 'big5_to_euc_tw' },
+{ oid => '4434', descr => 'conversion for EUC_TW to MULE_INTERNAL',
+ conname => 'euc_tw_to_mic', conforencoding => 'PG_EUC_TW',
+ contoencoding => 'PG_MULE_INTERNAL', conproc => 'euc_tw_to_mic' },
+{ oid => '4435', descr => 'conversion for BIG5 to MULE_INTERNAL',
+ conname => 'big5_to_mic', conforencoding => 'PG_BIG5',
+ contoencoding => 'PG_MULE_INTERNAL', conproc => 'big5_to_mic' },
+{ oid => '4436', descr => 'conversion for MULE_INTERNAL to EUC_TW',
+ conname => 'mic_to_euc_tw', conforencoding => 'PG_MULE_INTERNAL',
+ contoencoding => 'PG_EUC_TW', conproc => 'mic_to_euc_tw' },
+{ oid => '4437', descr => 'conversion for MULE_INTERNAL to BIG5',
+ conname => 'mic_to_big5', conforencoding => 'PG_MULE_INTERNAL',
+ contoencoding => 'PG_BIG5', conproc => 'mic_to_big5' },
+{ oid => '4438', descr => 'conversion for LATIN2 to MULE_INTERNAL',
+ conname => 'iso_8859_2_to_mic', conforencoding => 'PG_LATIN2',
+ contoencoding => 'PG_MULE_INTERNAL', conproc => 'latin2_to_mic' },
+{ oid => '4439', descr => 'conversion for MULE_INTERNAL to LATIN2',
+ conname => 'mic_to_iso_8859_2', conforencoding => 'PG_MULE_INTERNAL',
+ contoencoding => 'PG_LATIN2', conproc => 'mic_to_latin2' },
+{ oid => '4440', descr => 'conversion for WIN1250 to MULE_INTERNAL',
+ conname => 'windows_1250_to_mic', conforencoding => 'PG_WIN1250',
+ contoencoding => 'PG_MULE_INTERNAL', conproc => 'win1250_to_mic' },
+{ oid => '4441', descr => 'conversion for MULE_INTERNAL to WIN1250',
+ conname => 'mic_to_windows_1250', conforencoding => 'PG_MULE_INTERNAL',
+ contoencoding => 'PG_WIN1250', conproc => 'mic_to_win1250' },
+{ oid => '4442', descr => 'conversion for LATIN2 to WIN1250',
+ conname => 'iso_8859_2_to_windows_1250', conforencoding => 'PG_LATIN2',
+ contoencoding => 'PG_WIN1250', conproc => 'latin2_to_win1250' },
+{ oid => '4443', descr => 'conversion for WIN1250 to LATIN2',
+ conname => 'windows_1250_to_iso_8859_2', conforencoding => 'PG_WIN1250',
+ contoencoding => 'PG_LATIN2', conproc => 'win1250_to_latin2' },
+{ oid => '4444', descr => 'conversion for LATIN1 to MULE_INTERNAL',
+ conname => 'iso_8859_1_to_mic', conforencoding => 'PG_LATIN1',
+ contoencoding => 'PG_MULE_INTERNAL', conproc => 'latin1_to_mic' },
+{ oid => '4445', descr => 'conversion for MULE_INTERNAL to LATIN1',
+ conname => 'mic_to_iso_8859_1', conforencoding => 'PG_MULE_INTERNAL',
+ contoencoding => 'PG_LATIN1', conproc => 'mic_to_latin1' },
+{ oid => '4446', descr => 'conversion for LATIN3 to MULE_INTERNAL',
+ conname => 'iso_8859_3_to_mic', conforencoding => 'PG_LATIN3',
+ contoencoding => 'PG_MULE_INTERNAL', conproc => 'latin3_to_mic' },
+{ oid => '4447', descr => 'conversion for MULE_INTERNAL to LATIN3',
+ conname => 'mic_to_iso_8859_3', conforencoding => 'PG_MULE_INTERNAL',
+ contoencoding => 'PG_LATIN3', conproc => 'mic_to_latin3' },
+{ oid => '4448', descr => 'conversion for LATIN4 to MULE_INTERNAL',
+ conname => 'iso_8859_4_to_mic', conforencoding => 'PG_LATIN4',
+ contoencoding => 'PG_MULE_INTERNAL', conproc => 'latin4_to_mic' },
+{ oid => '4449', descr => 'conversion for MULE_INTERNAL to LATIN4',
+ conname => 'mic_to_iso_8859_4', conforencoding => 'PG_MULE_INTERNAL',
+ contoencoding => 'PG_LATIN4', conproc => 'mic_to_latin4' },
+{ oid => '4452', descr => 'conversion for BIG5 to UTF8',
+ conname => 'big5_to_utf8', conforencoding => 'PG_BIG5',
+ contoencoding => 'PG_UTF8', conproc => 'big5_to_utf8' },
+{ oid => '4453', descr => 'conversion for UTF8 to BIG5',
+ conname => 'utf8_to_big5', conforencoding => 'PG_UTF8',
+ contoencoding => 'PG_BIG5', conproc => 'utf8_to_big5' },
+{ oid => '4454', descr => 'conversion for UTF8 to KOI8R',
+ conname => 'utf8_to_koi8_r', conforencoding => 'PG_UTF8',
+ contoencoding => 'PG_KOI8R', conproc => 'utf8_to_koi8r' },
+{ oid => '4455', descr => 'conversion for KOI8R to UTF8',
+ conname => 'koi8_r_to_utf8', conforencoding => 'PG_KOI8R',
+ contoencoding => 'PG_UTF8', conproc => 'koi8r_to_utf8' },
+{ oid => '4456', descr => 'conversion for UTF8 to KOI8U',
+ conname => 'utf8_to_koi8_u', conforencoding => 'PG_UTF8',
+ contoencoding => 'PG_KOI8U', conproc => 'utf8_to_koi8u' },
+{ oid => '4457', descr => 'conversion for KOI8U to UTF8',
+ conname => 'koi8_u_to_utf8', conforencoding => 'PG_KOI8U',
+ contoencoding => 'PG_UTF8', conproc => 'koi8u_to_utf8' },
+{ oid => '4458', descr => 'conversion for UTF8 to WIN866',
+ conname => 'utf8_to_windows_866', conforencoding => 'PG_UTF8',
+ contoencoding => 'PG_WIN866', conproc => 'utf8_to_win' },
+{ oid => '4459', descr => 'conversion for WIN866 to UTF8',
+ conname => 'windows_866_to_utf8', conforencoding => 'PG_WIN866',
+ contoencoding => 'PG_UTF8', conproc => 'win_to_utf8' },
+{ oid => '4460', descr => 'conversion for UTF8 to WIN874',
+ conname => 'utf8_to_windows_874', conforencoding => 'PG_UTF8',
+ contoencoding => 'PG_WIN874', conproc => 'utf8_to_win' },
+{ oid => '4461', descr => 'conversion for WIN874 to UTF8',
+ conname => 'windows_874_to_utf8', conforencoding => 'PG_WIN874',
+ contoencoding => 'PG_UTF8', conproc => 'win_to_utf8' },
+{ oid => '4462', descr => 'conversion for UTF8 to WIN1250',
+ conname => 'utf8_to_windows_1250', conforencoding => 'PG_UTF8',
+ contoencoding => 'PG_WIN1250', conproc => 'utf8_to_win' },
+{ oid => '4463', descr => 'conversion for WIN1250 to UTF8',
+ conname => 'windows_1250_to_utf8', conforencoding => 'PG_WIN1250',
+ contoencoding => 'PG_UTF8', conproc => 'win_to_utf8' },
+{ oid => '4464', descr => 'conversion for UTF8 to WIN1251',
+ conname => 'utf8_to_windows_1251', conforencoding => 'PG_UTF8',
+ contoencoding => 'PG_WIN1251', conproc => 'utf8_to_win' },
+{ oid => '4465', descr => 'conversion for WIN1251 to UTF8',
+ conname => 'windows_1251_to_utf8', conforencoding => 'PG_WIN1251',
+ contoencoding => 'PG_UTF8', conproc => 'win_to_utf8' },
+{ oid => '4466', descr => 'conversion for UTF8 to WIN1252',
+ conname => 'utf8_to_windows_1252', conforencoding => 'PG_UTF8',
+ contoencoding => 'PG_WIN1252', conproc => 'utf8_to_win' },
+{ oid => '4467', descr => 'conversion for WIN1252 to UTF8',
+ conname => 'windows_1252_to_utf8', conforencoding => 'PG_WIN1252',
+ contoencoding => 'PG_UTF8', conproc => 'win_to_utf8' },
+{ oid => '4468', descr => 'conversion for UTF8 to WIN1253',
+ conname => 'utf8_to_windows_1253', conforencoding => 'PG_UTF8',
+ contoencoding => 'PG_WIN1253', conproc => 'utf8_to_win' },
+{ oid => '4469', descr => 'conversion for WIN1253 to UTF8',
+ conname => 'windows_1253_to_utf8', conforencoding => 'PG_WIN1253',
+ contoencoding => 'PG_UTF8', conproc => 'win_to_utf8' },
+{ oid => '4470', descr => 'conversion for UTF8 to WIN1254',
+ conname => 'utf8_to_windows_1254', conforencoding => 'PG_UTF8',
+ contoencoding => 'PG_WIN1254', conproc => 'utf8_to_win' },
+{ oid => '4471', descr => 'conversion for WIN1254 to UTF8',
+ conname => 'windows_1254_to_utf8', conforencoding => 'PG_WIN1254',
+ contoencoding => 'PG_UTF8', conproc => 'win_to_utf8' },
+{ oid => '4472', descr => 'conversion for UTF8 to WIN1255',
+ conname => 'utf8_to_windows_1255', conforencoding => 'PG_UTF8',
+ contoencoding => 'PG_WIN1255', conproc => 'utf8_to_win' },
+{ oid => '4473', descr => 'conversion for WIN1255 to UTF8',
+ conname => 'windows_1255_to_utf8', conforencoding => 'PG_WIN1255',
+ contoencoding => 'PG_UTF8', conproc => 'win_to_utf8' },
+{ oid => '4474', descr => 'conversion for UTF8 to WIN1256',
+ conname => 'utf8_to_windows_1256', conforencoding => 'PG_UTF8',
+ contoencoding => 'PG_WIN1256', conproc => 'utf8_to_win' },
+{ oid => '4475', descr => 'conversion for WIN1256 to UTF8',
+ conname => 'windows_1256_to_utf8', conforencoding => 'PG_WIN1256',
+ contoencoding => 'PG_UTF8', conproc => 'win_to_utf8' },
+{ oid => '4476', descr => 'conversion for UTF8 to WIN1257',
+ conname => 'utf8_to_windows_1257', conforencoding => 'PG_UTF8',
+ contoencoding => 'PG_WIN1257', conproc => 'utf8_to_win' },
+{ oid => '4477', descr => 'conversion for WIN1257 to UTF8',
+ conname => 'windows_1257_to_utf8', conforencoding => 'PG_WIN1257',
+ contoencoding => 'PG_UTF8', conproc => 'win_to_utf8' },
+{ oid => '4478', descr => 'conversion for UTF8 to WIN1258',
+ conname => 'utf8_to_windows_1258', conforencoding => 'PG_UTF8',
+ contoencoding => 'PG_WIN1258', conproc => 'utf8_to_win' },
+{ oid => '4479', descr => 'conversion for WIN1258 to UTF8',
+ conname => 'windows_1258_to_utf8', conforencoding => 'PG_WIN1258',
+ contoencoding => 'PG_UTF8', conproc => 'win_to_utf8' },
+{ oid => '4480', descr => 'conversion for EUC_CN to UTF8',
+ conname => 'euc_cn_to_utf8', conforencoding => 'PG_EUC_CN',
+ contoencoding => 'PG_UTF8', conproc => 'euc_cn_to_utf8' },
+{ oid => '4481', descr => 'conversion for UTF8 to EUC_CN',
+ conname => 'utf8_to_euc_cn', conforencoding => 'PG_UTF8',
+ contoencoding => 'PG_EUC_CN', conproc => 'utf8_to_euc_cn' },
+{ oid => '4482', descr => 'conversion for EUC_JP to UTF8',
+ conname => 'euc_jp_to_utf8', conforencoding => 'PG_EUC_JP',
+ contoencoding => 'PG_UTF8', conproc => 'euc_jp_to_utf8' },
+{ oid => '4483', descr => 'conversion for UTF8 to EUC_JP',
+ conname => 'utf8_to_euc_jp', conforencoding => 'PG_UTF8',
+ contoencoding => 'PG_EUC_JP', conproc => 'utf8_to_euc_jp' },
+{ oid => '4484', descr => 'conversion for EUC_KR to UTF8',
+ conname => 'euc_kr_to_utf8', conforencoding => 'PG_EUC_KR',
+ contoencoding => 'PG_UTF8', conproc => 'euc_kr_to_utf8' },
+{ oid => '4485', descr => 'conversion for UTF8 to EUC_KR',
+ conname => 'utf8_to_euc_kr', conforencoding => 'PG_UTF8',
+ contoencoding => 'PG_EUC_KR', conproc => 'utf8_to_euc_kr' },
+{ oid => '4486', descr => 'conversion for EUC_TW to UTF8',
+ conname => 'euc_tw_to_utf8', conforencoding => 'PG_EUC_TW',
+ contoencoding => 'PG_UTF8', conproc => 'euc_tw_to_utf8' },
+{ oid => '4487', descr => 'conversion for UTF8 to EUC_TW',
+ conname => 'utf8_to_euc_tw', conforencoding => 'PG_UTF8',
+ contoencoding => 'PG_EUC_TW', conproc => 'utf8_to_euc_tw' },
+{ oid => '4488', descr => 'conversion for GB18030 to UTF8',
+ conname => 'gb18030_to_utf8', conforencoding => 'PG_GB18030',
+ contoencoding => 'PG_UTF8', conproc => 'gb18030_to_utf8' },
+{ oid => '4489', descr => 'conversion for UTF8 to GB18030',
+ conname => 'utf8_to_gb18030', conforencoding => 'PG_UTF8',
+ contoencoding => 'PG_GB18030', conproc => 'utf8_to_gb18030' },
+{ oid => '4490', descr => 'conversion for GBK to UTF8',
+ conname => 'gbk_to_utf8', conforencoding => 'PG_GBK',
+ contoencoding => 'PG_UTF8', conproc => 'gbk_to_utf8' },
+{ oid => '4491', descr => 'conversion for UTF8 to GBK',
+ conname => 'utf8_to_gbk', conforencoding => 'PG_UTF8',
+ contoencoding => 'PG_GBK', conproc => 'utf8_to_gbk' },
+{ oid => '4492', descr => 'conversion for UTF8 to LATIN2',
+ conname => 'utf8_to_iso_8859_2', conforencoding => 'PG_UTF8',
+ contoencoding => 'PG_LATIN2', conproc => 'utf8_to_iso8859' },
+{ oid => '4493', descr => 'conversion for LATIN2 to UTF8',
+ conname => 'iso_8859_2_to_utf8', conforencoding => 'PG_LATIN2',
+ contoencoding => 'PG_UTF8', conproc => 'iso8859_to_utf8' },
+{ oid => '4494', descr => 'conversion for UTF8 to LATIN3',
+ conname => 'utf8_to_iso_8859_3', conforencoding => 'PG_UTF8',
+ contoencoding => 'PG_LATIN3', conproc => 'utf8_to_iso8859' },
+{ oid => '4495', descr => 'conversion for LATIN3 to UTF8',
+ conname => 'iso_8859_3_to_utf8', conforencoding => 'PG_LATIN3',
+ contoencoding => 'PG_UTF8', conproc => 'iso8859_to_utf8' },
+{ oid => '4496', descr => 'conversion for UTF8 to LATIN4',
+ conname => 'utf8_to_iso_8859_4', conforencoding => 'PG_UTF8',
+ contoencoding => 'PG_LATIN4', conproc => 'utf8_to_iso8859' },
+{ oid => '4497', descr => 'conversion for LATIN4 to UTF8',
+ conname => 'iso_8859_4_to_utf8', conforencoding => 'PG_LATIN4',
+ contoencoding => 'PG_UTF8', conproc => 'iso8859_to_utf8' },
+{ oid => '4498', descr => 'conversion for UTF8 to LATIN5',
+ conname => 'utf8_to_iso_8859_9', conforencoding => 'PG_UTF8',
+ contoencoding => 'PG_LATIN5', conproc => 'utf8_to_iso8859' },
+{ oid => '4499', descr => 'conversion for LATIN5 to UTF8',
+ conname => 'iso_8859_9_to_utf8', conforencoding => 'PG_LATIN5',
+ contoencoding => 'PG_UTF8', conproc => 'iso8859_to_utf8' },
+{ oid => '4500', descr => 'conversion for UTF8 to LATIN6',
+ conname => 'utf8_to_iso_8859_10', conforencoding => 'PG_UTF8',
+ contoencoding => 'PG_LATIN6', conproc => 'utf8_to_iso8859' },
+{ oid => '4501', descr => 'conversion for LATIN6 to UTF8',
+ conname => 'iso_8859_10_to_utf8', conforencoding => 'PG_LATIN6',
+ contoencoding => 'PG_UTF8', conproc => 'iso8859_to_utf8' },
+{ oid => '4502', descr => 'conversion for UTF8 to LATIN7',
+ conname => 'utf8_to_iso_8859_13', conforencoding => 'PG_UTF8',
+ contoencoding => 'PG_LATIN7', conproc => 'utf8_to_iso8859' },
+{ oid => '4503', descr => 'conversion for LATIN7 to UTF8',
+ conname => 'iso_8859_13_to_utf8', conforencoding => 'PG_LATIN7',
+ contoencoding => 'PG_UTF8', conproc => 'iso8859_to_utf8' },
+{ oid => '4504', descr => 'conversion for UTF8 to LATIN8',
+ conname => 'utf8_to_iso_8859_14', conforencoding => 'PG_UTF8',
+ contoencoding => 'PG_LATIN8', conproc => 'utf8_to_iso8859' },
+{ oid => '4505', descr => 'conversion for LATIN8 to UTF8',
+ conname => 'iso_8859_14_to_utf8', conforencoding => 'PG_LATIN8',
+ contoencoding => 'PG_UTF8', conproc => 'iso8859_to_utf8' },
+{ oid => '4506', descr => 'conversion for UTF8 to LATIN9',
+ conname => 'utf8_to_iso_8859_15', conforencoding => 'PG_UTF8',
+ contoencoding => 'PG_LATIN9', conproc => 'utf8_to_iso8859' },
+{ oid => '4507', descr => 'conversion for LATIN9 to UTF8',
+ conname => 'iso_8859_15_to_utf8', conforencoding => 'PG_LATIN9',
+ contoencoding => 'PG_UTF8', conproc => 'iso8859_to_utf8' },
+{ oid => '4508', descr => 'conversion for UTF8 to LATIN10',
+ conname => 'utf8_to_iso_8859_16', conforencoding => 'PG_UTF8',
+ contoencoding => 'PG_LATIN10', conproc => 'utf8_to_iso8859' },
+{ oid => '4509', descr => 'conversion for LATIN10 to UTF8',
+ conname => 'iso_8859_16_to_utf8', conforencoding => 'PG_LATIN10',
+ contoencoding => 'PG_UTF8', conproc => 'iso8859_to_utf8' },
+{ oid => '4510', descr => 'conversion for UTF8 to ISO-8859-5',
+ conname => 'utf8_to_iso_8859_5', conforencoding => 'PG_UTF8',
+ contoencoding => 'PG_ISO_8859_5', conproc => 'utf8_to_iso8859' },
+{ oid => '4511', descr => 'conversion for ISO-8859-5 to UTF8',
+ conname => 'iso_8859_5_to_utf8', conforencoding => 'PG_ISO_8859_5',
+ contoencoding => 'PG_UTF8', conproc => 'iso8859_to_utf8' },
+{ oid => '4512', descr => 'conversion for UTF8 to ISO-8859-6',
+ conname => 'utf8_to_iso_8859_6', conforencoding => 'PG_UTF8',
+ contoencoding => 'PG_ISO_8859_6', conproc => 'utf8_to_iso8859' },
+{ oid => '4513', descr => 'conversion for ISO-8859-6 to UTF8',
+ conname => 'iso_8859_6_to_utf8', conforencoding => 'PG_ISO_8859_6',
+ contoencoding => 'PG_UTF8', conproc => 'iso8859_to_utf8' },
+{ oid => '4514', descr => 'conversion for UTF8 to ISO-8859-7',
+ conname => 'utf8_to_iso_8859_7', conforencoding => 'PG_UTF8',
+ contoencoding => 'PG_ISO_8859_7', conproc => 'utf8_to_iso8859' },
+{ oid => '4515', descr => 'conversion for ISO-8859-7 to UTF8',
+ conname => 'iso_8859_7_to_utf8', conforencoding => 'PG_ISO_8859_7',
+ contoencoding => 'PG_UTF8', conproc => 'iso8859_to_utf8' },
+{ oid => '4516', descr => 'conversion for UTF8 to ISO-8859-8',
+ conname => 'utf8_to_iso_8859_8', conforencoding => 'PG_UTF8',
+ contoencoding => 'PG_ISO_8859_8', conproc => 'utf8_to_iso8859' },
+{ oid => '4517', descr => 'conversion for ISO-8859-8 to UTF8',
+ conname => 'iso_8859_8_to_utf8', conforencoding => 'PG_ISO_8859_8',
+ contoencoding => 'PG_UTF8', conproc => 'iso8859_to_utf8' },
+{ oid => '4518', descr => 'conversion for LATIN1 to UTF8',
+ conname => 'iso_8859_1_to_utf8', conforencoding => 'PG_LATIN1',
+ contoencoding => 'PG_UTF8', conproc => 'iso8859_1_to_utf8' },
+{ oid => '4519', descr => 'conversion for UTF8 to LATIN1',
+ conname => 'utf8_to_iso_8859_1', conforencoding => 'PG_UTF8',
+ contoencoding => 'PG_LATIN1', conproc => 'utf8_to_iso8859_1' },
+{ oid => '4520', descr => 'conversion for JOHAB to UTF8',
+ conname => 'johab_to_utf8', conforencoding => 'PG_JOHAB',
+ contoencoding => 'PG_UTF8', conproc => 'johab_to_utf8' },
+{ oid => '4521', descr => 'conversion for UTF8 to JOHAB',
+ conname => 'utf8_to_johab', conforencoding => 'PG_UTF8',
+ contoencoding => 'PG_JOHAB', conproc => 'utf8_to_johab' },
+{ oid => '4522', descr => 'conversion for SJIS to UTF8',
+ conname => 'sjis_to_utf8', conforencoding => 'PG_SJIS',
+ contoencoding => 'PG_UTF8', conproc => 'sjis_to_utf8' },
+{ oid => '4523', descr => 'conversion for UTF8 to SJIS',
+ conname => 'utf8_to_sjis', conforencoding => 'PG_UTF8',
+ contoencoding => 'PG_SJIS', conproc => 'utf8_to_sjis' },
+{ oid => '4524', descr => 'conversion for UHC to UTF8',
+ conname => 'uhc_to_utf8', conforencoding => 'PG_UHC',
+ contoencoding => 'PG_UTF8', conproc => 'uhc_to_utf8' },
+{ oid => '4525', descr => 'conversion for UTF8 to UHC',
+ conname => 'utf8_to_uhc', conforencoding => 'PG_UTF8',
+ contoencoding => 'PG_UHC', conproc => 'utf8_to_uhc' },
+{ oid => '4526', descr => 'conversion for EUC_JIS_2004 to UTF8',
+ conname => 'euc_jis_2004_to_utf8', conforencoding => 'PG_EUC_JIS_2004',
+ contoencoding => 'PG_UTF8', conproc => 'euc_jis_2004_to_utf8' },
+{ oid => '4527', descr => 'conversion for UTF8 to EUC_JIS_2004',
+ conname => 'utf8_to_euc_jis_2004', conforencoding => 'PG_UTF8',
+ contoencoding => 'PG_EUC_JIS_2004', conproc => 'utf8_to_euc_jis_2004' },
+{ oid => '4528', descr => 'conversion for SHIFT_JIS_2004 to UTF8',
+ conname => 'shift_jis_2004_to_utf8', conforencoding => 'PG_SHIFT_JIS_2004',
+ contoencoding => 'PG_UTF8', conproc => 'shift_jis_2004_to_utf8' },
+{ oid => '4529', descr => 'conversion for UTF8 to SHIFT_JIS_2004',
+ conname => 'utf8_to_shift_jis_2004', conforencoding => 'PG_UTF8',
+ contoencoding => 'PG_SHIFT_JIS_2004', conproc => 'utf8_to_shift_jis_2004' },
+{ oid => '4530', descr => 'conversion for EUC_JIS_2004 to SHIFT_JIS_2004',
+ conname => 'euc_jis_2004_to_shift_jis_2004',
+ conforencoding => 'PG_EUC_JIS_2004', contoencoding => 'PG_SHIFT_JIS_2004',
+ conproc => 'euc_jis_2004_to_shift_jis_2004' },
+{ oid => '4531', descr => 'conversion for SHIFT_JIS_2004 to EUC_JIS_2004',
+ conname => 'shift_jis_2004_to_euc_jis_2004',
+ conforencoding => 'PG_SHIFT_JIS_2004', contoencoding => 'PG_EUC_JIS_2004',
+ conproc => 'shift_jis_2004_to_euc_jis_2004' },
+
+]
diff --git a/ydb/library/yql/parser/pg_wrapper/recovery.cpp b/ydb/library/yql/parser/pg_wrapper/recovery.cpp
new file mode 100644
index 0000000000..587030e770
--- /dev/null
+++ b/ydb/library/yql/parser/pg_wrapper/recovery.cpp
@@ -0,0 +1,13 @@
+#include "pg_compat.h"
+
+extern "C" {
+#include "access/xlog.h"
+#include "utils/inval.h"
+}
+
+bool RecoveryInProgress() {
+ return false;
+}
+
+void AcceptInvalidationMessages() {
+}
diff --git a/ydb/library/yql/parser/pg_wrapper/thread_inits.c b/ydb/library/yql/parser/pg_wrapper/thread_inits.c
index e7a3c0725a..d781de6cc3 100644
--- a/ydb/library/yql/parser/pg_wrapper/thread_inits.c
+++ b/ydb/library/yql/parser/pg_wrapper/thread_inits.c
@@ -4,9 +4,6 @@ static __thread int pg_thread_init_flag;
void pg_thread_init(void) {
if (pg_thread_init_flag) return;
pg_thread_init_flag=1;
- setup_pg_thread_cleanup();
- pg_timezone_initialize();
-
BackendList_init();
CurrentTransactionState_init();
DatabaseList_init();
@@ -17,4 +14,7 @@ void pg_thread_init(void) {
mainrdata_last_init();
pcxt_list_init();
saved_plan_list_init();
+
+ setup_pg_thread_cleanup();
+ pg_timezone_initialize();
}
diff --git a/ydb/library/yql/parser/pg_wrapper/ya.make b/ydb/library/yql/parser/pg_wrapper/ya.make
index 68cc4c0966..3d899e1806 100644
--- a/ydb/library/yql/parser/pg_wrapper/ya.make
+++ b/ydb/library/yql/parser/pg_wrapper/ya.make
@@ -24,6 +24,7 @@ SRCS(
arena_ctx.cpp
arrow.cpp
arrow_impl.cpp
+ conversion.cpp
parser.cpp
thread_inits.c
comp_factory.cpp
@@ -33,6 +34,7 @@ SRCS(
pg_kernels.1.cpp
pg_kernels.2.cpp
pg_kernels.3.cpp
+ recovery.cpp
superuser.cpp
config.cpp
cost_mocks.cpp