Movatterモバイル変換


[0]ホーム

URL:


Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

Commit740222f

Browse files
author
Nikita Glukhov
committed
TMP
1 parentd8a6565 commit740222f

File tree

1 file changed

+51
-1
lines changed

1 file changed

+51
-1
lines changed

‎contrib/jsonb_toaster/jsonb_toaster.c

Lines changed: 51 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2662,7 +2662,6 @@ jsonb_toaster_save_object(Relation rel, Oid toasterid, JsonContainer *root,
26622662
if (!jsonb_toast_fields)
26632663
gotoexit;
26642664

2665-
26662665
Datumvalue_to_toast;
26672666
boolcompress_chunks;
26682667

@@ -3142,6 +3141,54 @@ jsonb_toaster_validate(Oid typeoid, char storage, char compression,
31423141
returnok;
31433142
}
31443143

3144+
staticDatum
3145+
jsonb_toaster_toast2(Relationrel,Oidtoasterid,Datumval,Datumcompressed_val,
3146+
intmax_inline_size,intoptions)
3147+
{
3148+
Datumtoasted_val;
3149+
boolcompress_chunks=jsonb_compress_chunks;
3150+
3151+
if (jsonb_direct_toast&&VARSIZE_ANY(compressed_val) /1900*1+TOAST_POINTER_SIZE+16<max_inline_size)
3152+
{
3153+
structvarlena*chunks=NULL;
3154+
3155+
toasted_val=jsonx_toast_save_datum_ext(rel,toasterid,val,NULL,0,&chunks,compress_chunks);
3156+
3157+
if (!chunks)
3158+
;
3159+
elseif (VARSIZE_ANY(chunks) <=max_inline_size)
3160+
{
3161+
pfree(DatumGetPointer(toasted_val));
3162+
toasted_val=PointerGetDatum(chunks);
3163+
}
3164+
else
3165+
{
3166+
if (jsonb_compress_chunk_tids)
3167+
{
3168+
structvarlena*compressed_chunks=jsonx_toast_compress_tids(chunks,max_inline_size);
3169+
3170+
if (compressed_chunks)
3171+
{
3172+
if (VARSIZE_ANY(compressed_chunks) <=max_inline_size)
3173+
{
3174+
pfree(DatumGetPointer(toasted_val));
3175+
toasted_val=PointerGetDatum(compressed_chunks);
3176+
}
3177+
else
3178+
pfree(compressed_chunks);
3179+
}
3180+
}
3181+
3182+
pfree(chunks);
3183+
}
3184+
}
3185+
else
3186+
toasted_val=jsonx_toast_save_datum_ext(rel,toasterid,val,
3187+
NULL,options,NULL,compress_chunks);
3188+
3189+
returntoasted_val;
3190+
}
3191+
31453192
staticDatum
31463193
jsonb_toaster_default_toast(Relationrel,Oidtoasterid,charcmethod,
31473194
Datumnew_val,Json*new_js,
@@ -3171,6 +3218,9 @@ jsonb_toaster_default_toast(Relation rel, Oid toasterid, char cmethod,
31713218
if (VARSIZE_ANY(compressed_val) <=max_inline_size)
31723219
returncompressed_val;
31733220

3221+
returnjsonb_toaster_toast2(rel,toasterid,new_val,compressed_val,
3222+
max_inline_size,options);
3223+
31743224
returnjsonx_toast_save_datum_ext(rel,toasterid,compressed_val,
31753225
NULL,options,NULL, false);
31763226
}

0 commit comments

Comments
 (0)

[8]ページ先頭

©2009-2025 Movatter.jp