Skip to content

Commit 07d8af5

Browse files
committed
pgstattuple: Use double consistently for percentages
pgstattuple uses data type double for other percentage calculations and exposes those values to the users via the float8 data type. However, scanned_percent in struct output_type is of type uint64, even though it is later returned via Float8GetDatum(). Change it to use double to be inline with other percentages. Author: Bharath Rupireddy Reviewed-by: Peter Eisentraut Discussion: https://www.postgresql.org/message-id/36ee692b-232f-0484-ce94-dc39d82021ad%40enterprisedb.com
1 parent 57796a0 commit 07d8af5

File tree

1 file changed

+2
-2
lines changed

1 file changed

+2
-2
lines changed

contrib/pgstattuple/pgstatapprox.c

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -38,7 +38,7 @@ Datum pgstattuple_approx_internal(Oid relid, FunctionCallInfo fcinfo);
3838
typedef struct output_type
3939
{
4040
uint64 table_len;
41-
uint64 scanned_percent;
41+
double scanned_percent;
4242
uint64 tuple_count;
4343
uint64 tuple_len;
4444
double tuple_percent;
@@ -203,7 +203,7 @@ statapprox_heap(Relation rel, output_type *stat)
203203
*/
204204
if (nblocks != 0)
205205
{
206-
stat->scanned_percent = 100 * scanned / nblocks;
206+
stat->scanned_percent = 100.0 * scanned / nblocks;
207207
stat->tuple_percent = 100.0 * stat->tuple_len / stat->table_len;
208208
stat->dead_tuple_percent = 100.0 * stat->dead_tuple_len / stat->table_len;
209209
stat->free_percent = 100.0 * stat->free_space / stat->table_len;

0 commit comments

Comments
 (0)
pFad - Phonifier reborn

Pfad - The Proxy pFad of © 2024 Garber Painting. All rights reserved.

Note: This service is not intended for secure transactions such as banking, social media, email, or purchasing. Use at your own risk. We assume no liability whatsoever for broken pages.


Alternative Proxies:

Alternative Proxy

pFad Proxy

pFad v3 Proxy

pFad v4 Proxy