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

Commit6de0f21

Browse files
author
Nikita Glukhov
committed
Fix double detoasting of compressed jsonbs
1 parentb402076 commit6de0f21

File tree

1 file changed

+13
-4
lines changed

1 file changed

+13
-4
lines changed

‎src/backend/utils/adt/jsonb_util.c

Lines changed: 13 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -2913,15 +2913,13 @@ jsonbzIteratorInit(JsonContainer *jc)
29132913
}
29142914

29152915
staticvoid
2916-
jsonbzInit(JsonContainerData*jc,Datumvalue)
2916+
jsonbzInitFromCompresedDatum(JsonContainerData*jc,CompressedDatum*cd)
29172917
{
29182918
CompressedJsonb*cjb=palloc(sizeof(*cjb));
2919-
CompressedDatum*cd=palloc(sizeof(*cd));
29202919

29212920
cjb->datum=cd;
29222921
cjb->offset= offsetof(Jsonb,root);
29232922

2924-
CompressedDatumInit(cd,value);
29252923
if (!jsonb_partial_decompression)
29262924
CompressedDatumDecompressAll(cd);
29272925
else
@@ -2930,6 +2928,16 @@ jsonbzInit(JsonContainerData *jc, Datum value)
29302928
jsonbzInitContainer(jc,cjb,VARSIZE_ANY_EXHDR(cd->data));// cd->total_len - VARHDRSZ
29312929
}
29322930

2931+
staticvoid
2932+
jsonbzInit(JsonContainerData*jc,Datumvalue)
2933+
{
2934+
CompressedDatum*cd=palloc(sizeof(*cd));
2935+
2936+
CompressedDatumInit(cd,value);
2937+
2938+
jsonbzInitFromCompresedDatum(jc,cd);
2939+
}
2940+
29332941
JsonContainerOps
29342942
jsonbzContainerOps=
29352943
{
@@ -2973,7 +2981,8 @@ DatumGetJsonbPC(Datum datum, Json *tmp, bool copy)
29732981

29742982
js=JsonExpand(tmp, (Datum)0, false,&jsonbzContainerOps);
29752983

2976-
jsonbzInit(&js->root,datum);
2984+
jsonbzInitFromCompresedDatum(&js->root,
2985+
memcpy(palloc(sizeof(cd)),&cd,sizeof(cd)));
29772986

29782987
returnjs;
29792988
}

0 commit comments

Comments
 (0)

[8]ページ先頭

©2009-2025 Movatter.jp