pgsql: Fix pgstatindex() to give consistent results for empty indexes.

Поиск
Список
Период
Сортировка
От Tom Lane
Тема pgsql: Fix pgstatindex() to give consistent results for empty indexes.
Дата
Msg-id E1QwQyC-0003LS-F0@gemulon.postgresql.org
обсуждение исходный текст
Список pgsql-committers
Fix pgstatindex() to give consistent results for empty indexes.

For an empty index, the pgstatindex() function would compute 0.0/0.0 for
its avg_leaf_density and leaf_fragmentation outputs.  On machines that
follow the IEEE float arithmetic standard with any care, that results in
a NaN.  However, per report from Rushabh Lathia, Microsoft couldn't
manage to get this right, so you'd get a bizarre error on Windows.

Fix by forcing the results to be NaN explicitly, rather than relying on
the division operator to give that or the snprintf function to print it
correctly.  I have some doubts that this is really the most useful
definition, but it seems better to remain backward-compatible with
those platforms for which the behavior wasn't completely broken.

Back-patch to 8.2, since the code is like that in all current releases.

Branch
------
REL9_0_STABLE

Details
-------
http://git.postgresql.org/pg/commitdiff/8a32c946586c8be422ff1ea18f6a6ea5c3141ebb

Modified Files
--------------
contrib/pgstattuple/pgstatindex.c |   12 ++++++++++--
1 files changed, 10 insertions(+), 2 deletions(-)


В списке pgsql-committers по дате отправления:

Предыдущее
От: Tom Lane
Дата:
Сообщение: pgsql: Fix pgstatindex() to give consistent results for empty indexes.
Следующее
От: Tom Lane
Дата:
Сообщение: pgsql: Fix pgstatindex() to give consistent results for empty indexes.