@@ -1303,6 +1303,16 @@ SELECT gin_debug_query_value_path('x <@ [1,2,3]');
13031303
13041304(1 row)
13051305
1306+ SELECT gin_debug_query_value_path('x = [1,2,3]');
1307+ gin_debug_query_value_path
1308+ ----------------------------
1309+ AND +
1310+ x.# = 1 , entry 0 +
1311+ x.# = 2 , entry 1 +
1312+ x.# = 3 , entry 2 +
1313+
1314+ (1 row)
1315+
13061316---table and index
13071317select count(*) from test_jsquery where (v->>'review_helpful_votes')::int4 > 0;
13081318 count
@@ -1469,6 +1479,12 @@ select v from test_jsquery where v @@ 'array @> [2,3]' order by v;
14691479 {"array": [2, 3, 4]}
14701480(3 rows)
14711481
1482+ select v from test_jsquery where v @@ 'array = [2,3]' order by v;
1483+ v
1484+ -------------------
1485+ {"array": [2, 3]}
1486+ (1 row)
1487+
14721488create index t_idx on test_jsquery using gin (v jsonb_value_path_ops);
14731489set enable_seqscan = off;
14741490explain (costs off) select count(*) from test_jsquery where v @@ 'review_helpful_votes > 0';
@@ -1611,6 +1627,17 @@ explain (costs off) select v from test_jsquery where v @@ 'array @> [2,3]' order
16111627 Index Cond: (v @@ '"array" @> [2, 3]'::jsquery)
16121628(6 rows)
16131629
1630+ explain (costs off) select v from test_jsquery where v @@ 'array = [2,3]' order by v;
1631+ QUERY PLAN
1632+ --------------------------------------------------------------
1633+ Sort
1634+ Sort Key: v
1635+ -> Bitmap Heap Scan on test_jsquery
1636+ Recheck Cond: (v @@ '"array" = [2, 3]'::jsquery)
1637+ -> Bitmap Index Scan on t_idx
1638+ Index Cond: (v @@ '"array" = [2, 3]'::jsquery)
1639+ (6 rows)
1640+
16141641select v from test_jsquery where v @@ 'array <@ [2,3]' order by v;
16151642 v
16161643-------------------
@@ -1636,6 +1663,12 @@ select v from test_jsquery where v @@ 'array @> [2,3]' order by v;
16361663 {"array": [2, 3, 4]}
16371664(3 rows)
16381665
1666+ select v from test_jsquery where v @@ 'array = [2,3]' order by v;
1667+ v
1668+ -------------------
1669+ {"array": [2, 3]}
1670+ (1 row)
1671+
16391672drop index t_idx;
16401673create index t_idx on test_jsquery using gin (v jsonb_path_value_ops);
16411674set enable_seqscan = off;
@@ -1779,6 +1812,17 @@ explain (costs off) select v from test_jsquery where v @@ 'array @> [2,3]' order
17791812 Index Cond: (v @@ '"array" @> [2, 3]'::jsquery)
17801813(6 rows)
17811814
1815+ explain (costs off) select v from test_jsquery where v @@ 'array = [2,3]' order by v;
1816+ QUERY PLAN
1817+ --------------------------------------------------------------
1818+ Sort
1819+ Sort Key: v
1820+ -> Bitmap Heap Scan on test_jsquery
1821+ Recheck Cond: (v @@ '"array" = [2, 3]'::jsquery)
1822+ -> Bitmap Index Scan on t_idx
1823+ Index Cond: (v @@ '"array" = [2, 3]'::jsquery)
1824+ (6 rows)
1825+
17821826select v from test_jsquery where v @@ 'array <@ [2,3]' order by v;
17831827 v
17841828-------------------
@@ -1804,4 +1848,10 @@ select v from test_jsquery where v @@ 'array @> [2,3]' order by v;
18041848 {"array": [2, 3, 4]}
18051849(3 rows)
18061850
1851+ select v from test_jsquery where v @@ 'array = [2,3]' order by v;
1852+ v
1853+ -------------------
1854+ {"array": [2, 3]}
1855+ (1 row)
1856+
18071857RESET enable_seqscan;
0 commit comments