Location via proxy:   [ UP ]  
[Report a bug]   [Manage cookies]                
Skip to content

Commit e30954c

Browse files
author
Nikita Glukhov
committed
Use PG_RETURN_JSONB()/JsonbGetDatum() instead of PG_RETURN_JSONB()/PointerGetDatum()
1 parent 4a881f9 commit e30954c

File tree

4 files changed

+15
-15
lines changed

4 files changed

+15
-15
lines changed

contrib/hstore/hstore_io.c

+2-2
Original file line numberDiff line numberDiff line change
@@ -1413,7 +1413,7 @@ hstore_to_jsonb(PG_FUNCTION_ARGS)
14131413

14141414
res = pushJsonbValue(&state, WJB_END_OBJECT, NULL);
14151415

1416-
PG_RETURN_POINTER(JsonbValueToJsonb(res));
1416+
PG_RETURN_JSONB_P(JsonbValueToJsonb(res));
14171417
}
14181418

14191419
PG_FUNCTION_INFO_V1(hstore_to_jsonb_loose);
@@ -1489,5 +1489,5 @@ hstore_to_jsonb_loose(PG_FUNCTION_ARGS)
14891489

14901490
res = pushJsonbValue(&state, WJB_END_OBJECT, NULL);
14911491

1492-
PG_RETURN_POINTER(JsonbValueToJsonb(res));
1492+
PG_RETURN_JSONB_P(JsonbValueToJsonb(res));
14931493
}

contrib/jsonb_plpython/jsonb_plpython.c

+1-1
Original file line numberDiff line numberDiff line change
@@ -461,7 +461,7 @@ plpython_to_jsonb(PG_FUNCTION_ARGS)
461461

462462
obj = (PyObject *) PG_GETARG_POINTER(0);
463463
out = PLyObject_ToJsonbValue(obj, &jsonb_state, true);
464-
PG_RETURN_POINTER(JsonbValueToJsonb(out));
464+
PG_RETURN_JSONB_P(JsonbValueToJsonb(out));
465465
}
466466

467467
/*

src/backend/utils/adt/jsonb.c

+8-8
Original file line numberDiff line numberDiff line change
@@ -263,7 +263,7 @@ jsonb_from_cstring(char *json, int len, bool unique_keys)
263263
pg_parse_json_or_ereport(lex, &sem);
264264

265265
/* after parsing, the item member has the composed jsonb structure */
266-
PG_RETURN_POINTER(JsonbValueToJsonb(state.res));
266+
PG_RETURN_JSONB_P(JsonbValueToJsonb(state.res));
267267
}
268268

269269
static size_t
@@ -1122,7 +1122,7 @@ to_jsonb(PG_FUNCTION_ARGS)
11221122
jsonb_categorize_type(val_type,
11231123
&tcategory, &outfuncoid);
11241124

1125-
PG_RETURN_DATUM(to_jsonb_worker(val, tcategory, outfuncoid));
1125+
PG_RETURN_JSONB_P(to_jsonb_worker(val, tcategory, outfuncoid));
11261126
}
11271127

11281128
Datum
@@ -1208,7 +1208,7 @@ jsonb_build_object_noargs(PG_FUNCTION_ARGS)
12081208
(void) pushJsonbValue(&result.parseState, WJB_BEGIN_OBJECT, NULL);
12091209
result.res = pushJsonbValue(&result.parseState, WJB_END_OBJECT, NULL);
12101210

1211-
PG_RETURN_POINTER(JsonbValueToJsonb(result.res));
1211+
PG_RETURN_JSONB_P(JsonbValueToJsonb(result.res));
12121212
}
12131213

12141214
Datum
@@ -1269,7 +1269,7 @@ jsonb_build_array_noargs(PG_FUNCTION_ARGS)
12691269
(void) pushJsonbValue(&result.parseState, WJB_BEGIN_ARRAY, NULL);
12701270
result.res = pushJsonbValue(&result.parseState, WJB_END_ARRAY, NULL);
12711271

