Re: bug in numeric log() on 7.1, 7.2.2, 7.2.3

Поиск
Список
Период
Сортировка
От Tom Lane
Тема Re: bug in numeric log() on 7.1, 7.2.2, 7.2.3
Дата
Msg-id 12658.1047601332@sss.pgh.pa.us
обсуждение исходный текст
Ответ на bug in numeric log() on 7.1, 7.2.2, 7.2.3  (dmarin <dmarin@uclink.berkeley.edu>)
Список pgsql-bugs
dmarin <dmarin@uclink.berkeley.edu> writes:
> This query never returns:
> select log(93094::numeric/92908::numeric);

The attached patch against 7.3 seems to take care of the problem.  You
should be able to apply it to 7.2, with possibly some tweaking (the code
needs to go into the loop in ln_var()).

I am unsure whether exp_var() needs a similar defense against roundoff
error.  Have you observed any problems there?

*** src/backend/utils/adt/numeric.c.orig    Tue Mar 11 16:01:33 2003
--- src/backend/utils/adt/numeric.c    Thu Mar 13 19:06:42 2003
***************
*** 3872,3877 ****
--- 3872,3880 ----
              break;

          add_var(result, &elem, result);
+
+         if (elem.weight < (result->weight - 2 * global_rscale))
+             break;
      }

      /* Compensate for argument range reduction, round to caller's rscale */



> P.S. Incidentally, on the solaris system, I also can't use pg_dump at all; no
> matter what database I try to dump, I get a bus error:

> [dmarin@boojum]$ pg_dump template1;
> Bus Error

> Is this a known problem, or would you like more information?)

Which pg_dump version is this?  Where is it crashing exactly (a stack
trace would help)?

            regards, tom lane

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

Предыдущее
От: Tom Lane
Дата:
Сообщение: Re: now() and date_trunc() apparently corrupting data
Следующее
От: Joshua Moore-Oliva (by way of Joshua Moore-Oliva
Дата:
Сообщение: Bug in AT TIME ZONE contruct between EST and INTERVAL '-05:00' (resubmit now that I am a member of this list)