Commit 6a468c34 authored by Robert Haas's avatar Robert Haas

Fix bug in parallel tidbitmap iteration.

Avoid computing idxpages[istate->spageptr] until after checking
that istate->spageptr is a legal index.

Dilip Kumar, per a report from David Rowley

Discussion: http://postgr.es/m/CAKJS1f8OtrHE+-P+=E=4ycnL29e9idZKuaTQ6o2MbhvGN9D8ig@mail.gmail.com
parent 0ee92e1c
......@@ -1103,13 +1103,12 @@ tbm_shared_iterate(TBMSharedIterator *iterator)
if (istate->schunkptr < istate->nchunks)
{
PagetableEntry *chunk = &ptbase[idxchunks[istate->schunkptr]];
PagetableEntry *page = &ptbase[idxpages[istate->spageptr]];
BlockNumber chunk_blockno;
chunk_blockno = chunk->blockno + istate->schunkbit;
if (istate->spageptr >= istate->npages ||
chunk_blockno < page->blockno)
chunk_blockno < ptbase[idxpages[istate->spageptr]].blockno)
{
/* Return a lossy page indicator from the chunk */
output->blockno = chunk_blockno;
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment