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

Commite3a5760

Browse files
author
Nikita Glukhov
committed
Use PG_RETURN_JSONB()/JsonbGetDatum() instead of PG_RETURN_JSONB()/PointerGetDatum()
1 parent1c7856d commite3a5760

File tree

4 files changed

+18
-18
lines changed

4 files changed

+18
-18
lines changed

‎contrib/hstore/hstore_io.c

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1419,7 +1419,7 @@ hstore_to_jsonb(PG_FUNCTION_ARGS)
14191419

14201420
res=pushJsonbValue(&state,WJB_END_OBJECT,NULL);
14211421

1422-
PG_RETURN_POINTER(JsonbValueToJsonb(res));
1422+
PG_RETURN_JSONB_P(JsonbValueToJsonb(res));
14231423
}
14241424

14251425
PG_FUNCTION_INFO_V1(hstore_to_jsonb_loose);
@@ -1495,5 +1495,5 @@ hstore_to_jsonb_loose(PG_FUNCTION_ARGS)
14951495

14961496
res=pushJsonbValue(&state,WJB_END_OBJECT,NULL);
14971497

1498-
PG_RETURN_POINTER(JsonbValueToJsonb(res));
1498+
PG_RETURN_JSONB_P(JsonbValueToJsonb(res));
14991499
}

‎contrib/jsonb_plpython/jsonb_plpython.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -468,7 +468,7 @@ plpython_to_jsonb(PG_FUNCTION_ARGS)
468468

469469
obj= (PyObject*)PG_GETARG_POINTER(0);
470470
out=PLyObject_ToJsonbValue(obj,&jsonb_state, true);
471-
PG_RETURN_POINTER(JsonbValueToJsonb(out));
471+
PG_RETURN_JSONB_P(JsonbValueToJsonb(out));
472472
}
473473

474474
/*

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

Lines changed: 10 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -282,7 +282,7 @@ jsonb_from_cstring(char *json, int len)
282282
pg_parse_json_or_ereport(lex,&sem);
283283

284284
/* after parsing, the item member has the composed jsonb structure */
285-
PG_RETURN_POINTER(JsonbValueToJsonb(state.res));
285+
PG_RETURN_JSONB_P(JsonbValueToJsonb(state.res));
286286
}
287287

288288
staticsize_t
@@ -1109,7 +1109,7 @@ to_jsonb(PG_FUNCTION_ARGS)
11091109

11101110
datum_to_jsonb(val, false,&result,tcategory,outfuncoid, false);
11111111

1112-
PG_RETURN_POINTER(JsonbValueToJsonb(result.res));
1112+
PG_RETURN_JSONB_P(JsonbValueToJsonb(result.res));
11131113
}
11141114

