@@ -1303,6 +1303,16 @@ SELECT gin_debug_query_value_path('x <@ [1,2,3]');
1303
1303
1304
1304
(1 row)
1305
1305
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
+
1306
1316
---table and index
1307
1317
select count(*) from test_jsquery where (v->>'review_helpful_votes')::int4 > 0;
1308
1318
count
@@ -1469,6 +1479,12 @@ select v from test_jsquery where v @@ 'array @> [2,3]' order by v;
1469
1479
{"array": [2, 3, 4]}
1470
1480
(3 rows)
1471
1481
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
+
1472
1488
create index t_idx on test_jsquery using gin (v jsonb_value_path_ops);
1473
1489
set enable_seqscan = off;
1474
1490
explain (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
1611
1627
Index Cond: (v @@ '"array" @> [2, 3]'::jsquery)
1612
1628
(6 rows)
1613
1629
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
+
1614
1641
select v from test_jsquery where v @@ 'array <@ [2,3]' order by v;
1615
1642
v
1616
1643
-------------------
@@ -1636,6 +1663,12 @@ select v from test_jsquery where v @@ 'array @> [2,3]' order by v;
1636
1663
{"array": [2, 3, 4]}
1637
1664
(3 rows)
1638
1665
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
+
1639
1672
drop index t_idx;
1640
1673
create index t_idx on test_jsquery using gin (v jsonb_path_value_ops);
1641
1674
set enable_seqscan = off;
@@ -1779,6 +1812,17 @@ explain (costs off) select v from test_jsquery where v @@ 'array @> [2,3]' order
1779
1812
Index Cond: (v @@ '"array" @> [2, 3]'::jsquery)
1780
1813
(6 rows)
1781
1814
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
+
1782
1826
select v from test_jsquery where v @@ 'array <@ [2,3]' order by v;
1783
1827
v
1784
1828
-------------------
@@ -1804,4 +1848,10 @@ select v from test_jsquery where v @@ 'array @> [2,3]' order by v;
1804
1848
{"array": [2, 3, 4]}
1805
1849
(3 rows)
1806
1850
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
+
1807
1857
RESET enable_seqscan;
0 commit comments