@@ -1217,8 +1217,8 @@ Datum
1217
1217
json_populate_record (PG_FUNCTION_ARGS )
1218
1218
{
1219
1219
Oid 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 ;
1222
1222
HTAB * json_hash ;
1223
1223
HeapTupleHeader rec ;
1224
1224
Oid tupType ;
@@ -1234,6 +1234,7 @@ json_populate_record(PG_FUNCTION_ARGS)
1234
1234
char fname [NAMEDATALEN ];
1235
1235
JsonHashEntry hashentry ;
1236
1236
1237
+ use_json_as_text = PG_ARGISNULL (2 ) ? false : PG_GETARG_BOOL (2 );
1237
1238
1238
1239
if (!type_is_rowtype (argtype ))
1239
1240
ereport (ERROR ,
@@ -1267,6 +1268,8 @@ json_populate_record(PG_FUNCTION_ARGS)
1267
1268
tupTypmod = HeapTupleHeaderGetTypMod (rec );
1268
1269
}
1269
1270
1271
+ json = PG_GETARG_TEXT_P (1 );
1272
+
1270
1273
json_hash = get_json_object_as_hash (json , "json_populate_record" , use_json_as_text );
1271
1274
1272
1275
/*
@@ -1559,8 +1562,8 @@ Datum
1559
1562
json_populate_recordset (PG_FUNCTION_ARGS )
1560
1563
{
1561
1564
Oid 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 ;
1564
1567
ReturnSetInfo * rsi ;
1565
1568
MemoryContext old_cxt ;
1566
1569
Oid tupType ;
@@ -1573,6 +1576,8 @@ json_populate_recordset(PG_FUNCTION_ARGS)
1573
1576
JsonSemAction sem ;
1574
1577
PopulateRecordsetState state ;
1575
1578
1579
+ use_json_as_text = PG_ARGISNULL (2 ) ? false : PG_GETARG_BOOL (2 );
1580
+
1576
1581
if (!type_is_rowtype (argtype ))
1577
1582
ereport (ERROR ,
1578
1583
(errcode (ERRCODE_DATATYPE_MISMATCH ),
@@ -1616,6 +1621,8 @@ json_populate_recordset(PG_FUNCTION_ARGS)
1616
1621
if (PG_ARGISNULL (1 ))
1617
1622
PG_RETURN_NULL ();
1618
1623
1624
+ json = PG_GETARG_TEXT_P (1 );
1625
+
1619
1626
if (PG_ARGISNULL (0 ))
1620
1627
rec = NULL ;
1621
1628
else
0 commit comments