pg.ddx.io  pgsql-committers@postgresql.org mailing list archive  
help / color / mirror / Atom feed
From: Tom Lane <tgl@sss.pgh.pa.us>
To: pgsql-committers@lists.postgresql.org
Subject: pgsql: compute_bitmap_pages' loop_count parameter should be double not
Date: Mon, 18 Dec 2023 17:46:28 +0000
Message-ID: <E1rFHhE-00AnWo-3h@gemulon.postgresql.org> (raw)

compute_bitmap_pages' loop_count parameter should be double not int.

The value was double in the original implementation of this logic.
Commit da08a6598 pulled it out into a subroutine, but carelessly
declared the parameter as int when it should have been double.
On most platforms, the only ill effect would be to clamp the value
to be not more than INT_MAX, which would seldom be exceeded and
probably wouldn't change the estimates too much anyway.  Nonetheless,
it's wrong and can cause complaints from ubsan.

While here, improve the comments and parameter names.

This is an ABI change in a globally exposed subroutine, so
back-patching would create some risk of breaking extensions.
The value of the fix doesn't seem high enough to warrant taking
that risk, so fix in HEAD only.

Per report from Alexander Lakhin.

Discussion: https://postgr.es/m/f5e15fe1-202d-1936-f47c-f0c69a936b72@gmail.com

Branch
------
master

Details
-------
https://git.postgresql.org/pg/commitdiff/8b965c549dc8753be8a38c4a1b9fabdb535a4338

Modified Files
--------------
src/backend/optimizer/path/costsize.c | 22 +++++++++++++++-------
src/include/optimizer/cost.h          |  3 ++-
2 files changed, 17 insertions(+), 8 deletions(-)



Message-ID: <E1rFHhE-00AnWo-3h@gemulon.postgresql.org>
Permalink:  ../E1rFHhE-00AnWo-3h@gemulon.postgresql.org/
Also on:    postgresql.org/message-id/E1rFHhE-00AnWo-3h@gemulon.postgresql.org

 · 

reply

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Reply to all the recipients using the --to and --cc options:
  reply via email

  To: pgsql-committers@postgresql.org
  Cc: tgl@sss.pgh.pa.us, pgsql-committers@lists.postgresql.org
  Subject: Re: pgsql: compute_bitmap_pages' loop_count parameter should be double not
  In-Reply-To: <E1rFHhE-00AnWo-3h@gemulon.postgresql.org>

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

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