Skip to content

Commit aa41d7d

Browse files
Nikita MalakhovNikita Glukhov
authored andcommitted
Minor changes to build jsonb_toaster and make it work
1 parent 4263788 commit aa41d7d

File tree

4 files changed

+19
-9
lines changed

4 files changed

+19
-9
lines changed

contrib/Makefile

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -24,6 +24,7 @@ SUBDIRS = \
2424
earthdistance \
2525
file_fdw \
2626
fuzzystrmatch \
27+
jsonb_toaster \
2728
hstore \
2829
intagg \
2930
intarray \

src/backend/utils/adt/jsonb.c

Lines changed: 11 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -108,10 +108,12 @@ jsonb_recv(PG_FUNCTION_ARGS)
108108
Datum
109109
jsonb_out(PG_FUNCTION_ARGS)
110110
{
111+
Jsonb *jb;
112+
char *out;
113+
111114
jsonbInitIterators();
112115

113-
Jsonb *jb = PG_GETARG_JSONB_P(0);
114-
char *out;
116+
jb = PG_GETARG_JSONB_P(0);
115117

116118
out = JsonToCString(JsonbRoot(jb), NULL);
117119

@@ -129,13 +131,16 @@ jsonb_out(PG_FUNCTION_ARGS)
129131
Datum
130132
jsonb_send(PG_FUNCTION_ARGS)
131133
{
132-
jsonbInitIterators();
133-
134-
Jsonb *jb = PG_GETARG_JSONB_P(0);
134+
Jsonb *jb;
135135
StringInfoData buf;
136-
StringInfo jtext = makeStringInfo();
136+
StringInfo jtext;
137137
int version = 1;
138138

139+
jsonbInitIterators();
140+
141+
jb = PG_GETARG_JSONB_P(0);
142+
jtext = makeStringInfo();
143+
139144
(void) JsonToCString(JsonbRoot(jb), jtext);
140145

141146
jsonbFreeIterators();

src/backend/utils/adt/jsonb_util.c

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2368,9 +2368,11 @@ convertJsonbBinary(StringInfo buffer, JEntry *pheader, const JsonbValue *val,
23682368
appendToBuffer(buffer, (void *) jbc, jc->len);
23692369
*pheader = JENTRY_ISCONTAINER | (buffer->len - base_offset);
23702370
}
2371+
#if 0 /* XXX jsonv */
23712372
else if (jc->ops == &jsonvContainerOps && !JsonContainerIsScalar(jc))
23722373
convertJsonbValue(buffer, pheader,
23732374
(const JsonValue *) JsonContainerDataPtr(jc), level);
2375+
#endif
23742376
else
23752377
convertJsonbValue(buffer, pheader, JsonValueUnpackBinary(val), level);
23762378
}
@@ -2649,7 +2651,7 @@ jsonbzInitContainer(JsonContainerData *jc, CompressedJsonb *cjb,
26492651
JsonbContainerHdr header = pheader ? *pheader : jbc->header;
26502652

26512653
*(CompressedJsonb *) &jc->_data = *cjb;
2652-
((CompressedJsonb *) &jc->_data)->header = header;
2654+
/* ((CompressedJsonb *) &jc->_data)->header = header; */
26532655

26542656
jc->ops = &jsonbzContainerOps;
26552657
jc->len = len;

src/backend/utils/adt/numeric.c

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -734,11 +734,13 @@ numeric_in(PG_FUNCTION_ARGS)
734734
Datum
735735
numeric_out(PG_FUNCTION_ARGS)
736736
{
737-
Assert(!VARATT_IS_COMPRESSED(PG_GETARG_DATUM(0)));
738-
Numeric num = PG_GETARG_NUMERIC(0);
737+
Numeric num;
739738
NumericVar x;
740739
char *str;
741740

741+
Assert(!VARATT_IS_COMPRESSED(PG_GETARG_DATUM(0)));
742+
num = PG_GETARG_NUMERIC(0);
743+
742744
/*
743745
* Handle NaN and infinities
744746
*/

0 commit comments

Comments
 (0)
pFad - Phonifier reborn

Pfad - The Proxy pFad of © 2024 Garber Painting. All rights reserved.

Note: This service is not intended for secure transactions such as banking, social media, email, or purchasing. Use at your own risk. We assume no liability whatsoever for broken pages.


Alternative Proxies:

Alternative Proxy

pFad Proxy

pFad v3 Proxy

pFad v4 Proxy