@@ -2914,6 +2914,9 @@ jsonb_toaster_save_object(Relation rel, Oid toasterid, JsonContainer *root,
29142914 JsonContainer * jc ;
29152915 JsonbContainerHeader * jbc ;
29162916
2917+ Datum value_to_toast ;
2918+ bool compress_chunks ;
2919+
29172920 for (i = 0 ; i < nkeys ; i ++ )
29182921 {
29192922 if (pairs [i ].value .type == jbvBinary &&
@@ -3045,9 +3048,6 @@ jsonb_toaster_save_object(Relation rel, Oid toasterid, JsonContainer *root,
30453048 if (!jsonb_toast_fields )
30463049 goto exit ;
30473050
3048- Datum value_to_toast ;
3049- bool compress_chunks ;
3050-
30513051 if (jsonb_compress_chunks && orig_val )
30523052 {
30533053 compress_chunks = true;
@@ -3108,8 +3108,8 @@ jsonb_toaster_save_object(Relation rel, Oid toasterid, JsonContainer *root,
31083108
31093109 //Assert(VARSIZE_ANY(toasted_val) == TOAST_POINTER_SIZE);
31103110
3111- fields [max_key_idx ].orig_value = ( Datum ) 0 ;
3112- fields [max_key_idx ].value = ( Datum ) 0 ;
3111+ fields [max_key_idx ].orig_value = NULL ;
3112+ fields [max_key_idx ].value = NULL ;
31133113 fields [max_key_idx ].size = offsetof(JsonbToastedContainerPointer , data ) + VARSIZE_ANY (toasted_val ); //TOAST_POINTER_SIZE;
31143114 fields [max_key_idx ].status = 't' ;
31153115 pairs [max_key_idx ].value .val .binary .data = jsonxzInitContainerFromDatum (jc , toasted_val );
@@ -3652,7 +3652,7 @@ jsonb_toaster_default_toast(Relation rel, Oid toasterid, char cmethod,
36523652 NULL , options , NULL , NULL , false);
36533653}
36543654
3655- static struct varlena *
3655+ static Datum
36563656jsonb_toaster_toast (Relation rel , Oid toasterid ,
36573657 Datum new_val , Datum old_val ,
36583658 int max_inline_size , int options )
@@ -3678,10 +3678,10 @@ jsonb_toaster_toast(Relation rel, Oid toasterid,
36783678
36793679 jsonbFreeIterators ();
36803680
3681- return ( struct varlena * ) DatumGetPointer ( res ) ;
3681+ return res ;
36823682}
36833683
3684- static struct varlena *
3684+ static Datum
36853685jsonb_toaster_update_toast (Relation rel , Oid toasterid ,
36863686 Datum new_val , Datum old_val ,
36873687 int options )
@@ -3699,10 +3699,10 @@ jsonb_toaster_update_toast(Relation rel, Oid toasterid,
36993699
37003700 jsonbFreeIterators ();
37013701
3702- return ( struct varlena * ) DatumGetPointer ( res ) ;
3702+ return res ;
37033703}
37043704
3705- static struct varlena *
3705+ static Datum
37063706jsonb_toaster_copy_toast (Relation rel , Oid toasterid ,
37073707 Datum new_val , int options )
37083708{
@@ -3717,7 +3717,7 @@ jsonb_toaster_copy_toast(Relation rel, Oid toasterid,
37173717
37183718 jsonbFreeIterators ();
37193719
3720- return ( struct varlena * ) DatumGetPointer ( res ) ;
3720+ return res ;
37213721}
37223722
37233723static void
@@ -3733,11 +3733,11 @@ jsonb_toaster_delete_toast(Datum val, bool is_speculative)
37333733 jsonbFreeIterators ();
37343734}
37353735
3736- static struct varlena *
3736+ static Datum
37373737jsonb_toaster_detoast (Datum toastptr , int sliceoffset , int slicelength )
37383738{
37393739 struct varlena * result ;
3740- Json jsbuf ;
3740+ // Json jsbuf;
37413741 Json * js ;
37423742 JsonValue bin ;
37433743 void * detoasted ;
@@ -3758,7 +3758,7 @@ jsonb_toaster_detoast(Datum toastptr, int sliceoffset, int slicelength)
37583758 jsonbFreeIterators ();
37593759
37603760 if (sliceoffset == 0 && (slicelength < 0 || slicelength >= len ))
3761- return detoasted ;
3761+ return PointerGetDatum ( detoasted ) ;
37623762
37633763 if (sliceoffset < 0 )
37643764 sliceoffset = 0 ;
@@ -3774,7 +3774,7 @@ jsonb_toaster_detoast(Datum toastptr, int sliceoffset, int slicelength)
37743774
37753775 pfree (detoasted );
37763776
3777- return result ;
3777+ return PointerGetDatum ( result ) ;
37783778}
37793779
37803780static void *
@@ -3789,10 +3789,11 @@ jsonb_toaster_vtable(Datum toast_ptr)
37893789}
37903790
37913791static void
3792- jsonb_toaster_init (Relation rel , Datum reloptions , LOCKMODE lockmode ,
3792+ jsonb_toaster_init (Relation rel , Oid toastoid , Oid toastindexoid ,
3793+ Datum reloptions , LOCKMODE lockmode ,
37933794 bool check , Oid OIDOldToast )
37943795{
3795- (void ) create_toast_table (rel , InvalidOid , InvalidOid , reloptions ,
3796+ (void ) create_toast_table (rel , toastoid , toastindexoid , reloptions ,
37963797 lockmode , check , OIDOldToast );
37973798}
37983799
0 commit comments