1272-
PG_RETURN_POINTER(JsonbValueToJsonb(result.res));
1272+
PG_RETURN_JSONB_P(JsonbValueToJsonb(result.res));
12731273
}
12741274

12751275

@@ -1371,7 +1371,7 @@ jsonb_object(PG_FUNCTION_ARGS)
13711371
close_object:
13721372
result.res = pushJsonbValue(&result.parseState, WJB_END_OBJECT, NULL);
13731373

1374-
PG_RETURN_POINTER(JsonbValueToJsonb(result.res));
1374+
PG_RETURN_JSONB_P(JsonbValueToJsonb(result.res));
13751375
}
13761376

13771377
/*
@@ -1463,7 +1463,7 @@ jsonb_object_two_arg(PG_FUNCTION_ARGS)
14631463
close_object:
14641464
result.res = pushJsonbValue(&result.parseState, WJB_END_OBJECT, NULL);
14651465

1466-
PG_RETURN_POINTER(JsonbValueToJsonb(result.res));
1466+
PG_RETURN_JSONB_P(JsonbValueToJsonb(result.res));
14671467
}
14681468

14691469
static Datum
@@ -1634,7 +1634,7 @@ jsonb_agg_finalfn(PG_FUNCTION_ARGS)
16341634

16351635
out = JsonbValueToJsonb(result.res);
16361636

1637-
PG_RETURN_POINTER(out);
1637+
PG_RETURN_JSONB_P(out);
16381638
}
16391639

16401640
static Datum
@@ -1925,7 +1925,7 @@ jsonb_object_agg_finalfn(PG_FUNCTION_ARGS)
19251925

19261926
out = JsonbValueToJsonb(result.res);
19271927

1928-
PG_RETURN_POINTER(out);
1928+
PG_RETURN_JSONB_P(out);
19291929
}
19301930

19311931

src/backend/utils/adt/jsonfuncs.c

+4-4
Original file line numberDiff line numberDiff line change
@@ -1969,7 +1969,7 @@ each_worker_jsonb(FunctionCallInfo fcinfo, const char *funcname, bool as_text)
19691969
/* Not in text mode, just return the Jsonb */
19701970
Jsonb *val = JsonbValueToJsonb(&v);
19711971

1972-
values[1] = PointerGetDatum(val);
1972+
values[1] = JsonbPGetDatum(val);
19731973
}
19741974

19751975
tuplestore_putvalues(rsi->setResult, rsi->setDesc, values, nulls);
@@ -2201,7 +2201,7 @@ elements_worker_jsonb(FunctionCallInfo fcinfo, const char *funcname,
22012201
/* Not in text mode, just return the Jsonb */
22022202
Jsonb *val = JsonbValueToJsonb(&v);
22032203

2204-
values[0] = PointerGetDatum(val);
2204+
values[0] = JsonbPGetDatum(val);
22052205
}
22062206

22072207
tuplestore_putvalues(rsi->setResult, rsi->setDesc, values, nulls);
@@ -4185,7 +4185,7 @@ jsonb_strip_nulls(PG_FUNCTION_ARGS)
41854185
bool last_was_key = false;
41864186

41874187
if (JB_ROOT_IS_SCALAR(jb))
4188-
PG_RETURN_POINTER(jb);
4188+
PG_RETURN_JSONB_P(jb);
41894189

41904190
it = JsonbIteratorInit(&jb->root);
41914191

@@ -4222,7 +4222,7 @@ jsonb_strip_nulls(PG_FUNCTION_ARGS)
42224222

42234223
Assert(res != NULL);
42244224

4225-
PG_RETURN_POINTER(JsonbValueToJsonb(res));
4225+
PG_RETURN_JSONB_P(JsonbValueToJsonb(res));
42264226
}
42274227

42284228
/*

0 commit comments

Comments
 (0)