diff options
author | Andrew Dunstan <andrew@dunslane.net> | 2015-03-27 17:29:59 -0400 |
---|---|---|
committer | Andrew Dunstan <andrew@dunslane.net> | 2015-03-27 17:29:59 -0400 |
commit | 735cd6128a6a401671126443a9af4324932a38d6 (patch) | |
tree | 327b717c32da0ed036b719c31c32f70052e27eb8 /contrib/pg_stat_statements/pg_stat_statements.c | |
parent | 717f709532642f5f7756785c9be17b7ffcec8ae8 (diff) | |
download | postgresql-735cd6128a6a401671126443a9af4324932a38d6.tar.gz postgresql-735cd6128a6a401671126443a9af4324932a38d6.zip |
Fix portability issues with stddev in pg_stat_statements
Stddev is calculated on the fly, and the code in commit 717f70953264 was
using Float8GetDatumFast() inappropriately to convert the result to a
Datum. Mea culpa. It now uses Float8GetDatum().
Diffstat (limited to 'contrib/pg_stat_statements/pg_stat_statements.c')
-rw-r--r-- | contrib/pg_stat_statements/pg_stat_statements.c | 7 |
1 files changed, 5 insertions, 2 deletions
diff --git a/contrib/pg_stat_statements/pg_stat_statements.c b/contrib/pg_stat_statements/pg_stat_statements.c index ec0846d0a84..fee2aaacbe2 100644 --- a/contrib/pg_stat_statements/pg_stat_statements.c +++ b/contrib/pg_stat_statements/pg_stat_statements.c @@ -1577,12 +1577,15 @@ pg_stat_statements_internal(FunctionCallInfo fcinfo, * sample variance, as we have data for the whole population, * so Bessel's correction is not used, and we don't divide by * tmp.calls - 1. + * + * We're calculating the stddev on the fly, so it's not in the tmp + * structure, so we can't use the Float8GetDatumFast macro here. */ if (tmp.calls > 1) values[i++] = - Float8GetDatumFast(sqrtd(tmp.sum_var_time / tmp.calls)); + Float8GetDatum(sqrtd(tmp.sum_var_time / tmp.calls)); else - values[i++] = Float8GetDatumFast(0.0); + values[i++] = Float8GetDatum(0.0); } values[i++] = Int64GetDatumFast(tmp.rows); values[i++] = Int64GetDatumFast(tmp.shared_blks_hit); |