...

или внеочередные заметки


Fixed ! Bug in indexing scalars with jsquery
trekking, Himalaya
obartunov
Nikita Glukhov recently identified and fixed a bug in jsquery (https://github.com/postgrespro/jsquery). Indexing of scalars was broken, please upgrade jsquery !

The bug could be demonstrated in this example (query returns different results for seqscan and when using index):


create table test(js jsonb);
insert into test values ('1');
select count(*) from test where js @@ '$ = 1';
 count
-------
     1
(1 row)

create index test_path_value_idx on test using gin(js jsonb_path_value_ops);
CREATE INDEX
set enable_seqscan = off;
SET
select count(*) from test where js @@ '$ = 1';
 count
-------
     0
(1 row)

explain select count(*) from test where js @@ '$ = 1';
                                       QUERY PLAN
----------------------------------------------------------------------------------------
 Aggregate  (cost=12.02..12.03 rows=1 width=8)
   ->  Bitmap Heap Scan on test  (cost=8.00..12.01 rows=1 width=0)
         Recheck Cond: (js @@ '$ = 1'::jsquery)
         ->  Bitmap Index Scan on test_path_value_idx  (cost=0.00..8.00 rows=1 width=0)
               Index Cond: (js @@ '$ = 1'::jsquery)
(5 rows)

?

Log in