adding import in pl/python function

From: Szymon Guz <mabewlun(at)gmail(dot)com>
To: pgsql-hackers <pgsql-hackers(at)postgresql(dot)org>
Subject: adding import in pl/python function
Date: 2013-05-24 19:10:26
Message-ID: CAFjNrYtR7Lm7D+BMzAwxrO4SDgdCWaH9H-5ysM5FTkNUWjYYoQ@mail.gmail.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-hackers

Hi,
I'm wondering if it would be OK to change the procedure code before
execution. I'm thinking about adding magically an import at the beginning
of a function.

Currently numeric arguments passed to the procedure are converted into
floats. This is not good, as it causes loss of information.

The proposed solution in code comment is "maybe use a string?".

I'm thinking about something else. We could convert it into Decimal (
http://docs.python.org/2/library/decimal.html) class in Python.
Unfortunately this class requires import like `from decimal import Decimal`
from a standard Python library.

I'm wondering if it would be a good idea to do it like this. It shouldn't
fail even with the trusted version of pl/python, as I'd rather see the
trusted version to allow importing packages from standard library.

regards,
Szymon

Responses

Browse pgsql-hackers by date

  From Date Subject
Next Message Robert Haas 2013-05-24 19:11:12 Re: Cost limited statements RFC
Previous Message james 2013-05-24 18:52:28 Re: Parallel Sort