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

Commit24d0fe1

Browse files
author
Nikita Glukhov
committed
Fix double detoasting of compressed jsonbs
1 parent5a3015c commit24d0fe1

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
@@ -2850,15 +2850,13 @@ jsonbzIteratorInit(JsonContainer *jc)
28502850
}
28512851

28522852
staticvoid
2853-
jsonbzInit(JsonContainerData*jc,Datumvalue)
2853+
jsonbzInitFromCompresedDatum(JsonContainerData*jc,CompressedDatum*cd)
28542854
{
28552855
CompressedJsonb*cjb=palloc(sizeof(*cjb));
2856-
CompressedDatum*cd=palloc(sizeof(*cd));
28572856

28582857
cjb->datum=cd;
28592858
cjb->offset= offsetof(Jsonb,root);
28602859

2861-
CompressedDatumInit(cd,value);
28622860
if (!jsonb_partial_decompression)
28632861
CompressedDatumDecompressAll(cd);
28642862
else
@@ -2867,6 +2865,16 @@ jsonbzInit(JsonContainerData *jc, Datum value)
28672865
jsonbzInitContainer(jc,cjb,VARSIZE_ANY_EXHDR(cd->data));// cd->total_len - VARHDRSZ
28682866
}
28692867

2868+
staticvoid
2869+
jsonbzInit(JsonContainerData*jc,Datumvalue)
2870+
{
2871+
CompressedDatum*cd=palloc(sizeof(*cd));
2872+
2873+
CompressedDatumInit(cd,value);
2874+
2875+
jsonbzInitFromCompresedDatum(jc,cd);
2876+
}
2877+
28702878
JsonContainerOps
28712879
jsonbzContainerOps=
28722880
{
@@ -2910,7 +2918,8 @@ DatumGetJsonbPC(Datum datum, Json *tmp, bool copy)
29102918

29112919
js=JsonExpand(tmp, (Datum)0, false,&jsonbzContainerOps);
29122920

2913-
jsonbzInit(&js->root,datum);
2921+
jsonbzInitFromCompresedDatum(&js->root,
2922+
memcpy(palloc(sizeof(cd)),&cd,sizeof(cd)));
29142923

29152924
returnjs;
29162925
}

0 commit comments

Comments
 (0)

[8]ページ先頭

©2009-2025 Movatter.jp