aboutsummaryrefslogtreecommitdiff
path: root/src/test/regress/expected/jsonb.out
diff options
context:
space:
mode:
Diffstat (limited to 'src/test/regress/expected/jsonb.out')
-rw-r--r--src/test/regress/expected/jsonb.out57
1 files changed, 57 insertions, 0 deletions
diff --git a/src/test/regress/expected/jsonb.out b/src/test/regress/expected/jsonb.out
index 83201fb6ca5..c589cd1522a 100644
--- a/src/test/regress/expected/jsonb.out
+++ b/src/test/regress/expected/jsonb.out
@@ -3175,3 +3175,60 @@ select '{"n":null, "a":1, "b":[1,2], "c":{"1":2}, "d":{"1":[2,3]}}'::jsonb - '{d
{"a": 1, "b": [1, 2], "c": {"1": 2}, "d": {"1": [3]}, "n": null}
(1 row)
+-- empty structure and error conditions for delete and replace
+select '"a"'::jsonb - 'a'; -- error
+ERROR: cannot delete from scalar
+select '{}'::jsonb - 'a';
+ ?column?
+----------
+ {}
+(1 row)
+
+select '[]'::jsonb - 'a';
+ ?column?
+----------
+ []
+(1 row)
+
+select '"a"'::jsonb - 1; -- error
+ERROR: cannot delete from scalar
+select '{}'::jsonb - 1 ;
+ ?column?
+----------
+ {}
+(1 row)
+
+select '[]'::jsonb - 1;
+ ?column?
+----------
+ []
+(1 row)
+
+select '"a"'::jsonb - '{a}'::text[]; -- error
+ERROR: cannot delete path in scalar
+select '{}'::jsonb - '{a}'::text[];
+ ?column?
+----------
+ {}
+(1 row)
+
+select '[]'::jsonb - '{a}'::text[];
+ ?column?
+----------
+ []
+(1 row)
+
+select jsonb_replace('"a"','{a}','"b"'); --error
+ERROR: cannot replace path in scalar
+select jsonb_replace('{}','{a}','"b"');
+ jsonb_replace
+---------------
+ {}
+(1 row)
+
+select jsonb_replace('[]','{1}','"b"');
+ jsonb_replace
+---------------
+ []
+(1 row)
+