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

Commit0b7ba3d

Browse files
committed
pgstatindex: Insert some casts to prevent overflow.
This could cause hash indexes to report greater than 100% free space.Ashutosh Sharma, reviewed by Amit KapilaDiscussion:http://postgr.es/m/CAE9k0PnCKfg-ZK1CwGZJPF1yKcG2A=GUgC3BMdNMzLAXVOo4Eg@mail.gmail.com
1 parentec99dd5 commit0b7ba3d

File tree

1 file changed

+3
-2
lines changed

1 file changed

+3
-2
lines changed

‎contrib/pgstattuple/pgstatindex.c

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -687,13 +687,14 @@ pgstathashindex(PG_FUNCTION_ARGS)
687687
index_close(rel,AccessShareLock);
688688

689689
/* Count unused pages as free space. */
690-
stats.free_space+=stats.unused_pages*stats.space_per_page;
690+
stats.free_space+=(uint64)stats.unused_pages*stats.space_per_page;
691691

692692
/*
693693
* Total space available for tuples excludes the metapage and the bitmap
694694
* pages.
695695
*/
696-
total_space= (nblocks- (stats.bitmap_pages+1))*stats.space_per_page;
696+
total_space= (uint64) (nblocks- (stats.bitmap_pages+1))*
697+
stats.space_per_page;
697698

698699
if (total_space==0)
699700
free_percent=0.0;

0 commit comments

Comments
 (0)

[8]ページ先頭

©2009-2025 Movatter.jp