Document that PL/Python now returns floats using repr() not str().
authorTom Lane
Tue, 1 Sep 2015 23:25:58 +0000 (19:25 -0400)
committerTom Lane
Tue, 1 Sep 2015 23:25:58 +0000 (19:25 -0400)
Commit 1ce7a57ca neglected to update the user-facing documentation,
which described the old behavior precisely.

doc/src/sgml/plpython.sgml

index c838c7b79a5a618dc7dc4ad6e0ba1e99d10d5af6..015bbad8ddaa976888c957837646e02265313cbb 100644 (file)
@@ -288,8 +288,9 @@ $$ LANGUAGE plpythonu;
   
    Data Type Mapping
    
-    Function arguments are converted from their PostgreSQL type to a
-    corresponding Python type:
+    When a PL/Python function is called, its arguments are converted from
+    their PostgreSQL data type to a corresponding Python type:
+
     
      
       
@@ -322,7 +323,7 @@ $$ LANGUAGE plpythonu;
        Otherwise,
        decimal.Decimal from the standard library will be
        used.  cdecimal is significantly faster
-       than decimal.  In Python 3.3,
+       than decimal.  In Python 3.3 and up,
        however, cdecimal has been integrated into the
        standard library under the name decimal, so there is
        no longer any difference.
@@ -356,8 +357,9 @@ $$ LANGUAGE plpythonu;
    
 
    
-    Function return values are converted to the declared PostgreSQL
-    return data type as follows:
+    When a PL/Python function returns, its return value is converted to the
+    function's declared PostgreSQL return data type as follows:
+
     
      
       
@@ -373,16 +375,18 @@ $$ LANGUAGE plpythonu;
        When the PostgreSQL return type is bytea, the
        return value will be converted to a string (Python 2) or bytes
        (Python 3) using the respective Python built-ins, with the
-       result being converted bytea.
+       result being converted to bytea.
       
      
 
      
       
-       For all other PostgreSQL return types, the returned Python
-       value is converted to a string using the Python
-       built-in str, and the result is passed to the
-       input function of the PostgreSQL data type.
+       For all other PostgreSQL return types, the return value is converted
+       to a string using the Python built-in str, and the
+       result is passed to the input function of the PostgreSQL data type.
+       (If the Python value is a float, it is converted using
+       the repr built-in instead of str, to
+       avoid loss of precision.)