pg.ddx.io  pgsql-docs@postgresql.org mailing list archive  
help / color / mirror / Atom feed
documentation describing the range of a number type 'integer' is incorrect
5+ messages / 4 participants
[nested] [flat]

* documentation describing the range of a number type 'integer' is incorrect
@ 2021-07-29 22:27  PG Doc comments form <noreply@postgresql.org>
  0 siblings, 1 reply; 5+ messages in thread

From: PG Doc comments form @ 2021-07-29 22:27 UTC (permalink / raw)
  To: pgsql-docs@lists.postgresql.org; +Cc: kjs@teews.com

The following documentation comment has been logged on the website:

Page: https://www.postgresql.org/docs/13/datatype-numeric.html
Description:

https://www.postgresql.org/docs/13/datatype-numeric.html says that the range
of a numeric type integer is -2147483648 to +2147483647 but
PGTYPESnumeric_to_int considers -2147483648 (a perfectly valid 32-bit
integer) to be invalid because it compares to -INT_MAX instead of INT_MIN or
(-INT_MAX - 1). This goes back to the initial commit in the git repo for
src/interfaces/ecpg/pgtypeslib/numeric.c. And doc/src/sgml/ecpg.sgml
documents the min being -INT_MAX.


^ permalink  raw  reply  [nested|flat] 5+ messages in thread

* Re: documentation describing the range of a number type 'integer' is incorrect
@ 2021-10-22 13:43  Alvaro Herrera <alvherre@alvh.no-ip.org>
  parent: PG Doc comments form <noreply@postgresql.org>
  0 siblings, 1 reply; 5+ messages in thread

From: Alvaro Herrera @ 2021-10-22 13:43 UTC (permalink / raw)
  To: kjs@teews.com; pgsql-docs@lists.postgresql.org; +Cc: Michael Meskes <meskes@postgresql.org>

On 2021-Jul-29, PG Doc comments form wrote:

> https://www.postgresql.org/docs/13/datatype-numeric.html says that the range
> of a numeric type integer is -2147483648 to +2147483647 but
> PGTYPESnumeric_to_int considers -2147483648 (a perfectly valid 32-bit
> integer) to be invalid because it compares to -INT_MAX instead of INT_MIN or
> (-INT_MAX - 1). This goes back to the initial commit in the git repo for
> src/interfaces/ecpg/pgtypeslib/numeric.c. And doc/src/sgml/ecpg.sgml
> documents the min being -INT_MAX.

This sounds like an ECPG bug, not a documentation problem.

-- 
Álvaro Herrera           39°49'30"S 73°17'W  —  https://www.EnterpriseDB.com/
"XML!" Exclaimed C++.  "What are you doing here? You're not a programming
language."
"Tell that to the people who use me," said XML.
https://burningbird.net/the-parable-of-the-languages/





^ permalink  raw  reply  [nested|flat] 5+ messages in thread

* Re: documentation describing the range of a number type 'integer' is incorrect
@ 2021-10-22 18:55  Kevin Sweet <kevin@teews.com>
  parent: Alvaro Herrera <alvherre@alvh.no-ip.org>
  0 siblings, 2 replies; 5+ messages in thread

From: Kevin Sweet @ 2021-10-22 18:55 UTC (permalink / raw)
  To: Alvaro Herrera <alvherre@alvh.no-ip.org>; pgsql-docs@lists.postgresql.org; +Cc: Michael Meskes <meskes@postgresql.org>

<html>
  <head>
    <meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
  </head>
  <body>
    <font face="Arial">The bugs team agreed that it's a bug. The
      documentation accurately represents the buggy code. I thought you
      might want to update the doc when the bug is fixed.<br>
      <br>
    </font><br>
    <div class="moz-cite-prefix">On 10/22/21 6:43 AM, Alvaro Herrera
      wrote:<br>
    </div>
    <blockquote type="cite"
      cite="mid:202110221343.rgmrpm6sy3be@alvherre.pgsql">
      <pre class="moz-quote-pre" wrap="">On 2021-Jul-29, PG Doc comments form wrote:

</pre>
      <blockquote type="cite">
        <pre class="moz-quote-pre" wrap=""><a class="moz-txt-link-freetext" href="https://www.postgresql.org/docs/13/datatype-numeric.html">https://www.postgresql.org/docs/13/...; says that the range
of a numeric type integer is -2147483648 to +2147483647 but
PGTYPESnumeric_to_int considers -2147483648 (a perfectly valid 32-bit
integer) to be invalid because it compares to -INT_MAX instead of INT_MIN or
(-INT_MAX - 1). This goes back to the initial commit in the git repo for
src/interfaces/ecpg/pgtypeslib/numeric.c. And doc/src/sgml/ecpg.sgml
documents the min being -INT_MAX.
</pre>
      </blockquote>
      <pre class="moz-quote-pre" wrap="">
This sounds like an ECPG bug, not a documentation problem.