11151115
/*
@@ -1159,7 +1159,7 @@ jsonb_build_object(PG_FUNCTION_ARGS)
11591159

11601160
result.res=pushJsonbValue(&result.parseState,WJB_END_OBJECT,NULL);
11611161

1162-
PG_RETURN_POINTER(JsonbValueToJsonb(result.res));
1162+
PG_RETURN_JSONB_P(JsonbValueToJsonb(result.res));
11631163
}
11641164

11651165
/*
@@ -1175,7 +1175,7 @@ jsonb_build_object_noargs(PG_FUNCTION_ARGS)
11751175
(void)pushJsonbValue(&result.parseState,WJB_BEGIN_OBJECT,NULL);
11761176
result.res=pushJsonbValue(&result.parseState,WJB_END_OBJECT,NULL);
11771177

1178-
PG_RETURN_POINTER(JsonbValueToJsonb(result.res));
1178+
PG_RETURN_JSONB_P(JsonbValueToJsonb(result.res));
11791179
}
11801180

11811181
/*
@@ -1206,7 +1206,7 @@ jsonb_build_array(PG_FUNCTION_ARGS)
12061206

12071207
result.res=pushJsonbValue(&result.parseState,WJB_END_ARRAY,NULL);
12081208

1209-
PG_RETURN_POINTER(JsonbValueToJsonb(result.res));
1209+
PG_RETURN_JSONB_P(JsonbValueToJsonb(result.res));
12101210
}
12111211

12121212
/*
@@ -1222,7 +1222,7 @@ jsonb_build_array_noargs(PG_FUNCTION_ARGS)
12221222
(void)pushJsonbValue(&result.parseState,WJB_BEGIN_ARRAY,NULL);
12231223
result.res=pushJsonbValue(&result.parseState,WJB_END_ARRAY,NULL);
12241224

1225-
PG_RETURN_POINTER(JsonbValueToJsonb(result.res));
1225+
PG_RETURN_JSONB_P(JsonbValueToJsonb(result.res));
12261226
}
12271227

12281228

@@ -1326,7 +1326,7 @@ jsonb_object(PG_FUNCTION_ARGS)
13261326
close_object:
13271327
result.res=pushJsonbValue(&result.parseState,WJB_END_OBJECT,NULL);
13281328

1329-
PG_RETURN_POINTER(JsonbValueToJsonb(result.res));
1329+
PG_RETURN_JSONB_P(JsonbValueToJsonb(result.res));
13301330
}
13311331

13321332
/*
@@ -1423,7 +1423,7 @@ jsonb_object_two_arg(PG_FUNCTION_ARGS)
14231423
close_object:
14241424
result.res=pushJsonbValue(&result.parseState,WJB_END_OBJECT,NULL);
14251425

1426-
PG_RETURN_POINTER(JsonbValueToJsonb(result.res));
1426+
PG_RETURN_JSONB_P(JsonbValueToJsonb(result.res));
14271427
}
14281428

14291429

@@ -1577,7 +1577,7 @@ jsonb_agg_finalfn(PG_FUNCTION_ARGS)
15771577

15781578
out=JsonbValueToJsonb(result.res);
15791579

1580-
PG_RETURN_POINTER(out);
1580+
PG_RETURN_JSONB_P(out);
15811581
}
15821582

15831583
/*
@@ -1809,7 +1809,7 @@ jsonb_object_agg_finalfn(PG_FUNCTION_ARGS)
18091809

18101810
out=JsonbValueToJsonb(result.res);
18111811

1812-
PG_RETURN_POINTER(out);
1812+
PG_RETURN_JSONB_P(out);
18131813
}
18141814

18151815

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

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1998,7 +1998,7 @@ each_worker_jsonb(FunctionCallInfo fcinfo, const char *funcname, bool as_text)
19981998
/* Not in text mode, just return the Jsonb */
19991999
Jsonb*val=JsonbValueToJsonb(&v);
20002000

2001-
values[1]=PointerGetDatum(val);
2001+
values[1]=JsonbPGetDatum(val);
20022002
}
20032003

20042004
tuple=heap_form_tuple(ret_tdesc,values,nulls);
@@ -2283,7 +2283,7 @@ elements_worker_jsonb(FunctionCallInfo fcinfo, const char *funcname,
22832283
/* Not in text mode, just return the Jsonb */
22842284
Jsonb*val=JsonbValueToJsonb(&v);
22852285

2286-
values[0]=PointerGetDatum(val);
2286+
values[0]=JsonbPGetDatum(val);
22872287
}
22882288

22892289
tuple=heap_form_tuple(ret_tdesc,values,nulls);
@@ -4251,7 +4251,7 @@ jsonb_strip_nulls(PG_FUNCTION_ARGS)
42514251
boollast_was_key= false;
42524252

42534253
if (JB_ROOT_IS_SCALAR(jb))
4254-
PG_RETURN_POINTER(jb);
4254+
PG_RETURN_JSONB_P(jb);
42554255

42564256
it=JsonbIteratorInit(&jb->root);
42574257

@@ -4288,7 +4288,7 @@ jsonb_strip_nulls(PG_FUNCTION_ARGS)
42884288

42894289
Assert(res!=NULL);
42904290

4291-
PG_RETURN_POINTER(JsonbValueToJsonb(res));
4291+
PG_RETURN_JSONB_P(JsonbValueToJsonb(res));
42924292
}
42934293

42944294
/*
@@ -4310,7 +4310,7 @@ jsonb_pretty(PG_FUNCTION_ARGS)
43104310
Datum
43114311
jsonb_canonical(PG_FUNCTION_ARGS)
43124312
{
4313-
Jsonb*jb=PG_GETARG_JSONB(0);
4313+
Jsonb*jb=PG_GETARG_JSONB_P(0);
43144314
StringInfostr=makeStringInfo();
43154315

43164316
JsonbToCStringCanonical(str,&jb->root,VARSIZE(jb));

0 commit comments

Comments
 (0)

[8]ページ先頭

©2009-2025 Movatter.jp