Movatterモバイル変換


[0]ホーム

URL:


Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

Commita5ab892

Browse files
committed
Make bms_prev_member work correctly with a 64 bit bitmapword
5c06752 erroneously had coded bms_prev_member assuming that a bitmapwordwould always hold 32 bits and started it's search on what it thought was thehighest 8-bits of the word. This was not the case if bitmapwords were 64bits.In passing add a test to exercise this function a little. Previously there wasno coverage at all.David Rowly
1 parent9975c12 commita5ab892

File tree

3 files changed

+49
-1
lines changed

3 files changed

+49
-1
lines changed

‎src/backend/nodes/bitmapset.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1167,7 +1167,7 @@ bms_prev_member(const Bitmapset *a, int prevbit)
11671167
if (w!=0)
11681168
{
11691169
intresult;
1170-
intshift=24;
1170+
intshift=BITS_PER_BITMAPWORD-8;
11711171
result=wordnum*BITS_PER_BITMAPWORD;
11721172

11731173
while ((w >>shift)==0)

‎src/test/regress/expected/partition_prune.out

Lines changed: 23 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1747,6 +1747,29 @@ explain (analyze, costs off, summary off, timing off) execute ab_q3 (2, 2);
17471747
Filter: ((b >= $1) AND (b <= $2) AND (a < $0))
17481748
(10 rows)
17491749

1750+
-- Test a backwards Append scan
1751+
create table list_part (a int) partition by list (a);
1752+
create table list_part1 partition of list_part for values in (1);
1753+
create table list_part2 partition of list_part for values in (2);
1754+
create table list_part3 partition of list_part for values in (3);
1755+
create table list_part4 partition of list_part for values in (4);
1756+
insert into list_part select generate_series(1,4);
1757+
begin;
1758+
-- Don't select an actual value out of the table as the order of the Append's
1759+
-- subnodes may not be stable.
1760+
declare cur SCROLL CURSOR for select 1 from list_part where a > (select 1) and a < (select 4);
1761+
-- move beyond the final row
1762+
move 3 from cur;
1763+
-- Ensure we get two rows.
1764+
fetch backward all from cur;
1765+
?column?
1766+
----------
1767+
1
1768+
1
1769+
(2 rows)
1770+
1771+
commit;
1772+
drop table list_part;
17501773
-- Parallel append
17511774
-- Suppress the number of loops each parallel node runs for. This is because
17521775
-- more than one worker may run the same parallel node if timing conditions

‎src/test/regress/sql/partition_prune.sql

Lines changed: 25 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -359,6 +359,31 @@ execute ab_q3 (1, 8);
359359

360360
explain (analyze, costs off, summary off, timing off) execute ab_q3 (2,2);
361361

362+
-- Test a backwards Append scan
363+
createtablelist_part (aint) partition by list (a);
364+
createtablelist_part1 partition of list_part forvaluesin (1);
365+
createtablelist_part2 partition of list_part forvaluesin (2);
366+
createtablelist_part3 partition of list_part forvaluesin (3);
367+
createtablelist_part4 partition of list_part forvaluesin (4);
368+
369+
insert into list_partselect generate_series(1,4);
370+
371+
begin;
372+
373+
-- Don't select an actual value out of the table as the order of the Append's
374+
-- subnodes may not be stable.
375+
declare cur SCROLL CURSOR forselect1from list_partwhere a> (select1)and a< (select4);
376+
377+
-- move beyond the final row
378+
move3from cur;
379+
380+
-- Ensure we get two rows.
381+
fetch backward allfrom cur;
382+
383+
commit;
384+
385+
droptable list_part;
386+
362387
-- Parallel append
363388

364389
-- Suppress the number of loops each parallel node runs for. This is because

0 commit comments

Comments
 (0)

[8]ページ先頭

©2009-2025 Movatter.jp