</pre>
    </blockquote>
    <br>
  </body>
</html>





^ permalink  raw  reply  [nested|flat] 5+ messages in thread

* Re: documentation describing the range of a number type 'integer' is incorrect
@ 2021-10-22 19:23  Alvaro Herrera <alvherre@alvh.no-ip.org>
  parent: Kevin Sweet <kevin@teews.com>
  1 sibling, 0 replies; 5+ messages in thread

From: Alvaro Herrera @ 2021-10-22 19:23 UTC (permalink / raw)
  To: Kevin Sweet <kevin@teews.com>; +Cc: pgsql-docs@lists.postgresql.org, Michael Meskes <meskes@postgresql.org>

On 2021-Oct-22, Kevin Sweet wrote:

>    The bugs team agreed that it's a bug. The documentation accurately
>    represents the buggy code. I thought you might want to update the doc
>    when the bug is fixed.

It looks like the bug and the docs have both been fixed for months.  I
just somehow failed to realize that I was replying to such an old message.
Sorry for the noise.

https://postgr.es/m/17128-55a8a879727a3e3a@postgresql.org

-- 
Álvaro Herrera           39°49'30"S 73°17'W  —  https://www.EnterpriseDB.com/
"The Gord often wonders why people threaten never to come back after they've
been told never to return" (www.actsofgord.com)





^ permalink  raw  reply  [nested|flat] 5+ messages in thread

* Re: documentation describing the range of a number type 'integer' is incorrect
@ 2022-08-17 19:59  Bruce Momjian <bruce@momjian.us>
  parent: Kevin Sweet <kevin@teews.com>
  1 sibling, 0 replies; 5+ messages in thread

From: Bruce Momjian @ 2022-08-17 19:59 UTC (permalink / raw)
  To: Kevin Sweet <kevin@teews.com>; +Cc: Alvaro Herrera <alvherre@alvh.no-ip.org>; pgsql-docs@lists.postgresql.org, Michael Meskes <meskes@postgresql.org>

On Fri, Oct 22, 2021 at 11:55:33AM -0700, Kevin Sweet wrote:
> The bugs team agreed that it's a bug. The documentation accurately represents
> the buggy code. I thought you might want to update the doc when the bug is
> fixed.

This was fixed in this commit:

	commit 5fcf3945bd
	Author: John Naylor <john.naylor@postgresql.org>
	Date:   Fri Jul 30 13:50:23 2021 -0400
	
	    Fix range check in ECPG numeric to int conversion
	
	    The previous coding guarded against -INT_MAX instead of INT_MIN,
	    leading to -2147483648 being rejected as out of range.
	
	    Per bug #17128 from Kevin Sweet
	
	    Discussion: https://www.postgresql.org/message-id/flat/17128-55a8a879727a3e3a%40postgresql.org
	    Reviewed-by: Tom Lane
	    Backpatch to all supported branches

This was backpatched to all branches, so any release after July 30, 2021
should have this fix.  I don't see any docs that need adjusting.

---------------------------------------------------------------------------

> 
> 
> On 10/22/21 6:43 AM, Alvaro Herrera wrote:
> 
>     On 2021-Jul-29, PG Doc comments form wrote:
> 
> 
>         https://www.postgresql.org/docs/13/datatype-numeric.html says that the range
>         of a numeric type integer is -2147483648 to +2147483647 but
>         PGTYPESnumeric_to_int considers -2147483648 (a perfectly valid 32-bit
>         integer) to be invalid because it compares to -INT_MAX instead of INT_MIN or
>         (-INT_MAX - 1). This goes back to the initial commit in the git repo for
>         src/interfaces/ecpg/pgtypeslib/numeric.c. And doc/src/sgml/ecpg.sgml
>         documents the min being -INT_MAX.
> 
>     This sounds like an ECPG bug, not a documentation problem.
> 
> 
> 

-- 
  Bruce Momjian  <bruce@momjian.us>        https://momjian.us
  EDB                                      https://enterprisedb.com

  Indecision is a decision.  Inaction is an action.  Mark Batterson






^ permalink  raw  reply  [nested|flat] 5+ messages in thread


end of thread, other threads:[~2022-08-17 19:59 UTC | newest]

Thread overview: 5+ messages (download: mbox mbox.gz follow: Atom feed)
-- links below jump to the message on this page --
2021-07-29 22:27 documentation describing the range of a number type 'integer' is incorrect PG Doc comments form <noreply@postgresql.org>
2021-10-22 13:43 ` Alvaro Herrera <alvherre@alvh.no-ip.org>
2021-10-22 18:55   ` Kevin Sweet <kevin@teews.com>
2021-10-22 19:23     ` Alvaro Herrera <alvherre@alvh.no-ip.org>
2022-08-17 19:59     ` Bruce Momjian <bruce@momjian.us>

This inbox is served by DDX for PostgreSQL; see mirroring instructions
for how to clone and mirror all data and code used for this inbox