Move containment tests
authorMaciek Sakrejda <[email protected]>
Fri, 7 Mar 2014 19:43:06 +0000 (11:43 -0800)
committerMaciek Sakrejda <[email protected]>
Fri, 7 Mar 2014 19:43:06 +0000 (11:43 -0800)
src/test/regress/expected/jsonb.out
src/test/regress/sql/jsonb.sql

index f47a826841f60fb2af967ec83916e590650d5a4c..c15678adbc2e44324531cc76004f6cc7ebd4cd91 100644 (file)
@@ -301,50 +301,6 @@ select array_to_json(ARRAY [jsonb '{"a":1}', jsonb '{"b":[2,3]}']);
  [{"a": 1},{"b": [2, 3]}]
 (1 row)
 
--- operators
--- @>
-select '{"a":"b", "b":1, "c":null}'::jsonb @> '{"a":"b"}';
- ?column? 
-----------
- t
-(1 row)
-
-select '{"a":"b", "b":1, "c":null}'::jsonb @> '{"a":"b", "c":null}';
- ?column? 
-----------
- t
-(1 row)
-
-select '{"a":"b", "b":1, "c":null}'::jsonb @> '{"a":"b", "g":null}';
- ?column? 
-----------
- f
-(1 row)
-
-select '{"a":"b", "b":1, "c":null}'::jsonb @> '{"g":null}';
- ?column? 
-----------
- f
-(1 row)
-
-select '{"a":"b", "b":1, "c":null}'::jsonb @> '{"a":"c"}';
- ?column? 
-----------
- f
-(1 row)
-
-select '{"a":"b", "b":1, "c":null}'::jsonb @> '{"a":"b"}';
- ?column? 
-----------
- t
-(1 row)
-
-select '{"a":"b", "b":1, "c":null}'::jsonb @> '{"a":"b", "c":"q"}';
- ?column? 
-----------
- f
-(1 row)
-
 -- jsonb extraction functions
 CREATE TEMP TABLE test_jsonb (
        json_type text,
@@ -468,6 +424,49 @@ select '{"x":"y"}'::jsonb <> '{"x":"z"}'::jsonb;
  t
 (1 row)
 
+-- containment
+select '{"a":"b", "b":1, "c":null}'::jsonb @> '{"a":"b"}';
+ ?column? 
+----------
+ t
+(1 row)
+
+select '{"a":"b", "b":1, "c":null}'::jsonb @> '{"a":"b", "c":null}';
+ ?column? 
+----------
+ t
+(1 row)
+
+select '{"a":"b", "b":1, "c":null}'::jsonb @> '{"a":"b", "g":null}';
+ ?column? 
+----------
+ f
+(1 row)
+
+select '{"a":"b", "b":1, "c":null}'::jsonb @> '{"g":null}';
+ ?column? 
+----------
+ f
+(1 row)
+
+select '{"a":"b", "b":1, "c":null}'::jsonb @> '{"a":"c"}';
+ ?column? 
+----------
+ f
+(1 row)
+
+select '{"a":"b", "b":1, "c":null}'::jsonb @> '{"a":"b"}';
+ ?column? 
+----------
+ t
+(1 row)
+
+select '{"a":"b", "b":1, "c":null}'::jsonb @> '{"a":"b", "c":"q"}';
+ ?column? 
+----------
+ f
+(1 row)
+
 -- array length
 SELECT jsonb_array_length('[1,2,3,{"f1":1,"f2":[5,6]},4]');
  jsonb_array_length 
index d57804e82fd35a3c93e6663f8e211ab333ea46c9..89c1ebb88bc8185758e8d4268c1fd210bf8ddb0c 100644 (file)
@@ -62,17 +62,6 @@ SELECT '    '::jsonb;            -- ERROR, no value
 -- make sure jsonb is passed through json generators without being escaped
 select array_to_json(ARRAY [jsonb '{"a":1}', jsonb '{"b":[2,3]}']);
 
--- operators
-
--- @>
-select '{"a":"b", "b":1, "c":null}'::jsonb @> '{"a":"b"}';
-select '{"a":"b", "b":1, "c":null}'::jsonb @> '{"a":"b", "c":null}';
-select '{"a":"b", "b":1, "c":null}'::jsonb @> '{"a":"b", "g":null}';
-select '{"a":"b", "b":1, "c":null}'::jsonb @> '{"g":null}';
-select '{"a":"b", "b":1, "c":null}'::jsonb @> '{"a":"c"}';
-select '{"a":"b", "b":1, "c":null}'::jsonb @> '{"a":"b"}';
-select '{"a":"b", "b":1, "c":null}'::jsonb @> '{"a":"b", "c":"q"}';
-
 -- jsonb extraction functions
 
 CREATE TEMP TABLE test_jsonb (
@@ -121,6 +110,15 @@ select '{"x":"y"}'::jsonb = '{"x":"z"}'::jsonb;
 select '{"x":"y"}'::jsonb <> '{"x":"y"}'::jsonb;
 select '{"x":"y"}'::jsonb <> '{"x":"z"}'::jsonb;
 
+-- containment
+select '{"a":"b", "b":1, "c":null}'::jsonb @> '{"a":"b"}';
+select '{"a":"b", "b":1, "c":null}'::jsonb @> '{"a":"b", "c":null}';
+select '{"a":"b", "b":1, "c":null}'::jsonb @> '{"a":"b", "g":null}';
+select '{"a":"b", "b":1, "c":null}'::jsonb @> '{"g":null}';
+select '{"a":"b", "b":1, "c":null}'::jsonb @> '{"a":"c"}';
+select '{"a":"b", "b":1, "c":null}'::jsonb @> '{"a":"b"}';
+select '{"a":"b", "b":1, "c":null}'::jsonb @> '{"a":"b", "c":"q"}';
+
 -- array length
 
 SELECT jsonb_array_length('[1,2,3,{"f1":1,"f2":[5,6]},4]');