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

Commit735cd61

Browse files
committed
Fix portability issues with stddev in pg_stat_statements
Stddev is calculated on the fly, and the code in commit717f709 wasusing Float8GetDatumFast() inappropriately to convert the result to aDatum. Mea culpa. It now uses Float8GetDatum().
1 parent717f709 commit735cd61

File tree

1 file changed

+5
-2
lines changed

1 file changed

+5
-2
lines changed

‎contrib/pg_stat_statements/pg_stat_statements.c

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1577,12 +1577,15 @@ pg_stat_statements_internal(FunctionCallInfo fcinfo,
15771577
* sample variance, as we have data for the whole population,
15781578
* so Bessel's correction is not used, and we don't divide by
15791579
* tmp.calls - 1.
1580+
*
1581+
* We're calculating the stddev on the fly, so it's not in the tmp
1582+
* structure, so we can't use the Float8GetDatumFast macro here.
15801583
*/
15811584
if (tmp.calls>1)
15821585
values[i++]=
1583-
Float8GetDatumFast(sqrtd(tmp.sum_var_time /tmp.calls));
1586+
Float8GetDatum(sqrtd(tmp.sum_var_time /tmp.calls));
15841587
else
1585-
values[i++]=Float8GetDatumFast(0.0);
1588+
values[i++]=Float8GetDatum(0.0);
15861589
}
15871590
values[i++]=Int64GetDatumFast(tmp.rows);
15881591
values[i++]=Int64GetDatumFast(tmp.shared_blks_hit);

0 commit comments

Comments
 (0)

[8]ページ先頭

©2009-2025 Movatter.jp