@@ -288,8 +288,9 @@ $$ LANGUAGE plpythonu;
288288 <sect2>
289289 <title>Data Type Mapping</title>
290290 <para>
291- Function arguments are converted from their PostgreSQL type to a
292- corresponding Python type:
291+ When a PL/Python function is called, its arguments are converted from
292+ their PostgreSQL data type to a corresponding Python type:
293+
293294 <itemizedlist>
294295 <listitem>
295296 <para>
@@ -322,7 +323,7 @@ $$ LANGUAGE plpythonu;
322323 Otherwise,
323324 <literal>decimal.Decimal</literal> from the standard library will be
324325 used. <literal>cdecimal</literal> is significantly faster
325- than <literal>decimal</literal>. In Python 3.3,
326+ than <literal>decimal</literal>. In Python 3.3 and up ,
326327 however, <literal>cdecimal</literal> has been integrated into the
327328 standard library under the name <literal>decimal</literal>, so there is
328329 no longer any difference.
@@ -356,8 +357,9 @@ $$ LANGUAGE plpythonu;
356357 </para>
357358
358359 <para>
359- Function return values are converted to the declared PostgreSQL
360- return data type as follows:
360+ When a PL/Python function returns, its return value is converted to the
361+ function's declared PostgreSQL return data type as follows:
362+
361363 <itemizedlist>
362364 <listitem>
363365 <para>
@@ -373,16 +375,18 @@ $$ LANGUAGE plpythonu;
373375 When the PostgreSQL return type is <type>bytea</type>, the
374376 return value will be converted to a string (Python 2) or bytes
375377 (Python 3) using the respective Python built-ins, with the
376- result being converted <type>bytea</type>.
378+ result being converted to <type>bytea</type>.
377379 </para>
378380 </listitem>
379381
380382 <listitem>
381383 <para>
382- For all other PostgreSQL return types, the returned Python
383- value is converted to a string using the Python
384- built-in <literal>str</literal>, and the result is passed to the
385- input function of the PostgreSQL data type.
384+ For all other PostgreSQL return types, the return value is converted
385+ to a string using the Python built-in <literal>str</literal>, and the
386+ result is passed to the input function of the PostgreSQL data type.
387+ (If the Python value is a <type>float</>, it is converted using
388+ the <literal>repr</> built-in instead of <literal>str</literal>, to
389+ avoid loss of precision.)
386390 </para>
387391
388392 <para>
0 commit comments