Re: BUG #8355: PL/Python 3 can't convert infinity to PostgreSQL's value

Поиск
Список
Период
Сортировка
От Tom Lane
Тема Re: BUG #8355: PL/Python 3 can't convert infinity to PostgreSQL's value
Дата
Msg-id 8645.1375477524@sss.pgh.pa.us
обсуждение исходный текст
Ответ на Re: BUG #8355: PL/Python 3 can't convert infinity to PostgreSQL's value  (Tom Lane <tgl@sss.pgh.pa.us>)
Ответы Re: BUG #8355: PL/Python 3 can't convert infinity to PostgreSQL's value  (Tom Lane <tgl@sss.pgh.pa.us>)
Re: BUG #8355: PL/Python 3 can't convert infinity to PostgreSQL's value  (Basil Peace <grv87@yandex.ru>)
Список pgsql-bugs
I wrote:
> ... further experimentation says that this doesn't work on my ancient
> HPUX box; and you're complaining about Windows.  So what we've got here
> is a platform dependency in the behavior of strtod().  I don't think
> we can promise to hide all such dependencies, but maybe it'd be a good
> idea to take care of this particular one.

I took a look in the C99 standard, and what it has to say about it is
actually this:

       [#3] The  expected  form  of  the  subject  sequence  is  an
       optional plus or minus sign, then one of the following:

         -- a   nonempty  sequence  of  decimal  digits  optionally
            containing a decimal-point character, then an  optional
            exponent part as defined in 6.4.4.2;

         -- a  0x  or  0X,  then a nonempty sequence of hexadecimal
            digits optionally containing a decimal-point character,
            then  an  optional  binary-exponent  part as defined in
            6.4.4.2, where either the  decimal-point  character  or
            the binary-exponent part is present;

         -- one of INF or INFINITY, ignoring case

         -- one  of  NAN or NAN(n-char-sequence-opt), ignoring case
            in the NAN part, where:
                    n-char-sequence:
                            digit
                            nondigit
                            n-char-sequence digit
                            n-char-sequence nondigit

Current versions of the POSIX standard say the same, though SUS v2
didn't mention any of the non-numeric variants.

So what we've got is that Windows and some other (obsolete?) platforms
don't accept everything the standard says they should, and that results in
a visible cross-platform behavioral difference for us.

I'm not at all excited about supporting 0x... constants, nor about the
expanded form of NaN.  But it seems like maybe we had better cover the
following cases that we do not cover today:

    inf
    +inf
    -inf
    +Infinity

We already backstop strtod() for these cases:

    NaN
    Infinity
    -Infinity

but the wording of the spec clearly requires +Infinity as well as the
forms with just "inf".  (It also appears to require +/- NaN to be
accepted, but I have no idea what that would mean and suspect it to
be a thinko.)

Barring objections I'll go make this change.

            regards, tom lane

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

Предыдущее
От: Tom Lane
Дата:
Сообщение: Re: BUG #8355: PL/Python 3 can't convert infinity to PostgreSQL's value
Следующее
От: Alvaro Herrera
Дата:
Сообщение: Re: 9.3beta2: Failure to pg_upgrade