doc: Document error handling in PGTYPESnumeric_to_long
authorDaniel Gustafsson <dgustafsson@postgresql.org>
Mon, 25 Mar 2024 13:18:39 +0000 (14:18 +0100)
committerDaniel Gustafsson <dgustafsson@postgresql.org>
Mon, 25 Mar 2024 13:18:39 +0000 (14:18 +0100)
The documentation for PGTYPESnumeric_to_long only mentioned errno
being set to indicate overflow but the code also sets errno when
underflow happens.

Reported-by: Aidar Imamov <a.imamov@postgrespro.ru>
Discussion: https://postgr.es/m/eebf0ad50ad4321d65d2d64dd6b7f17d@postgrespro.ru

doc/src/sgml/ecpg.sgml

index ab58729e6ec295c73ea507c6033e06c9e742297f..43082704a7cb120df5db68bf511625ef11126a65 100644 (file)
@@ -2390,9 +2390,10 @@ int PGTYPESnumeric_to_long(numeric *nv, long *lp);
        The function converts the numeric value from the variable that
        <literal>nv</literal> points to into the long integer variable that
        <literal>lp</literal> points to. It returns 0 on success and -1 if an error
-       occurs, including overflow. On overflow, the global variable
+       occurs, including overflow and underflow. On overflow, the global variable
        <literal>errno</literal> will be set to <literal>PGTYPES_NUM_OVERFLOW</literal>
-       additionally.
+       and on underflow <literal>errno</literal> will be set to
+       <literal>PGTYPES_NUM_UNDERFLOW</literal>.
       </para>
      </listitem>
     </varlistentry>