<br />Analysis:<br />========<br /><br />While debugging bitmap heap scan (BitmapHeapNext function) found that first we
performthe underlying index scan and then iterate over bitmap. Now while iterating, we execute ExecQual only if
tbmres->recheckis true. And for the query tbmres->recheck is false.<br /><br />But from the query it seems that
weshould execute ExecQual as we having "bitmpaqual" on the BitmapHeap node (Not quite sure). And when I manually did
recheck= ture, query working fine and as expected.<br /><br /><br />Regards.<br />Rushabh<br /><a
href="http://www.EnterpriseDB.com">www.EnterpriseDB.com</a><br/><br /><div class="gmail_quote">On Wed, Nov 19, 2008 at
4:26PM, Rushabh Lathia <span dir="ltr"><<a
href="mailto:rushabh.lathia@gmail.com">rushabh.lathia@gmail.com</a>></span>wrote:<br /><blockquote
class="gmail_quote"style="border-left: 1px solid rgb(204, 204, 204); margin: 0pt 0pt 0pt 0.8ex; padding-left:
1ex;">Simpleselect give wrong result when it uses the Bitmap Heap Scan path. <br /><br /><br /> postgres=# CREATE OR
REPLACEFUNCTION my_exec_im_test_func(i integer) RETURNS integer AS $$ <br /> BEGIN <br
/> RETURN i + 1;<br /> END;<br />$$ LANGUAGE plpgsql;<br />CREATE FUNCTION<br /><br />postgres=#
setenable_seqscan=off;<br />SET<br />postgres=# set enable_indexscan=off;<br />SET<br />postgres=# select proname from
pg_procwhere proname like 'my_pro1';<br /> proname <br />----------------------<br />
my_exec_im_test_proc<br/>(1 row)<br /><br />postgres=# explain select proname from pg_proc where proname like
'my_pro1';<br/> QUERY PLAN <br /> <br
/>--------------------------------------------------------------------------------<br />-------------<br /> Bitmap Heap
Scanon pg_proc (cost=4.26..8.27 rows=1 width=64)<br /> Recheck Cond: (proname ~~ 'my_pro1'::text)<br /> ->
BitmapIndex Scan on pg_proc_proname_args_nsp_index (cost=0.00..4.26 row<br />s=1 width=0)<br /> Index Cond:
((proname>= 'my'::name) AND (proname < 'mz'::name))<br />(4 rows)<br /><font color="#888888"><br /><br /><br
clear="all"/><br />-- <br />Rushabh Lathia<br /><br /><a href="http://www.EnterpriseDB.com"
target="_blank">www.EnterpriseDB.com</a></font></blockquote></div><br /><br clear="all" /><br />-- <br />Rushabh
Lathia<br/>