Skip to content

Commit

Permalink
enable more regress tests with jsonb typed string
Browse files Browse the repository at this point in the history
Signed-off-by: Runji Wang <[email protected]>
  • Loading branch information
wangrunji0408 committed Oct 30, 2023
1 parent 5b164e8 commit 307e5be
Showing 1 changed file with 15 additions and 15 deletions.
30 changes: 15 additions & 15 deletions src/tests/regress/data/sql/jsonb.sql
Original file line number Diff line number Diff line change
Expand Up @@ -281,10 +281,10 @@ SELECT jsonb_array_length('4');
--@ SELECT jsonb_exists('{"a":null, "b":"qq"}', 'b');
--@ SELECT jsonb_exists('{"a":null, "b":"qq"}', 'c');
--@ SELECT jsonb_exists('{"a":"null", "b":"qq"}', 'a');
--@ SELECT jsonb '{"a":null, "b":"qq"}' ? 'a';
--@ SELECT jsonb '{"a":null, "b":"qq"}' ? 'b';
--@ SELECT jsonb '{"a":null, "b":"qq"}' ? 'c';
--@ SELECT jsonb '{"a":"null", "b":"qq"}' ? 'a';
SELECT jsonb '{"a":null, "b":"qq"}' ? 'a';
SELECT jsonb '{"a":null, "b":"qq"}' ? 'b';
SELECT jsonb '{"a":null, "b":"qq"}' ? 'c';
SELECT jsonb '{"a":"null", "b":"qq"}' ? 'a';
--@ -- array exists - array elements should behave as keys
--@ SELECT count(*) from testjsonb WHERE j->'array' ? 'bar';
--@ -- type sensitive array exists - should return no rows (since "exists" only
Expand All @@ -298,23 +298,23 @@ SELECT jsonb_array_length('4');
--@ SELECT jsonb_exists_any('{"a":null, "b":"qq"}', ARRAY['c','a']);
--@ SELECT jsonb_exists_any('{"a":null, "b":"qq"}', ARRAY['c','d']);
--@ SELECT jsonb_exists_any('{"a":null, "b":"qq"}', '{}'::text[]);
--@ SELECT jsonb '{"a":null, "b":"qq"}' ?| ARRAY['a','b'];
--@ SELECT jsonb '{"a":null, "b":"qq"}' ?| ARRAY['b','a'];
--@ SELECT jsonb '{"a":null, "b":"qq"}' ?| ARRAY['c','a'];
--@ SELECT jsonb '{"a":null, "b":"qq"}' ?| ARRAY['c','d'];
--@ SELECT jsonb '{"a":null, "b":"qq"}' ?| '{}'::text[];
SELECT jsonb '{"a":null, "b":"qq"}' ?| ARRAY['a','b'];
SELECT jsonb '{"a":null, "b":"qq"}' ?| ARRAY['b','a'];
SELECT jsonb '{"a":null, "b":"qq"}' ?| ARRAY['c','a'];
SELECT jsonb '{"a":null, "b":"qq"}' ?| ARRAY['c','d'];
SELECT jsonb '{"a":null, "b":"qq"}' ?| '{}'::text[];
--@
--@ SELECT jsonb_exists_all('{"a":null, "b":"qq"}', ARRAY['a','b']);
--@ SELECT jsonb_exists_all('{"a":null, "b":"qq"}', ARRAY['b','a']);
--@ SELECT jsonb_exists_all('{"a":null, "b":"qq"}', ARRAY['c','a']);
--@ SELECT jsonb_exists_all('{"a":null, "b":"qq"}', ARRAY['c','d']);
--@ SELECT jsonb_exists_all('{"a":null, "b":"qq"}', '{}'::text[]);
--@ SELECT jsonb '{"a":null, "b":"qq"}' ?& ARRAY['a','b'];
--@ SELECT jsonb '{"a":null, "b":"qq"}' ?& ARRAY['b','a'];
--@ SELECT jsonb '{"a":null, "b":"qq"}' ?& ARRAY['c','a'];
--@ SELECT jsonb '{"a":null, "b":"qq"}' ?& ARRAY['c','d'];
--@ SELECT jsonb '{"a":null, "b":"qq"}' ?& ARRAY['a','a', 'b', 'b', 'b'];
--@ SELECT jsonb '{"a":null, "b":"qq"}' ?& '{}'::text[];
SELECT jsonb '{"a":null, "b":"qq"}' ?& ARRAY['a','b'];
SELECT jsonb '{"a":null, "b":"qq"}' ?& ARRAY['b','a'];
SELECT jsonb '{"a":null, "b":"qq"}' ?& ARRAY['c','a'];
SELECT jsonb '{"a":null, "b":"qq"}' ?& ARRAY['c','d'];
SELECT jsonb '{"a":null, "b":"qq"}' ?& ARRAY['a','a', 'b', 'b', 'b'];
SELECT jsonb '{"a":null, "b":"qq"}' ?& '{}'::text[];

-- typeof
SELECT jsonb_typeof('{}') AS object;
Expand Down

0 comments on commit 307e5be

Please sign in to comment.