@@ -1217,8 +1217,8 @@ Datum
12171217json_populate_record (PG_FUNCTION_ARGS )
12181218{
12191219Oid argtype = get_fn_expr_argtype (fcinfo -> flinfo ,0 );
1220- text * json = PG_GETARG_TEXT_P ( 1 ) ;
1221- bool use_json_as_text = PG_GETARG_BOOL ( 2 ) ;
1220+ text * json ;
1221+ bool use_json_as_text ;
12221222HTAB * json_hash ;
12231223HeapTupleHeader rec ;
12241224Oid tupType ;
@@ -1234,6 +1234,7 @@ json_populate_record(PG_FUNCTION_ARGS)
12341234char fname [NAMEDATALEN ];
12351235JsonHashEntry hashentry ;
12361236
1237+ use_json_as_text = PG_ARGISNULL (2 ) ? false :PG_GETARG_BOOL (2 );
12371238
12381239if (!type_is_rowtype (argtype ))
12391240ereport (ERROR ,
@@ -1267,6 +1268,8 @@ json_populate_record(PG_FUNCTION_ARGS)
12671268tupTypmod = HeapTupleHeaderGetTypMod (rec );
12681269}
12691270
1271+ json = PG_GETARG_TEXT_P (1 );
1272+
12701273json_hash = get_json_object_as_hash (json ,"json_populate_record" ,use_json_as_text );
12711274
12721275/*
@@ -1559,8 +1562,8 @@ Datum
15591562json_populate_recordset (PG_FUNCTION_ARGS )
15601563{
15611564Oid argtype = get_fn_expr_argtype (fcinfo -> flinfo ,0 );
1562- text * json = PG_GETARG_TEXT_P ( 1 ) ;
1563- bool use_json_as_text = PG_GETARG_BOOL ( 2 ) ;
1565+ text * json ;
1566+ bool use_json_as_text ;
15641567ReturnSetInfo * rsi ;
15651568MemoryContext old_cxt ;
15661569Oid tupType ;
@@ -1573,6 +1576,8 @@ json_populate_recordset(PG_FUNCTION_ARGS)
15731576JsonSemAction sem ;
15741577PopulateRecordsetState state ;
15751578
1579+ use_json_as_text = PG_ARGISNULL (2 ) ? false :PG_GETARG_BOOL (2 );
1580+
15761581if (!type_is_rowtype (argtype ))
15771582ereport (ERROR ,
15781583(errcode (ERRCODE_DATATYPE_MISMATCH ),
@@ -1616,6 +1621,8 @@ json_populate_recordset(PG_FUNCTION_ARGS)
16161621if (PG_ARGISNULL (1 ))
16171622PG_RETURN_NULL ();
16181623
1624+ json = PG_GETARG_TEXT_P (1 );
1625+
16191626if (PG_ARGISNULL (0 ))
16201627rec = NULL ;
16211628else