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

Поиск
Список
Период
Сортировка
От grv87@yandex.ru
Тема BUG #8355: PL/Python 3 can't convert infinity to PostgreSQL's value
Дата
Msg-id E1V5C2C-0005EG-L3@wrigleys.postgresql.org
обсуждение исходный текст
Ответы Re: BUG #8355: PL/Python 3 can't convert infinity to PostgreSQL's value  (Tom Lane <tgl@sss.pgh.pa.us>)
Список pgsql-bugs
The following bug has been logged on the website:

Bug reference:      8355
Logged by:          Basil Peace
Email address:      grv87@yandex.ru
PostgreSQL version: 9.2.4
Operating system:   Windows 7 x64 (PostgreSQL is x86), Python 3.2.5
Description:

PL/Python can't convert Python's float with infinity value to PostgreSQL's
float.
The reason is that Python's standard representation of infinity is 'inf'
('Infinity' is accepted as well), but PostgreSQL's representation is
'Infinity' only.
I'm speaking of Python 3 version since I have no Python 2 to test.


Consider the following code:


-- CREATE LANGUAGE plpython3u;


CREATE TABLE IF NOT EXISTS test10 (
    a double precision
);


DO LANGUAGE plpython3u $$
    plan = plpy.prepare('INSERT INTO test10 (a) VALUES ($1)', ['double
precision'])
    a = float('inf')
    plpy.execute(plan, [a])
$$;




ERROR:  spiexceptions.InvalidTextRepresentation: invalid input syntax for
type double precision: "inf"
CONTEXT:  Traceback (most recent call last):
  PL/Python anonymous code block, line 4, in <module>
    plpy.execute(plan, [a])
PL/Python anonymous code block




I suppose this should work without any workarounds.

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

Предыдущее
От: alex@hill.net.au
Дата:
Сообщение: BUG #8354: stripped positions can generate nonzero rank in ts_rank_cd
Следующее
От: Tom Lane
Дата:
Сообщение: Re: BUG #8355: PL/Python 3 can't convert infinity to PostgreSQL's value