aboutsummaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
Diffstat (limited to 'src')
-rw-r--r--src/test/regress/expected/json.out62
-rw-r--r--src/test/regress/expected/json_1.out62
-rw-r--r--src/test/regress/expected/jsonb.out70
-rw-r--r--src/test/regress/expected/jsonb_1.out70
-rw-r--r--src/test/regress/sql/json.sql20
-rw-r--r--src/test/regress/sql/jsonb.sql20
6 files changed, 292 insertions, 12 deletions
diff --git a/src/test/regress/expected/json.out b/src/test/regress/expected/json.out
index 7c44e76a1f7..b438e49bf90 100644
--- a/src/test/regress/expected/json.out
+++ b/src/test/regress/expected/json.out
@@ -674,6 +674,12 @@ select '{"a": [{"b": "c"}, {"b": "cc"}]}'::json -> 'z';
(1 row)
+select '{"a": [{"b": "c"}, {"b": "cc"}]}'::json -> '';
+ ?column?
+----------
+
+(1 row)
+
select '[{"b": "c"}, {"b": "cc"}]'::json -> 1;
?column?
-------------
@@ -692,6 +698,50 @@ select '"foo"'::json -> 1;
ERROR: cannot extract element from a scalar
select '"foo"'::json -> 'z';
ERROR: cannot extract element from a scalar
+select '{"a": [{"b": "c"}, {"b": "cc"}]}'::json ->> null::text;
+ ?column?
+----------
+
+(1 row)
+
+select '{"a": [{"b": "c"}, {"b": "cc"}]}'::json ->> null::int;
+ ?column?
+----------
+
+(1 row)
+
+select '{"a": [{"b": "c"}, {"b": "cc"}]}'::json ->> 1;
+ERROR: cannot extract array element from a non-array
+select '{"a": [{"b": "c"}, {"b": "cc"}]}'::json ->> 'z';
+ ?column?
+----------
+
+(1 row)
+
+select '{"a": [{"b": "c"}, {"b": "cc"}]}'::json ->> '';
+ ?column?
+----------
+
+(1 row)
+
+select '[{"b": "c"}, {"b": "cc"}]'::json ->> 1;
+ ?column?
+-------------
+ {"b": "cc"}
+(1 row)
+
+select '[{"b": "c"}, {"b": "cc"}]'::json ->> 3;
+ ?column?
+----------
+
+(1 row)
+
+select '[{"b": "c"}, {"b": "cc"}]'::json ->> 'z';
+ERROR: cannot extract field from a non-object
+select '"foo"'::json ->> 1;
+ERROR: cannot extract element from a scalar
+select '"foo"'::json ->> 'z';
+ERROR: cannot extract element from a scalar
-- array length
SELECT json_array_length('[1,2,3,{"f1":1,"f2":[5,6]},4]');
json_array_length
@@ -871,7 +921,7 @@ select '{"f2":["f3",1],"f4":{"f5":99,"f6":"stringy"}}'::json#>>array['f2','1'];
(1 row)
-- corner cases for same
-select '{"a": {"b":{"c": "foo"}}}'::json #> array[]::text[];
+select '{"a": {"b":{"c": "foo"}}}'::json #> '{}';
?column?
----------
@@ -883,6 +933,10 @@ select '{"a": {"b":{"c": "foo"}}}'::json #> array['a'];
{"b":{"c": "foo"}}
(1 row)
+select '{"a": {"b":{"c": "foo"}}}'::json #> array['a', null];
+ERROR: cannot call json_extract_path with null path elements
+select '{"a": {"b":{"c": "foo"}}}'::json #> array['a', ''];
+ERROR: cannot call json_extract_path with empty path elements
select '{"a": {"b":{"c": "foo"}}}'::json #> array['a','b'];
?column?
--------------
@@ -949,7 +1003,7 @@ select '42'::json #> array['0'];
(1 row)
-select '{"a": {"b":{"c": "foo"}}}'::json #>> array[]::text[];
+select '{"a": {"b":{"c": "foo"}}}'::json #>> '{}';
?column?
----------
@@ -961,6 +1015,10 @@ select '{"a": {"b":{"c": "foo"}}}'::json #>> array['a'];
{"b":{"c": "foo"}}
(1 row)
+select '{"a": {"b":{"c": "foo"}}}'::json #>> array['a', null];
+ERROR: cannot call json_extract_path_text with null path elements
+select '{"a": {"b":{"c": "foo"}}}'::json #>> array['a', ''];
+ERROR: cannot call json_extract_path_text with empty path elements
select '{"a": {"b":{"c": "foo"}}}'::json #>> array['a','b'];
?column?
--------------
diff --git a/src/test/regress/expected/json_1.out b/src/test/regress/expected/json_1.out
index d2827320946..077fcbd0ed1 100644
--- a/src/test/regress/expected/json_1.out
+++ b/src/test/regress/expected/json_1.out
@@ -674,6 +674,12 @@ select '{"a": [{"b": "c"}, {"b": "cc"}]}'::json -> 'z';
(1 row)
+select '{"a": [{"b": "c"}, {"b": "cc"}]}'::json -> '';
+ ?column?
+----------
+
+(1 row)
+
select '[{"b": "c"}, {"b": "cc"}]'::json -> 1;
?column?
-------------
@@ -692,6 +698,50 @@ select '"foo"'::json -> 1;
ERROR: cannot extract element from a scalar
select '"foo"'::json -> 'z';
ERROR: cannot extract element from a scalar
+select '{"a": [{"b": "c"}, {"b": "cc"}]}'::json ->> null::text;
+ ?column?
+----------
+
+(1 row)
+
+select '{"a": [{"b": "c"}, {"b": "cc"}]}'::json ->> null::int;
+ ?column?
+----------
+
+(1 row)
+
+select '{"a": [{"b": "c"}, {"b": "cc"}]}'::json ->> 1;
+ERROR: cannot extract array element from a non-array
+select '{"a": [{"b": "c"}, {"b": "cc"}]}'::json ->> 'z';
+ ?column?
+----------
+
+(1 row)
+
+select '{"a": [{"b": "c"}, {"b": "cc"}]}'::json ->> '';
+ ?column?
+----------
+
+(1 row)
+
+select '[{"b": "c"}, {"b": "cc"}]'::json ->> 1;
+ ?column?
+-------------
+ {"b": "cc"}
+(1 row)
+
+select '[{"b": "c"}, {"b": "cc"}]'::json ->> 3;
+ ?column?
+----------
+
+(1 row)
+
+select '[{"b": "c"}, {"b": "cc"}]'::json ->> 'z';
+ERROR: cannot extract field from a non-object
+select '"foo"'::json ->> 1;
+ERROR: cannot extract element from a scalar
+select '"foo"'::json ->> 'z';
+ERROR: cannot extract element from a scalar
-- array length
SELECT json_array_length('[1,2,3,{"f1":1,"f2":[5,6]},4]');
json_array_length
@@ -871,7 +921,7 @@ select '{"f2":["f3",1],"f4":{"f5":99,"f6":"stringy"}}'::json#>>array['f2','1'];
(1 row)
-- corner cases for same
-select '{"a": {"b":{"c": "foo"}}}'::json #> array[]::text[];
+select '{"a": {"b":{"c": "foo"}}}'::json #> '{}';
?column?
----------
@@ -883,6 +933,10 @@ select '{"a": {"b":{"c": "foo"}}}'::json #> array['a'];
{"b":{"c": "foo"}}
(1 row)
+select '{"a": {"b":{"c": "foo"}}}'::json #> array['a', null];
+ERROR: cannot call json_extract_path with null path elements
+select '{"a": {"b":{"c": "foo"}}}'::json #> array['a', ''];
+ERROR: cannot call json_extract_path with empty path elements
select '{"a": {"b":{"c": "foo"}}}'::json #> array['a','b'];
?column?
--------------
@@ -949,7 +1003,7 @@ select '42'::json #> array['0'];
(1 row)
-select '{"a": {"b":{"c": "foo"}}}'::json #>> array[]::text[];
+select '{"a": {"b":{"c": "foo"}}}'::json #>> '{}';
?column?
----------
@@ -961,6 +1015,10 @@ select '{"a": {"b":{"c": "foo"}}}'::json #>> array['a'];
{"b":{"c": "foo"}}
(1 row)
+select '{"a": {"b":{"c": "foo"}}}'::json #>> array['a', null];
+ERROR: cannot call json_extract_path_text with null path elements
+select '{"a": {"b":{"c": "foo"}}}'::json #>> array['a', ''];
+ERROR: cannot call json_extract_path_text with empty path elements
select '{"a": {"b":{"c": "foo"}}}'::json #>> array['a','b'];
?column?
--------------
diff --git a/src/test/regress/expected/jsonb.out b/src/test/regress/expected/jsonb.out
index 0be7074cbcb..ea4d6e1f4c3 100644
--- a/src/test/regress/expected/jsonb.out
+++ b/src/test/regress/expected/jsonb.out
@@ -453,6 +453,12 @@ select '{"a": [{"b": "c"}, {"b": "cc"}]}'::jsonb -> 'z';
(1 row)
+select '{"a": [{"b": "c"}, {"b": "cc"}]}'::jsonb -> '';
+ ?column?
+----------
+
+(1 row)
+
select '[{"b": "c"}, {"b": "cc"}]'::jsonb -> 1;
?column?
-------------
@@ -471,6 +477,50 @@ select '"foo"'::jsonb -> 1;
ERROR: cannot call jsonb_array_element (jsonb -> int) on a scalar
select '"foo"'::jsonb -> 'z';
ERROR: cannot call jsonb_object_field (jsonb -> text) on a scalar
+select '{"a": [{"b": "c"}, {"b": "cc"}]}'::jsonb ->> null::text;
+ ?column?
+----------
+
+(1 row)
+
+select '{"a": [{"b": "c"}, {"b": "cc"}]}'::jsonb ->> null::int;
+ ?column?
+----------
+
+(1 row)
+
+select '{"a": [{"b": "c"}, {"b": "cc"}]}'::jsonb ->> 1;
+ERROR: cannot call jsonb_array_element_text on an object
+select '{"a": [{"b": "c"}, {"b": "cc"}]}'::jsonb ->> 'z';
+ ?column?
+----------
+
+(1 row)
+
+select '{"a": [{"b": "c"}, {"b": "cc"}]}'::jsonb ->> '';
+ ?column?
+----------
+
+(1 row)
+
+select '[{"b": "c"}, {"b": "cc"}]'::jsonb ->> 1;
+ ?column?
+-------------
+ {"b": "cc"}
+(1 row)
+
+select '[{"b": "c"}, {"b": "cc"}]'::jsonb ->> 3;
+ ?column?
+----------
+
+(1 row)
+
+select '[{"b": "c"}, {"b": "cc"}]'::jsonb ->> 'z';
+ERROR: cannot call jsonb_object_field_text (jsonb ->> text) on an array
+select '"foo"'::jsonb ->> 1;
+ERROR: cannot call jsonb_array_element_text on a scalar
+select '"foo"'::jsonb ->> 'z';
+ERROR: cannot call jsonb_object_field_text (jsonb ->> text) on a scalar
-- equality and inequality
SELECT '{"x":"y"}'::jsonb = '{"x":"y"}'::jsonb;
?column?
@@ -1218,7 +1268,7 @@ SELECT '{"f2":["f3",1],"f4":{"f5":99,"f6":"stringy"}}'::jsonb#>>array['f2','1'];
(1 row)
-- corner cases for same
-select '{"a": {"b":{"c": "foo"}}}'::jsonb #> array[]::text[];
+select '{"a": {"b":{"c": "foo"}}}'::jsonb #> '{}';
?column?
----------
@@ -1230,6 +1280,14 @@ select '{"a": {"b":{"c": "foo"}}}'::jsonb #> array['a'];
{"b": {"c": "foo"}}
(1 row)
+select '{"a": {"b":{"c": "foo"}}}'::jsonb #> array['a', null];
+ERROR: cannot call jsonb_extract_path with null path elements
+select '{"a": {"b":{"c": "foo"}}}'::jsonb #> array['a', ''];
+ ?column?
+----------
+
+(1 row)
+
select '{"a": {"b":{"c": "foo"}}}'::jsonb #> array['a','b'];
?column?
--------------
@@ -1284,7 +1342,7 @@ select '42'::jsonb #> array['f2'];
ERROR: cannot extract path from a scalar
select '42'::jsonb #> array['0'];
ERROR: cannot extract path from a scalar
-select '{"a": {"b":{"c": "foo"}}}'::jsonb #>> array[]::text[];
+select '{"a": {"b":{"c": "foo"}}}'::jsonb #>> '{}';
?column?
----------
@@ -1296,6 +1354,14 @@ select '{"a": {"b":{"c": "foo"}}}'::jsonb #>> array['a'];
{"b": {"c": "foo"}}
(1 row)
+select '{"a": {"b":{"c": "foo"}}}'::jsonb #>> array['a', null];
+ERROR: cannot call jsonb_extract_path_text with null path elements
+select '{"a": {"b":{"c": "foo"}}}'::jsonb #>> array['a', ''];
+ ?column?
+----------
+
+(1 row)
+
select '{"a": {"b":{"c": "foo"}}}'::jsonb #>> array['a','b'];
?column?
--------------
diff --git a/src/test/regress/expected/jsonb_1.out b/src/test/regress/expected/jsonb_1.out
index 4edef901f41..4c2d5ae0b38 100644
--- a/src/test/regress/expected/jsonb_1.out
+++ b/src/test/regress/expected/jsonb_1.out
@@ -453,6 +453,12 @@ select '{"a": [{"b": "c"}, {"b": "cc"}]}'::jsonb -> 'z';
(1 row)
+select '{"a": [{"b": "c"}, {"b": "cc"}]}'::jsonb -> '';
+ ?column?
+----------
+
+(1 row)
+
select '[{"b": "c"}, {"b": "cc"}]'::jsonb -> 1;
?column?
-------------
@@ -471,6 +477,50 @@ select '"foo"'::jsonb -> 1;
ERROR: cannot call jsonb_array_element (jsonb -> int) on a scalar
select '"foo"'::jsonb -> 'z';
ERROR: cannot call jsonb_object_field (jsonb -> text) on a scalar
+select '{"a": [{"b": "c"}, {"b": "cc"}]}'::jsonb ->> null::text;
+ ?column?
+----------
+
+(1 row)
+
+select '{"a": [{"b": "c"}, {"b": "cc"}]}'::jsonb ->> null::int;
+ ?column?
+----------
+
+(1 row)
+
+select '{"a": [{"b": "c"}, {"b": "cc"}]}'::jsonb ->> 1;
+ERROR: cannot call jsonb_array_element_text on an object
+select '{"a": [{"b": "c"}, {"b": "cc"}]}'::jsonb ->> 'z';
+ ?column?
+----------
+
+(1 row)
+
+select '{"a": [{"b": "c"}, {"b": "cc"}]}'::jsonb ->> '';
+ ?column?
+----------
+
+(1 row)
+
+select '[{"b": "c"}, {"b": "cc"}]'::jsonb ->> 1;
+ ?column?
+-------------
+ {"b": "cc"}
+(1 row)
+
+select '[{"b": "c"}, {"b": "cc"}]'::jsonb ->> 3;
+ ?column?
+----------
+
+(1 row)
+
+select '[{"b": "c"}, {"b": "cc"}]'::jsonb ->> 'z';
+ERROR: cannot call jsonb_object_field_text (jsonb ->> text) on an array
+select '"foo"'::jsonb ->> 1;
+ERROR: cannot call jsonb_array_element_text on a scalar
+select '"foo"'::jsonb ->> 'z';
+ERROR: cannot call jsonb_object_field_text (jsonb ->> text) on a scalar
-- equality and inequality
SELECT '{"x":"y"}'::jsonb = '{"x":"y"}'::jsonb;
?column?
@@ -1218,7 +1268,7 @@ SELECT '{"f2":["f3",1],"f4":{"f5":99,"f6":"stringy"}}'::jsonb#>>array['f2','1'];
(1 row)
-- corner cases for same
-select '{"a": {"b":{"c": "foo"}}}'::jsonb #> array[]::text[];
+select '{"a": {"b":{"c": "foo"}}}'::jsonb #> '{}';
?column?
----------
@@ -1230,6 +1280,14 @@ select '{"a": {"b":{"c": "foo"}}}'::jsonb #> array['a'];
{"b": {"c": "foo"}}
(1 row)
+select '{"a": {"b":{"c": "foo"}}}'::jsonb #> array['a', null];
+ERROR: cannot call jsonb_extract_path with null path elements
+select '{"a": {"b":{"c": "foo"}}}'::jsonb #> array['a', ''];
+ ?column?
+----------
+
+(1 row)
+
select '{"a": {"b":{"c": "foo"}}}'::jsonb #> array['a','b'];
?column?
--------------
@@ -1284,7 +1342,7 @@ select '42'::jsonb #> array['f2'];
ERROR: cannot extract path from a scalar
select '42'::jsonb #> array['0'];
ERROR: cannot extract path from a scalar
-select '{"a": {"b":{"c": "foo"}}}'::jsonb #>> array[]::text[];
+select '{"a": {"b":{"c": "foo"}}}'::jsonb #>> '{}';
?column?
----------
@@ -1296,6 +1354,14 @@ select '{"a": {"b":{"c": "foo"}}}'::jsonb #>> array['a'];
{"b": {"c": "foo"}}
(1 row)
+select '{"a": {"b":{"c": "foo"}}}'::jsonb #>> array['a', null];
+ERROR: cannot call jsonb_extract_path_text with null path elements
+select '{"a": {"b":{"c": "foo"}}}'::jsonb #>> array['a', ''];
+ ?column?
+----------
+
+(1 row)
+
select '{"a": {"b":{"c": "foo"}}}'::jsonb #>> array['a','b'];
?column?
--------------
diff --git a/src/test/regress/sql/json.sql b/src/test/regress/sql/json.sql
index 964d5baa2a4..4db55474011 100644
--- a/src/test/regress/sql/json.sql
+++ b/src/test/regress/sql/json.sql
@@ -244,12 +244,24 @@ select '{"a": [{"b": "c"}, {"b": "cc"}]}'::json -> null::text;
select '{"a": [{"b": "c"}, {"b": "cc"}]}'::json -> null::int;
select '{"a": [{"b": "c"}, {"b": "cc"}]}'::json -> 1;
select '{"a": [{"b": "c"}, {"b": "cc"}]}'::json -> 'z';
+select '{"a": [{"b": "c"}, {"b": "cc"}]}'::json -> '';
select '[{"b": "c"}, {"b": "cc"}]'::json -> 1;
select '[{"b": "c"}, {"b": "cc"}]'::json -> 3;
select '[{"b": "c"}, {"b": "cc"}]'::json -> 'z';
select '"foo"'::json -> 1;
select '"foo"'::json -> 'z';
+select '{"a": [{"b": "c"}, {"b": "cc"}]}'::json ->> null::text;
+select '{"a": [{"b": "c"}, {"b": "cc"}]}'::json ->> null::int;
+select '{"a": [{"b": "c"}, {"b": "cc"}]}'::json ->> 1;
+select '{"a": [{"b": "c"}, {"b": "cc"}]}'::json ->> 'z';
+select '{"a": [{"b": "c"}, {"b": "cc"}]}'::json ->> '';
+select '[{"b": "c"}, {"b": "cc"}]'::json ->> 1;
+select '[{"b": "c"}, {"b": "cc"}]'::json ->> 3;
+select '[{"b": "c"}, {"b": "cc"}]'::json ->> 'z';
+select '"foo"'::json ->> 1;
+select '"foo"'::json ->> 'z';
+
-- array length
SELECT json_array_length('[1,2,3,{"f1":1,"f2":[5,6]},4]');
@@ -299,8 +311,10 @@ select '{"f2":["f3",1],"f4":{"f5":99,"f6":"stringy"}}'::json#>>array['f2','0'];
select '{"f2":["f3",1],"f4":{"f5":99,"f6":"stringy"}}'::json#>>array['f2','1'];
-- corner cases for same
-select '{"a": {"b":{"c": "foo"}}}'::json #> array[]::text[];
+select '{"a": {"b":{"c": "foo"}}}'::json #> '{}';
select '{"a": {"b":{"c": "foo"}}}'::json #> array['a'];
+select '{"a": {"b":{"c": "foo"}}}'::json #> array['a', null];
+select '{"a": {"b":{"c": "foo"}}}'::json #> array['a', ''];
select '{"a": {"b":{"c": "foo"}}}'::json #> array['a','b'];
select '{"a": {"b":{"c": "foo"}}}'::json #> array['a','b','c'];
select '{"a": {"b":{"c": "foo"}}}'::json #> array['a','b','c','d'];
@@ -313,8 +327,10 @@ select '"foo"'::json #> array['z'];
select '42'::json #> array['f2'];
select '42'::json #> array['0'];
-select '{"a": {"b":{"c": "foo"}}}'::json #>> array[]::text[];
+select '{"a": {"b":{"c": "foo"}}}'::json #>> '{}';
select '{"a": {"b":{"c": "foo"}}}'::json #>> array['a'];
+select '{"a": {"b":{"c": "foo"}}}'::json #>> array['a', null];
+select '{"a": {"b":{"c": "foo"}}}'::json #>> array['a', ''];
select '{"a": {"b":{"c": "foo"}}}'::json #>> array['a','b'];
select '{"a": {"b":{"c": "foo"}}}'::json #>> array['a','b','c'];
select '{"a": {"b":{"c": "foo"}}}'::json #>> array['a','b','c','d'];
diff --git a/src/test/regress/sql/jsonb.sql b/src/test/regress/sql/jsonb.sql
index c1ef6dff56d..141dda9508e 100644
--- a/src/test/regress/sql/jsonb.sql
+++ b/src/test/regress/sql/jsonb.sql
@@ -113,12 +113,24 @@ select '{"a": [{"b": "c"}, {"b": "cc"}]}'::jsonb -> null::text;
select '{"a": [{"b": "c"}, {"b": "cc"}]}'::jsonb -> null::int;
select '{"a": [{"b": "c"}, {"b": "cc"}]}'::jsonb -> 1;
select '{"a": [{"b": "c"}, {"b": "cc"}]}'::jsonb -> 'z';
+select '{"a": [{"b": "c"}, {"b": "cc"}]}'::jsonb -> '';
select '[{"b": "c"}, {"b": "cc"}]'::jsonb -> 1;
select '[{"b": "c"}, {"b": "cc"}]'::jsonb -> 3;
select '[{"b": "c"}, {"b": "cc"}]'::jsonb -> 'z';
select '"foo"'::jsonb -> 1;
select '"foo"'::jsonb -> 'z';
+select '{"a": [{"b": "c"}, {"b": "cc"}]}'::jsonb ->> null::text;
+select '{"a": [{"b": "c"}, {"b": "cc"}]}'::jsonb ->> null::int;
+select '{"a": [{"b": "c"}, {"b": "cc"}]}'::jsonb ->> 1;
+select '{"a": [{"b": "c"}, {"b": "cc"}]}'::jsonb ->> 'z';
+select '{"a": [{"b": "c"}, {"b": "cc"}]}'::jsonb ->> '';
+select '[{"b": "c"}, {"b": "cc"}]'::jsonb ->> 1;
+select '[{"b": "c"}, {"b": "cc"}]'::jsonb ->> 3;
+select '[{"b": "c"}, {"b": "cc"}]'::jsonb ->> 'z';
+select '"foo"'::jsonb ->> 1;
+select '"foo"'::jsonb ->> 'z';
+
-- equality and inequality
SELECT '{"x":"y"}'::jsonb = '{"x":"y"}'::jsonb;
SELECT '{"x":"y"}'::jsonb = '{"x":"z"}'::jsonb;
@@ -270,8 +282,10 @@ SELECT '{"f2":["f3",1],"f4":{"f5":99,"f6":"stringy"}}'::jsonb#>>array['f2','0'];
SELECT '{"f2":["f3",1],"f4":{"f5":99,"f6":"stringy"}}'::jsonb#>>array['f2','1'];
-- corner cases for same
-select '{"a": {"b":{"c": "foo"}}}'::jsonb #> array[]::text[];
+select '{"a": {"b":{"c": "foo"}}}'::jsonb #> '{}';
select '{"a": {"b":{"c": "foo"}}}'::jsonb #> array['a'];
+select '{"a": {"b":{"c": "foo"}}}'::jsonb #> array['a', null];
+select '{"a": {"b":{"c": "foo"}}}'::jsonb #> array['a', ''];
select '{"a": {"b":{"c": "foo"}}}'::jsonb #> array['a','b'];
select '{"a": {"b":{"c": "foo"}}}'::jsonb #> array['a','b','c'];
select '{"a": {"b":{"c": "foo"}}}'::jsonb #> array['a','b','c','d'];
@@ -284,8 +298,10 @@ select '"foo"'::jsonb #> array['z'];
select '42'::jsonb #> array['f2'];
select '42'::jsonb #> array['0'];
-select '{"a": {"b":{"c": "foo"}}}'::jsonb #>> array[]::text[];
+select '{"a": {"b":{"c": "foo"}}}'::jsonb #>> '{}';
select '{"a": {"b":{"c": "foo"}}}'::jsonb #>> array['a'];
+select '{"a": {"b":{"c": "foo"}}}'::jsonb #>> array['a', null];
+select '{"a": {"b":{"c": "foo"}}}'::jsonb #>> array['a', ''];
select '{"a": {"b":{"c": "foo"}}}'::jsonb #>> array['a','b'];
select '{"a": {"b":{"c": "foo"}}}'::jsonb #>> array['a','b','c'];
select '{"a": {"b":{"c": "foo"}}}'::jsonb #>> array['a','b','c','d'];