Re: [COMMITTERS] pgsql: PL/Python: Convert numeric to Decimal

Поиск
Список
Период
Сортировка
От Szymon Guz
Тема Re: [COMMITTERS] pgsql: PL/Python: Convert numeric to Decimal
Дата
Msg-id CAFjNrYv93t95kgUoQ3STOzw6YNSAKp9j-yTrDDZZ7soOOkSB2Q@mail.gmail.com
обсуждение исходный текст
Ответ на Re: [COMMITTERS] pgsql: PL/Python: Convert numeric to Decimal  (Peter Eisentraut <peter_e@gmx.net>)
Список pgsql-hackers
On 7 July 2013 21:35, Peter Eisentraut <peter_e@gmx.net> wrote:
On Sun, 2013-07-07 at 17:21 +0200, Szymon Guz wrote:
> I think that these tests are much better, so they should go into
> trunk.
> As for Python 2.5 I think we could modify the code and makefile (with
> additional documentation info) so the decimal code wouldn't be
> compiled
> with python 2.5.

I'd welcome updated tests, if you want to work on that.  But they would
need to work uniformly for Python 2.4 through 3.3.



Well... I don't know what to do and which solution is better.

This patch works, but the tests are not working on some old machines.

This patch works, but changes the plpython functions, so I assume that it will provide errors to some existing functions. I've noticed yesterday that you cannot run code like `Decimal(10) - float(10)`. So if a function accepts a numeric parameter 'x', which currently is converted to float, then the code like `x - float(10)` currently works, and will not work after this change.

Introducing decimal.Decimal also breaks python earlier than 2.4, as the decimal module has been introduced in 2.4. We could use the old conversion for versions before 2.4, and the new for 2.4 and newer. Do we want it to work like this? Do we want to have different behaviour for different python versions? I'm not sure if anyone still uses Python 2.3, but I've already realised that the patch breaks all the functions for 2.3 which use numeric argument.

I assume that the patch will be rolled back, if it the tests don't work on some machines, right?

szymon

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

Предыдущее
От: Dimitri Fontaine
Дата:
Сообщение: Re: Review: extension template
Следующее
От: Andres Freund
Дата:
Сообщение: Re: changeset generation v5-01 - Patches & git tree