@@ -2116,7 +2116,7 @@ NUdf::TUnboxedValuePod ConvertToPgValue(NUdf::TUnboxedValuePod value, TMaybe<NUd
2116
2116
}
2117
2117
case NUdf::EDataSlot::TzDate:
2118
2118
case NUdf::EDataSlot::TzDatetime:
2119
- case NUdf::EDataSlot::TzTimestamp:
2119
+ case NUdf::EDataSlot::TzTimestamp:
2120
2120
case NUdf::EDataSlot::TzDate32:
2121
2121
case NUdf::EDataSlot::TzDatetime64:
2122
2122
case NUdf::EDataSlot::TzTimestamp64: {
@@ -3755,7 +3755,7 @@ NUdf::TUnboxedValue PgValueFromNativeBinary(const TStringBuf binary, ui32 pgType
3755
3755
if (!NPg::HasType (pgTypeId)) {
3756
3756
return MakeString (binary);
3757
3757
}
3758
-
3758
+
3759
3759
TPAllocScope call;
3760
3760
StringInfoData stringInfo;
3761
3761
stringInfo.data = (char *)binary.Data ();
@@ -5275,6 +5275,7 @@ class TPgTypeDescriptor
5275
5275
}
5276
5276
5277
5277
TConvertResult NativeBinaryFromNativeText (const TString& str) const {
5278
+ NMiniKQL::TOnlyThrowingBindTerminator bind;
5278
5279
NMiniKQL::TScopedAlloc alloc (__LOCATION__);
5279
5280
NMiniKQL::TPAllocScope scope;
5280
5281
Datum datum = 0 ;
@@ -5287,51 +5288,45 @@ class TPgTypeDescriptor
5287
5288
pfree (serialized);
5288
5289
}
5289
5290
};
5290
- PG_TRY ();
5291
- {
5292
- {
5291
+ try {
5292
+ {
5293
+ FmgrInfo finfo;
5294
+ InitFunc (InFuncId, &finfo, 1 , 3 );
5295
+ LOCAL_FCINFO (callInfo, 3 );
5296
+ Zero (*callInfo);
5297
+ callInfo->flinfo = &finfo;
5298
+ callInfo->nargs = 3 ;
5299
+ callInfo->fncollation = DEFAULT_COLLATION_OID;
5300
+ callInfo->isnull = false ;
5301
+ callInfo->args [0 ] = { (Datum)str.Data (), false };
5302
+ callInfo->args [1 ] = { ObjectIdGetDatum (NMiniKQL::MakeTypeIOParam (*this )), false };
5303
+ callInfo->args [2 ] = { Int32GetDatum (-1 ), false };
5304
+
5305
+ datum = finfo.fn_addr (callInfo);
5306
+ Y_ENSURE (!callInfo->isnull );
5307
+ }
5293
5308
FmgrInfo finfo;
5294
- InitFunc (InFuncId , &finfo, 1 , 3 );
5295
- LOCAL_FCINFO (callInfo, 3 );
5309
+ InitFunc (SendFuncId , &finfo, 1 , 1 );
5310
+ LOCAL_FCINFO (callInfo, 1 );
5296
5311
Zero (*callInfo);
5297
5312
callInfo->flinfo = &finfo;
5298
- callInfo->nargs = 3 ;
5313
+ callInfo->nargs = 1 ;
5299
5314
callInfo->fncollation = DEFAULT_COLLATION_OID;
5300
5315
callInfo->isnull = false ;
5301
- callInfo->args [0 ] = { (Datum)str.Data (), false };
5302
- callInfo->args [1 ] = { ObjectIdGetDatum (NMiniKQL::MakeTypeIOParam (*this )), false };
5303
- callInfo->args [2 ] = { Int32GetDatum (-1 ), false };
5316
+ callInfo->args [0 ] = { datum, false };
5304
5317
5305
- datum = finfo.fn_addr (callInfo);
5318
+ serialized = (text*) finfo.fn_addr (callInfo);
5306
5319
Y_ENSURE (!callInfo->isnull );
5307
- }
5308
- FmgrInfo finfo;
5309
- InitFunc (SendFuncId, &finfo, 1 , 1 );
5310
- LOCAL_FCINFO (callInfo, 1 );
5311
- Zero (*callInfo);
5312
- callInfo->flinfo = &finfo;
5313
- callInfo->nargs = 1 ;
5314
- callInfo->fncollation = DEFAULT_COLLATION_OID;
5315
- callInfo->isnull = false ;
5316
- callInfo->args [0 ] = { datum, false };
5317
-
5318
- serialized = (text*)finfo.fn_addr (callInfo);
5319
- Y_ENSURE (!callInfo->isnull );
5320
- return {TString (NMiniKQL::GetVarBuf (serialized)), {}};
5321
- }
5322
- PG_CATCH ();
5323
- {
5324
- auto error_data = CopyErrorData ();
5320
+ return {TString (NMiniKQL::GetVarBuf (serialized)), {}};
5321
+ } catch (const yexception& e) {
5325
5322
TStringBuilder errMsg;
5326
- errMsg << " Error while converting text to binary: " << error_data->message ;
5327
- FreeErrorData (error_data);
5328
- FlushErrorState ();
5323
+ errMsg << " Error while converting text to binary: " << e.what ();
5329
5324
return {" " , errMsg};
5330
5325
}
5331
- PG_END_TRY ();
5332
5326
}
5333
5327
5334
5328
TConvertResult NativeTextFromNativeBinary (const TStringBuf binary) const {
5329
+ NMiniKQL::TOnlyThrowingBindTerminator bind;
5335
5330
NMiniKQL::TScopedAlloc alloc (__LOCATION__);
5336
5331
NMiniKQL::TPAllocScope scope;
5337
5332
Datum datum = 0 ;
@@ -5344,33 +5339,26 @@ class TPgTypeDescriptor
5344
5339
pfree (str);
5345
5340
}
5346
5341
};
5347
- PG_TRY ();
5348
- {
5349
- datum = Receive (binary.Data (), binary.Size ());
5350
- FmgrInfo finfo;
5351
- InitFunc (OutFuncId, &finfo, 1 , 1 );
5352
- LOCAL_FCINFO (callInfo, 1 );
5353
- Zero (*callInfo);
5354
- callInfo->flinfo = &finfo;
5355
- callInfo->nargs = 1 ;
5356
- callInfo->fncollation = DEFAULT_COLLATION_OID;
5357
- callInfo->isnull = false ;
5358
- callInfo->args [0 ] = { datum, false };
5342
+ try {
5343
+ datum = Receive (binary.Data (), binary.Size ());
5344
+ FmgrInfo finfo;
5345
+ InitFunc (OutFuncId, &finfo, 1 , 1 );
5346
+ LOCAL_FCINFO (callInfo, 1 );
5347
+ Zero (*callInfo);
5348
+ callInfo->flinfo = &finfo;
5349
+ callInfo->nargs = 1 ;
5350
+ callInfo->fncollation = DEFAULT_COLLATION_OID;
5351
+ callInfo->isnull = false ;
5352
+ callInfo->args [0 ] = { datum, false };
5359
5353
5360
- str = (char *)finfo.fn_addr (callInfo);
5361
- Y_ENSURE (!callInfo->isnull );
5362
- return {TString (str), {}};
5363
- }
5364
- PG_CATCH ();
5365
- {
5366
- auto error_data = CopyErrorData ();
5354
+ str = (char *)finfo.fn_addr (callInfo);
5355
+ Y_ENSURE (!callInfo->isnull );
5356
+ return {TString (str), {}};
5357
+ } catch (const yexception& e) {
5367
5358
TStringBuilder errMsg;
5368
- errMsg << " Error while converting binary to text: " << error_data->message ;
5369
- FreeErrorData (error_data);
5370
- FlushErrorState ();
5359
+ errMsg << " Error while converting binary to text: " << e.what ();
5371
5360
return {" " , errMsg};
5372
5361
}
5373
- PG_END_TRY ();
5374
5362
}
5375
5363
5376
5364
TTypeModResult ReadTypeMod (const TString& str) const {
@@ -5413,6 +5401,7 @@ class TPgTypeDescriptor
5413
5401
}
5414
5402
}
5415
5403
5404
+ NMiniKQL::TOnlyThrowingBindTerminator bind;
5416
5405
NMiniKQL::TScopedAlloc alloc (__LOCATION__);
5417
5406
NMiniKQL::TPAllocScope scope;
5418
5407
ArrayType* paramsArray = nullptr ;
@@ -5421,8 +5410,7 @@ class TPgTypeDescriptor
5421
5410
pfree (paramsArray);
5422
5411
}
5423
5412
};
5424
- PG_TRY ();
5425
- {
5413
+ try {
5426
5414
int ndims = 0 ;
5427
5415
int dims[MAXDIM];
5428
5416
int lbs[MAXDIM];
@@ -5451,22 +5439,17 @@ class TPgTypeDescriptor
5451
5439
auto result = finfo.fn_addr (callInfo);
5452
5440
Y_ENSURE (!callInfo->isnull );
5453
5441
return {DatumGetInt32 (result), {}};
5454
- }
5455
- PG_CATCH ();
5456
- {
5457
- auto error_data = CopyErrorData ();
5442
+ } catch (const yexception& e) {
5458
5443
TStringBuilder errMsg;
5459
5444
errMsg << " Error in 'typemodin' function: "
5460
5445
<< NYql::NPg::LookupProc (TypeModInFuncId).Name
5461
- << " , reason: " << error_data->message ;
5462
- FreeErrorData (error_data);
5463
- FlushErrorState ();
5446
+ << " , reason: " << e.what ();
5464
5447
return {-1 , errMsg};
5465
5448
}
5466
- PG_END_TRY ();
5467
5449
}
5468
5450
5469
5451
TMaybe<TString> Validate (const TStringBuf binary) {
5452
+ NMiniKQL::TOnlyThrowingBindTerminator bind;
5470
5453
NMiniKQL::TScopedAlloc alloc (__LOCATION__);
5471
5454
NMiniKQL::TPAllocScope scope;
5472
5455
Datum datum = 0 ;
@@ -5475,23 +5458,16 @@ class TPgTypeDescriptor
5475
5458
pfree ((void *)datum);
5476
5459
}
5477
5460
};
5478
- PG_TRY ();
5479
- {
5480
- datum = Receive (binary.Data (), binary.Size ());
5481
- return {};
5482
- }
5483
- PG_CATCH ();
5484
- {
5485
- auto error_data = CopyErrorData ();
5461
+ try {
5462
+ datum = Receive (binary.Data (), binary.Size ());
5463
+ return {};
5464
+ } catch (const yexception& e) {
5486
5465
TStringBuilder errMsg;
5487
5466
errMsg << " Error in 'recv' function: "
5488
5467
<< NYql::NPg::LookupProc (ReceiveFuncId).Name
5489
- << " , reason: " << error_data->message ;
5490
- FreeErrorData (error_data);
5491
- FlushErrorState ();
5468
+ << " , reason: " << e.what ();
5492
5469
return errMsg;
5493
5470
}
5494
- PG_END_TRY ();
5495
5471
}
5496
5472
5497
5473
TCoerceResult Coerce (const TStringBuf binary, i32 typmod) {
@@ -5508,6 +5484,7 @@ class TPgTypeDescriptor
5508
5484
5509
5485
private:
5510
5486
TCoerceResult Coerce (bool isSourceBinary, const TStringBuf binary, Datum datum, i32 typmod) {
5487
+ NMiniKQL::TOnlyThrowingBindTerminator bind;
5511
5488
NMiniKQL::TScopedAlloc alloc (__LOCATION__);
5512
5489
NMiniKQL::TPAllocScope scope;
5513
5490
@@ -5535,8 +5512,7 @@ class TPgTypeDescriptor
5535
5512
pfree (serialized);
5536
5513
}
5537
5514
};
5538
- PG_TRY ();
5539
- {
5515
+ try {
5540
5516
if (isSourceBinary) {
5541
5517
datum = Receive (binary.Data (), binary.Size ());
5542
5518
}
@@ -5602,17 +5578,11 @@ class TPgTypeDescriptor
5602
5578
Y_ENSURE (!callInfo->isnull );
5603
5579
return {TString (NMiniKQL::GetVarBuf (serialized)), {}};
5604
5580
}
5605
- }
5606
- PG_CATCH ();
5607
- {
5608
- auto error_data = CopyErrorData ();
5581
+ } catch (const yexception& e) {
5609
5582
TStringBuilder errMsg;
5610
- errMsg << " Error while coercing value, reason: " << error_data->message ;
5611
- FreeErrorData (error_data);
5612
- FlushErrorState ();
5583
+ errMsg << " Error while coercing value, reason: " << e.what ();
5613
5584
return {{}, errMsg};
5614
5585
}
5615
- PG_END_TRY ();
5616
5586
}
5617
5587
5618
5588
Datum CoerceOne (ui32 typeId, Datum datum, i32 typmod) const {
0 commit comments