|
@@ -2116,7 +2116,7 @@ NUdf::TUnboxedValuePod ConvertToPgValue(NUdf::TUnboxedValuePod value, TMaybe<NUd
|
|
|
}
|
|
|
case NUdf::EDataSlot::TzDate:
|
|
|
case NUdf::EDataSlot::TzDatetime:
|
|
|
- case NUdf::EDataSlot::TzTimestamp:
|
|
|
+ case NUdf::EDataSlot::TzTimestamp:
|
|
|
case NUdf::EDataSlot::TzDate32:
|
|
|
case NUdf::EDataSlot::TzDatetime64:
|
|
|
case NUdf::EDataSlot::TzTimestamp64: {
|
|
@@ -3755,7 +3755,7 @@ NUdf::TUnboxedValue PgValueFromNativeBinary(const TStringBuf binary, ui32 pgType
|
|
|
if (!NPg::HasType(pgTypeId)) {
|
|
|
return MakeString(binary);
|
|
|
}
|
|
|
-
|
|
|
+
|
|
|
TPAllocScope call;
|
|
|
StringInfoData stringInfo;
|
|
|
stringInfo.data = (char*)binary.Data();
|
|
@@ -5275,6 +5275,7 @@ public:
|
|
|
}
|
|
|
|
|
|
TConvertResult NativeBinaryFromNativeText(const TString& str) const {
|
|
|
+ NMiniKQL::TOnlyThrowingBindTerminator bind;
|
|
|
NMiniKQL::TScopedAlloc alloc(__LOCATION__);
|
|
|
NMiniKQL::TPAllocScope scope;
|
|
|
Datum datum = 0;
|
|
@@ -5287,51 +5288,45 @@ public:
|
|
|
pfree(serialized);
|
|
|
}
|
|
|
};
|
|
|
- PG_TRY();
|
|
|
- {
|
|
|
- {
|
|
|
+ try {
|
|
|
+ {
|
|
|
+ FmgrInfo finfo;
|
|
|
+ InitFunc(InFuncId, &finfo, 1, 3);
|
|
|
+ LOCAL_FCINFO(callInfo, 3);
|
|
|
+ Zero(*callInfo);
|
|
|
+ callInfo->flinfo = &finfo;
|
|
|
+ callInfo->nargs = 3;
|
|
|
+ callInfo->fncollation = DEFAULT_COLLATION_OID;
|
|
|
+ callInfo->isnull = false;
|
|
|
+ callInfo->args[0] = { (Datum)str.Data(), false };
|
|
|
+ callInfo->args[1] = { ObjectIdGetDatum(NMiniKQL::MakeTypeIOParam(*this)), false };
|
|
|
+ callInfo->args[2] = { Int32GetDatum(-1), false };
|
|
|
+
|
|
|
+ datum = finfo.fn_addr(callInfo);
|
|
|
+ Y_ENSURE(!callInfo->isnull);
|
|
|
+ }
|
|
|
FmgrInfo finfo;
|
|
|
- InitFunc(InFuncId, &finfo, 1, 3);
|
|
|
- LOCAL_FCINFO(callInfo, 3);
|
|
|
+ InitFunc(SendFuncId, &finfo, 1, 1);
|
|
|
+ LOCAL_FCINFO(callInfo, 1);
|
|
|
Zero(*callInfo);
|
|
|
callInfo->flinfo = &finfo;
|
|
|
- callInfo->nargs = 3;
|
|
|
+ callInfo->nargs = 1;
|
|
|
callInfo->fncollation = DEFAULT_COLLATION_OID;
|
|
|
callInfo->isnull = false;
|
|
|
- callInfo->args[0] = { (Datum)str.Data(), false };
|
|
|
- callInfo->args[1] = { ObjectIdGetDatum(NMiniKQL::MakeTypeIOParam(*this)), false };
|
|
|
- callInfo->args[2] = { Int32GetDatum(-1), false };
|
|
|
+ callInfo->args[0] = { datum, false };
|
|
|
|
|
|
- datum = finfo.fn_addr(callInfo);
|
|
|
+ serialized = (text*)finfo.fn_addr(callInfo);
|
|
|
Y_ENSURE(!callInfo->isnull);
|
|
|
- }
|
|
|
- FmgrInfo finfo;
|
|
|
- InitFunc(SendFuncId, &finfo, 1, 1);
|
|
|
- LOCAL_FCINFO(callInfo, 1);
|
|
|
- Zero(*callInfo);
|
|
|
- callInfo->flinfo = &finfo;
|
|
|
- callInfo->nargs = 1;
|
|
|
- callInfo->fncollation = DEFAULT_COLLATION_OID;
|
|
|
- callInfo->isnull = false;
|
|
|
- callInfo->args[0] = { datum, false };
|
|
|
-
|
|
|
- serialized = (text*)finfo.fn_addr(callInfo);
|
|
|
- Y_ENSURE(!callInfo->isnull);
|
|
|
- return {TString(NMiniKQL::GetVarBuf(serialized)), {}};
|
|
|
- }
|
|
|
- PG_CATCH();
|
|
|
- {
|
|
|
- auto error_data = CopyErrorData();
|
|
|
+ return {TString(NMiniKQL::GetVarBuf(serialized)), {}};
|
|
|
+ } catch (const yexception& e) {
|
|
|
TStringBuilder errMsg;
|
|
|
- errMsg << "Error while converting text to binary: " << error_data->message;
|
|
|
- FreeErrorData(error_data);
|
|
|
- FlushErrorState();
|
|
|
+ errMsg << "Error while converting text to binary: " << e.what();
|
|
|
return {"", errMsg};
|
|
|
}
|
|
|
- PG_END_TRY();
|
|
|
}
|
|
|
|
|
|
TConvertResult NativeTextFromNativeBinary(const TStringBuf binary) const {
|
|
|
+ NMiniKQL::TOnlyThrowingBindTerminator bind;
|
|
|
NMiniKQL::TScopedAlloc alloc(__LOCATION__);
|
|
|
NMiniKQL::TPAllocScope scope;
|
|
|
Datum datum = 0;
|
|
@@ -5344,33 +5339,26 @@ public:
|
|
|
pfree(str);
|
|
|
}
|
|
|
};
|
|
|
- PG_TRY();
|
|
|
- {
|
|
|
- datum = Receive(binary.Data(), binary.Size());
|
|
|
- FmgrInfo finfo;
|
|
|
- InitFunc(OutFuncId, &finfo, 1, 1);
|
|
|
- LOCAL_FCINFO(callInfo, 1);
|
|
|
- Zero(*callInfo);
|
|
|
- callInfo->flinfo = &finfo;
|
|
|
- callInfo->nargs = 1;
|
|
|
- callInfo->fncollation = DEFAULT_COLLATION_OID;
|
|
|
- callInfo->isnull = false;
|
|
|
- callInfo->args[0] = { datum, false };
|
|
|
+ try {
|
|
|
+ datum = Receive(binary.Data(), binary.Size());
|
|
|
+ FmgrInfo finfo;
|
|
|
+ InitFunc(OutFuncId, &finfo, 1, 1);
|
|
|
+ LOCAL_FCINFO(callInfo, 1);
|
|
|
+ Zero(*callInfo);
|
|
|
+ callInfo->flinfo = &finfo;
|
|
|
+ callInfo->nargs = 1;
|
|
|
+ callInfo->fncollation = DEFAULT_COLLATION_OID;
|
|
|
+ callInfo->isnull = false;
|
|
|
+ callInfo->args[0] = { datum, false };
|
|
|
|
|
|
- str = (char*)finfo.fn_addr(callInfo);
|
|
|
- Y_ENSURE(!callInfo->isnull);
|
|
|
- return {TString(str), {}};
|
|
|
- }
|
|
|
- PG_CATCH();
|
|
|
- {
|
|
|
- auto error_data = CopyErrorData();
|
|
|
+ str = (char*)finfo.fn_addr(callInfo);
|
|
|
+ Y_ENSURE(!callInfo->isnull);
|
|
|
+ return {TString(str), {}};
|
|
|
+ } catch (const yexception& e) {
|
|
|
TStringBuilder errMsg;
|
|
|
- errMsg << "Error while converting binary to text: " << error_data->message;
|
|
|
- FreeErrorData(error_data);
|
|
|
- FlushErrorState();
|
|
|
+ errMsg << "Error while converting binary to text: " << e.what();
|
|
|
return {"", errMsg};
|
|
|
}
|
|
|
- PG_END_TRY();
|
|
|
}
|
|
|
|
|
|
TTypeModResult ReadTypeMod(const TString& str) const {
|
|
@@ -5413,6 +5401,7 @@ public:
|
|
|
}
|
|
|
}
|
|
|
|
|
|
+ NMiniKQL::TOnlyThrowingBindTerminator bind;
|
|
|
NMiniKQL::TScopedAlloc alloc(__LOCATION__);
|
|
|
NMiniKQL::TPAllocScope scope;
|
|
|
ArrayType* paramsArray = nullptr;
|
|
@@ -5421,8 +5410,7 @@ public:
|
|
|
pfree(paramsArray);
|
|
|
}
|
|
|
};
|
|
|
- PG_TRY();
|
|
|
- {
|
|
|
+ try {
|
|
|
int ndims = 0;
|
|
|
int dims[MAXDIM];
|
|
|
int lbs[MAXDIM];
|
|
@@ -5451,22 +5439,17 @@ public:
|
|
|
auto result = finfo.fn_addr(callInfo);
|
|
|
Y_ENSURE(!callInfo->isnull);
|
|
|
return {DatumGetInt32(result), {}};
|
|
|
- }
|
|
|
- PG_CATCH();
|
|
|
- {
|
|
|
- auto error_data = CopyErrorData();
|
|
|
+ } catch (const yexception& e) {
|
|
|
TStringBuilder errMsg;
|
|
|
errMsg << "Error in 'typemodin' function: "
|
|
|
<< NYql::NPg::LookupProc(TypeModInFuncId).Name
|
|
|
- << ", reason: " << error_data->message;
|
|
|
- FreeErrorData(error_data);
|
|
|
- FlushErrorState();
|
|
|
+ << ", reason: " << e.what();
|
|
|
return {-1, errMsg};
|
|
|
}
|
|
|
- PG_END_TRY();
|
|
|
}
|
|
|
|
|
|
TMaybe<TString> Validate(const TStringBuf binary) {
|
|
|
+ NMiniKQL::TOnlyThrowingBindTerminator bind;
|
|
|
NMiniKQL::TScopedAlloc alloc(__LOCATION__);
|
|
|
NMiniKQL::TPAllocScope scope;
|
|
|
Datum datum = 0;
|
|
@@ -5475,23 +5458,16 @@ public:
|
|
|
pfree((void*)datum);
|
|
|
}
|
|
|
};
|
|
|
- PG_TRY();
|
|
|
- {
|
|
|
- datum = Receive(binary.Data(), binary.Size());
|
|
|
- return {};
|
|
|
- }
|
|
|
- PG_CATCH();
|
|
|
- {
|
|
|
- auto error_data = CopyErrorData();
|
|
|
+ try {
|
|
|
+ datum = Receive(binary.Data(), binary.Size());
|
|
|
+ return {};
|
|
|
+ } catch (const yexception& e) {
|
|
|
TStringBuilder errMsg;
|
|
|
errMsg << "Error in 'recv' function: "
|
|
|
<< NYql::NPg::LookupProc(ReceiveFuncId).Name
|
|
|
- << ", reason: " << error_data->message;
|
|
|
- FreeErrorData(error_data);
|
|
|
- FlushErrorState();
|
|
|
+ << ", reason: " << e.what();
|
|
|
return errMsg;
|
|
|
}
|
|
|
- PG_END_TRY();
|
|
|
}
|
|
|
|
|
|
TCoerceResult Coerce(const TStringBuf binary, i32 typmod) {
|
|
@@ -5508,6 +5484,7 @@ public:
|
|
|
|
|
|
private:
|
|
|
TCoerceResult Coerce(bool isSourceBinary, const TStringBuf binary, Datum datum, i32 typmod) {
|
|
|
+ NMiniKQL::TOnlyThrowingBindTerminator bind;
|
|
|
NMiniKQL::TScopedAlloc alloc(__LOCATION__);
|
|
|
NMiniKQL::TPAllocScope scope;
|
|
|
|
|
@@ -5535,8 +5512,7 @@ private:
|
|
|
pfree(serialized);
|
|
|
}
|
|
|
};
|
|
|
- PG_TRY();
|
|
|
- {
|
|
|
+ try {
|
|
|
if (isSourceBinary) {
|
|
|
datum = Receive(binary.Data(), binary.Size());
|
|
|
}
|
|
@@ -5602,17 +5578,11 @@ private:
|
|
|
Y_ENSURE(!callInfo->isnull);
|
|
|
return {TString(NMiniKQL::GetVarBuf(serialized)), {}};
|
|
|
}
|
|
|
- }
|
|
|
- PG_CATCH();
|
|
|
- {
|
|
|
- auto error_data = CopyErrorData();
|
|
|
+ } catch (const yexception& e) {
|
|
|
TStringBuilder errMsg;
|
|
|
- errMsg << "Error while coercing value, reason: " << error_data->message;
|
|
|
- FreeErrorData(error_data);
|
|
|
- FlushErrorState();
|
|
|
+ errMsg << "Error while coercing value, reason: " << e.what();
|
|
|
return {{}, errMsg};
|
|
|
}
|
|
|
- PG_END_TRY();
|
|
|
}
|
|
|
|
|
|
Datum CoerceOne(ui32 typeId, Datum datum, i32 typmod) const {
|