Received: from malur.postgresql.org ([217.196.149.56]) by arkaria.postgresql.org with esmtp (Exim 4.80) (envelope-from ) id 1V5Jy8-0006vA-4y for pgsql-bugs@arkaria.postgresql.org; Fri, 02 Aug 2013 18:20:52 +0000 Received: from localhost ([127.0.0.1] helo=postgresql.org) by malur.postgresql.org with smtp (Exim 4.80) (envelope-from ) id 1V5Jy7-0008P4-Jq for pgsql-bugs@arkaria.postgresql.org; Fri, 02 Aug 2013 18:20:51 +0000 Received: from makus.postgresql.org ([2001:4800:7903:4::125]) by malur.postgresql.org with esmtp (Exim 4.80) (envelope-from ) id 1V5C2L-0004zz-Io for pgsql-bugs@postgresql.org; Fri, 02 Aug 2013 09:52:41 +0000 Received: from mahout.postgresql.org ([2001:4800:7903:4::123]) by makus.postgresql.org with esmtp (Exim 4.80) (envelope-from ) id 1V5C2I-0006yV-MR for pgsql-bugs@postgresql.org; Fri, 02 Aug 2013 09:52:41 +0000 Received: from [204.145.124.246] (helo=wrigleys.postgresql.org) by mahout.postgresql.org with esmtp (Exim 4.80) (envelope-from ) id 1V5C2H-00035Z-Vi for pgsql-bugs@postgresql.org; Fri, 02 Aug 2013 09:52:38 +0000 Received: from www-data by wrigleys.postgresql.org with local (Exim 4.80) (envelope-from ) id 1V5C2C-0005EG-L3 for pgsql-bugs@postgresql.org; Fri, 02 Aug 2013 09:52:32 +0000 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit Subject: BUG #8355: PL/Python 3 can't convert infinity to PostgreSQL's value To: pgsql-bugs@postgresql.org From: grv87@yandex.ru Message-Id: Date: Fri, 02 Aug 2013 09:52:32 +0000 X-Pg-Spam-Score: -0.7 (/) List-Archive: List-Help: List-ID: List-Owner: List-Post: List-Subscribe: List-Unsubscribe: X-Mailing-List: pgsql-bugs Precedence: bulk Sender: pgsql-bugs-owner@postgresql.org 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 plpy.execute(plan, [a]) PL/Python anonymous code block I suppose this should work without any workarounds. -- Sent via pgsql-bugs mailing list (pgsql-bugs@postgresql.org) To make changes to your subscription: http://www.postgresql.org/mailpref/pgsql-bugs