/*
* Ignore nested fields.
*/
- if (_state->lex->lex_level > 2)
+ if (_state->lex->lex_level > 1)
return;
/*
2 | {"d":"bar"} | f
(2 rows)
+select *, c is null as c_is_null
+from json_to_record('{"a":1, "b":{"c":16, "d":2}, "x":8}'::json)
+ as t(a int, b json, c text, x int);
+ a | b | c | x | c_is_null
+---+-----------------+---+---+-----------
+ 1 | {"c":16, "d":2} | | 8 | t
+(1 row)
+
+select *, c is null as c_is_null
+from json_to_recordset('[{"a":1, "b":{"c":16, "d":2}, "x":8}]'::json)
+ as t(a int, b json, c text, x int);
+ a | b | c | x | c_is_null
+---+-----------------+---+---+-----------
+ 1 | {"c":16, "d":2} | | 8 | t
+(1 row)
+
-- json_strip_nulls
select json_strip_nulls(null);
json_strip_nulls
2 | bar | t
(2 rows)
+select *, c is null as c_is_null
+from jsonb_to_record('{"a":1, "b":{"c":16, "d":2}, "x":8}'::jsonb)
+ as t(a int, b jsonb, c text, x int);
+ a | b | c | x | c_is_null
+---+-------------------+---+---+-----------
+ 1 | {"c": 16, "d": 2} | | 8 | t
+(1 row)
+
+select *, c is null as c_is_null
+from jsonb_to_recordset('[{"a":1, "b":{"c":16, "d":2}, "x":8}]'::jsonb)
+ as t(a int, b jsonb, c text, x int);
+ a | b | c | x | c_is_null
+---+-------------------+---+---+-----------
+ 1 | {"c": 16, "d": 2} | | 8 | t
+(1 row)
+
-- indexing
SELECT count(*) FROM testjsonb WHERE j @> '{"wait":null}';
count
select * from json_to_recordset('[{"a":1,"b":{"d":"foo"},"c":true},{"a":2,"c":false,"b":{"d":"bar"}}]')
as x(a int, b json, c boolean);
+select *, c is null as c_is_null
+from json_to_record('{"a":1, "b":{"c":16, "d":2}, "x":8}'::json)
+ as t(a int, b json, c text, x int);
+
+select *, c is null as c_is_null
+from json_to_recordset('[{"a":1, "b":{"c":16, "d":2}, "x":8}]'::json)
+ as t(a int, b json, c text, x int);
-- json_strip_nulls
select * from jsonb_to_recordset('[{"a":1,"b":"foo","d":false},{"a":2,"b":"bar","c":true}]')
as x(a int, b text, c boolean);
+select *, c is null as c_is_null
+from jsonb_to_record('{"a":1, "b":{"c":16, "d":2}, "x":8}'::jsonb)
+ as t(a int, b jsonb, c text, x int);
+
+select *, c is null as c_is_null
+from jsonb_to_recordset('[{"a":1, "b":{"c":16, "d":2}, "x":8}]'::jsonb)
+ as t(a int, b jsonb, c text, x int);
+
-- indexing
SELECT count(*) FROM testjsonb WHERE j @> '{"wait":null}';
SELECT count(*) FROM testjsonb WHERE j @> '{"wait":"CC"}';