File tree Expand file tree Collapse file tree 1 file changed +15
-10
lines changed Expand file tree Collapse file tree 1 file changed +15
-10
lines changed Original file line number Diff line number Diff line change @@ -251,15 +251,8 @@ jsonb_typeof(PG_FUNCTION_ARGS)
251251 PG_RETURN_TEXT_P (cstring_to_text (result ));
252252}
253253
254- /*
255- * jsonb_from_cstring
256- *
257- * Turns json string into a jsonb Datum.
258- *
259- * Uses the json parser (with hooks) to construct a jsonb.
260- */
261- static inline Datum
262- jsonb_from_cstring (char * json , int len )
254+ static JsonbValue *
255+ JsonValueFromCString (char * json , int len )
263256{
264257 JsonLexContext * lex ;
265258 JsonbInState state ;
@@ -281,9 +274,21 @@ jsonb_from_cstring(char *json, int len)
281274 pg_parse_json_or_ereport (lex , & sem );
282275
283276 /* after parsing, the item member has the composed jsonb structure */
284- PG_RETURN_JSONB_P ( JsonbValueToJsonb ( state .res )) ;
277+ return state .res ;
285278}
286279
280+ /*
281+ * jsonb_from_cstring
282+ *
283+ * Turns json string into a jsonb Datum.
284+ *
285+ * Uses the json parser (with hooks) to construct a jsonb.
286+ */
287+ static inline Datum
288+ jsonb_from_cstring (char * json , int len )
289+ {
290+ PG_RETURN_JSONB_P (JsonbValueToJsonb (JsonValueFromCString (json , len )));
291+ }
287292
288293static void
289294jsonb_in_object_start (void * pstate )
You can’t perform that action at this time.
0 commit comments