diff --git a/ydb/library/yql/parser/pg_wrapper/interface/utils.h b/ydb/library/yql/parser/pg_wrapper/interface/utils.h index 5bbcb2ea98dd..30766032e7fc 100644 --- a/ydb/library/yql/parser/pg_wrapper/interface/utils.h +++ b/ydb/library/yql/parser/pg_wrapper/interface/utils.h @@ -15,10 +15,6 @@ bool ParsePgIntervalModifier(const TString& str, i32& ret); std::unique_ptr CreatePgBuilder(); bool HasPgKernel(ui32 procOid); +ui64 HexEncode(const char *src, size_t len, char *dst); } // NYql -extern "C" { - // copied from postgres/src/include/utils/builtins.h - ui64 hex_encode(const char *src, size_t len, char *dst); -} - diff --git a/ydb/library/yql/parser/pg_wrapper/pg_compat.h b/ydb/library/yql/parser/pg_wrapper/pg_compat.h index 736fa1374cf8..0280ee1d0b25 100644 --- a/ydb/library/yql/parser/pg_wrapper/pg_compat.h +++ b/ydb/library/yql/parser/pg_wrapper/pg_compat.h @@ -23,6 +23,7 @@ extern "C" { #undef Min #undef Max +#undef Abs #undef bind #undef open #undef FATAL diff --git a/ydb/library/yql/parser/pg_wrapper/pg_utils_wrappers.cpp b/ydb/library/yql/parser/pg_wrapper/pg_utils_wrappers.cpp new file mode 100644 index 000000000000..a1d68059df3b --- /dev/null +++ b/ydb/library/yql/parser/pg_wrapper/pg_utils_wrappers.cpp @@ -0,0 +1,14 @@ +#include +#include + +extern "C" { +#include +} + + +namespace NYql { + ui64 HexEncode(const char *src, size_t len, char *dst) { + return ::hex_encode(src, len, dst); + } +} + diff --git a/ydb/library/yql/parser/pg_wrapper/ya.make b/ydb/library/yql/parser/pg_wrapper/ya.make index 865c83bedc0d..24d3f9f327c6 100644 --- a/ydb/library/yql/parser/pg_wrapper/ya.make +++ b/ydb/library/yql/parser/pg_wrapper/ya.make @@ -37,6 +37,7 @@ SRCS( config.cpp cost_mocks.cpp syscache.cpp + pg_utils_wrappers.cpp ) IF (ARCH_X86_64) @@ -70,6 +71,7 @@ PEERDIR( ydb/library/yql/minikql/arrow ydb/library/yql/minikql/computation ydb/library/yql/parser/pg_catalog + ydb/library/yql/parser/pg_wrapper/interface ydb/library/yql/providers/common/codec ydb/library/yql/public/issue ydb/library/yql/public/udf diff --git a/ydb/library/yql/sql/pg_dummy/pg_sql_dummy.cpp b/ydb/library/yql/sql/pg_dummy/pg_sql_dummy.cpp index d722cefab11c..4f905381b496 100644 --- a/ydb/library/yql/sql/pg_dummy/pg_sql_dummy.cpp +++ b/ydb/library/yql/sql/pg_dummy/pg_sql_dummy.cpp @@ -498,11 +498,14 @@ TString GetPostgresServerVersionStr() { } // namespace NKikimr::NPg -ui64 hex_encode(const char *src, size_t len, char *dst) { +namespace NYql { + +ui64 HexEncode(const char *src, size_t len, char *dst) { Y_UNUSED(src); Y_UNUSED(len); Y_UNUSED(dst); - return 0; + throw yexception() << "HexEncode in pg_dummy does nothing"; } +} // NYql diff --git a/ydb/library/yql/tools/pgrun/pgrun.cpp b/ydb/library/yql/tools/pgrun/pgrun.cpp index a08cd06af4ec..6d3fcb148bae 100644 --- a/ydb/library/yql/tools/pgrun/pgrun.cpp +++ b/ydb/library/yql/tools/pgrun/pgrun.cpp @@ -825,7 +825,7 @@ TString GetCellData(const NYT::TNode& cell, const TColumn& column) { result.resize(expectedSize); result[0] = '\\'; result[1] = 'x'; - const auto cnt = hex_encode(rawValue.data(), rawValue.size(), result.begin() + 2); + const auto cnt = HexEncode(rawValue.data(), rawValue.size(), result.begin() + 2); Y_ASSERT(cnt + 2 == expectedSize);