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

Commit71595a6

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

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
@@ -1856,7 +1856,7 @@ each_worker_jsonb(FunctionCallInfo fcinfo, const char *funcname, bool as_text)
18561856
/* Not in text mode, just return the Jsonb */
18571857
Jsonb*val=JsonbValueToJsonb(&v);
18581858

1859-
values[1]=PointerGetDatum(val);
1859+
values[1]=JsonbPGetDatum(val);
18601860
}
18611861

18621862
tuple=heap_form_tuple(ret_tdesc,values,nulls);
@@ -2141,7 +2141,7 @@ elements_worker_jsonb(FunctionCallInfo fcinfo, const char *funcname,
21412141
/* Not in text mode, just return the Jsonb */
21422142
Jsonb*val=JsonbValueToJsonb(&v);
21432143

2144-
values[0]=PointerGetDatum(val);
2144+
values[0]=JsonbPGetDatum(val);
21452145
}
21462146

21472147
tuple=heap_form_tuple(ret_tdesc,values,nulls);
@@ -4111,7 +4111,7 @@ jsonb_strip_nulls(PG_FUNCTION_ARGS)
41114111
boollast_was_key= false;
41124112

41134113
if (JB_ROOT_IS_SCALAR(jb))
4114-
PG_RETURN_POINTER(jb);
4114+
PG_RETURN_JSONB_P(jb);
41154115

41164116
it=JsonbIteratorInit(&jb->root);
41174117

@@ -4148,7 +4148,7 @@ jsonb_strip_nulls(PG_FUNCTION_ARGS)
41484148

41494149
Assert(res!=NULL);
41504150

4151-
PG_RETURN_POINTER(JsonbValueToJsonb(res));
4151+
PG_RETURN_JSONB_P(JsonbValueToJsonb(res));
41524152
}
41534153

41544154
/*
@@ -4211,7 +4211,7 @@ jsonb_pretty(PG_FUNCTION_ARGS)
42114211
Datum
42124212
jsonb_canonical(PG_FUNCTION_ARGS)
42134213
{
4214-
Jsonb*jb=PG_GETARG_JSONB(0);
4214+
Jsonb*jb=PG_GETARG_JSONB_P(0);
42154215
StringInfostr=makeStringInfo();
42164216

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

0 commit comments

Comments
 (0)

[8]ページ先頭

©2009-2025 Movatter.jp