From a749a23d7af4dba9b3468076ec561d2cbf69af09 Mon Sep 17 00:00:00 2001 From: Tom Lane Date: Sun, 29 Jun 2014 13:50:58 -0400 Subject: Remove use_json_as_text options from json_to_record/json_populate_record. The "false" case was really quite useless since all it did was to throw an error; a definition not helped in the least by making it the default. Instead let's just have the "true" case, which emits nested objects and arrays in JSON syntax. We might later want to provide the ability to emit sub-objects in Postgres record or array syntax, but we'd be best off to drive that off a check of the target field datatype, not a separate argument. For the functions newly added in 9.4, we can just remove the flag arguments outright. We can't do that for json_populate_record[set], which already existed in 9.3, but we can ignore the argument and always behave as if it were "true". It helps that the flag arguments were optional and not documented in any useful fashion anyway. --- doc/src/sgml/func.sgml | 26 ++++++++++++-------------- 1 file changed, 12 insertions(+), 14 deletions(-) (limited to 'doc/src') diff --git a/doc/src/sgml/func.sgml b/doc/src/sgml/func.sgml index 551576a08b6..cd2465e41c7 100644 --- a/doc/src/sgml/func.sgml +++ b/doc/src/sgml/func.sgml @@ -10562,8 +10562,8 @@ table2-mapping - json_populate_record(base anyelement, from_json json, [, use_json_as_text bool=false]) - jsonb_populate_record(base anyelement, from_json jsonb, [, use_json_as_text bool=false]) + json_populate_record(base anyelement, from_json json) + jsonb_populate_record(base anyelement, from_json jsonb) anyelement @@ -10581,8 +10581,8 @@ table2-mapping - json_populate_recordset(base anyelement, from_json json, [, use_json_as_text bool=false]) - jsonb_populate_recordset(base anyelement, from_json jsonb, [, use_json_as_text bool=false]) + json_populate_recordset(base anyelement, from_json json) + jsonb_populate_recordset(base anyelement, from_json jsonb) setof anyelement @@ -10655,18 +10655,17 @@ table2-mapping number - json_to_record(json [, nested_as_text bool=false]) - jsonb_to_record(jsonb [, nested_as_text bool=false]) + json_to_record(json) + jsonb_to_record(jsonb) record Builds an arbitrary record from a JSON object (see note below). As with all functions returning record, the caller must explicitly define the structure of the record with an AS - clause. If nested_as_text is true, the function - coerces nested complex elements to text. + clause. - select * from json_to_record('{"a":1,"b":[1,2,3],"c":"bar"}',true) as x(a int, b text, d text) + select * from json_to_record('{"a":1,"b":[1,2,3],"c":"bar"}') as x(a int, b text, d text) a | b | d @@ -10676,18 +10675,17 @@ table2-mapping - json_to_recordset(json [, nested_as_text bool=false]) - jsonb_to_recordset(jsonb [, nested_as_text bool=false]) + json_to_recordset(json) + jsonb_to_recordset(jsonb) setof record Builds an arbitrary set of records from a JSON array of objects (see note below). As with all functions returning record, the caller must explicitly define the structure of the record with - an AS clause. nested_as_text works as - with json_to_record. + an AS clause. - select * from json_to_recordset('[{"a":1,"b":"foo"},{"a":"2","c":"bar"}]',true) as x(a int, b text); + select * from json_to_recordset('[{"a":1,"b":"foo"},{"a":"2","c":"bar"}]') as x(a int, b text); a | b -- cgit v1.2.3