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

Commitd54b299

Browse files
author
Nikita Glukhov
committed
Add GUC jsonb_sort_field_values
1 parentcd87628 commitd54b299

File tree

3 files changed

+13
-3
lines changed

3 files changed

+13
-3
lines changed

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

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -31,8 +31,6 @@
3131
#include"utils/memutils.h"
3232
#include"utils/varlena.h"
3333

34-
#defineJSONB_SORTED_VALUES 1
35-
3634
/*
3735
* Maximum number of elements in an array (or key/value pairs in an object).
3836
* This is limited by two things: the size of the JEntry array must fit
@@ -140,6 +138,7 @@ static JsonbValue *fillCompressedJsonbValue(CompressedJsonb *cjb,
140138
uint32offset,JsonValue*result);
141139
staticJsonbContainer*jsonbzDecompress(JsonContainer*jc);
142140

141+
booljsonb_sort_field_values= true;/* GUC */
143142

144143
JsonValue*
145144
JsonValueUnpackBinary(constJsonValue*jbv)
@@ -1959,7 +1958,7 @@ convertJsonbObject(StringInfo buffer, JEntry *pheader, const JsonbValue *val, in
19591958
uint32header;
19601959
intnPairs=val->val.object.nPairs;
19611960
intreserved_size;
1962-
boolsorted_values=JSONB_SORTED_VALUES&&nPairs>1;
1961+
boolsorted_values=jsonb_sort_field_values&&nPairs>1;
19631962
struct
19641963
{
19651964
intsize;

‎src/backend/utils/misc/guc.c

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -90,6 +90,7 @@
9090
#include"utils/bytea.h"
9191
#include"utils/float.h"
9292
#include"utils/guc_tables.h"
93+
#include"utils/jsonb.h"
9394
#include"utils/memutils.h"
9495
#include"utils/pg_locale.h"
9596
#include"utils/pg_lsn.h"
@@ -2036,6 +2037,15 @@ static struct config_bool ConfigureNamesBool[] =
20362037
NULL,NULL,NULL
20372038
},
20382039

2040+
{
2041+
{"jsonb_sort_field_values",PGC_USERSET,DEVELOPER_OPTIONS,
2042+
gettext_noop("Use special binary jsonb format for objects when their field values sorted by length."),
2043+
},
2044+
&jsonb_sort_field_values,
2045+
true,
2046+
NULL,NULL,NULL
2047+
},
2048+
20392049
/* End-of-list marker */
20402050
{
20412051
{NULL,0,0,NULL,NULL},NULL, false,NULL,NULL,NULL

‎src/include/utils/jsonb.h

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -413,5 +413,6 @@ extern void JsonbHashScalarValueExtended(const JsonbValue *scalarVal,
413413
externintreserveFromBuffer(StringInfobuffer,intlen);
414414
externvoidappendToBuffer(StringInfobuffer,constvoid*data,intlen);
415415

416+
externbooljsonb_sort_field_values;/* GUC */
416417

417418
#endif/* __JSONB_H__ */

0 commit comments

Comments
 (0)

[8]ページ先頭

©2009-2025 Movatter.jp