pg.ddx.io  pgsql-committers@postgresql.org mailing list archive  
help / color / mirror / Atom feed
pgsql: Expose internal function for converting int64 to numeric
2+ messages / 2 participants
[nested] [flat]

Commits from this thread:
  2020-09-15 fe4f36bcde  Fix compiler warning
* pgsql: Expose internal function for converting int64 to numeric
@ 2020-09-09 18:41 Peter Eisentraut <peter@eisentraut.org>
  2020-09-15 00:35 ` Re: pgsql: Expose internal function for converting int64 to numeric David Rowley <dgrowleyml@gmail.com>
  0 siblings, 1 reply; 2+ messages in thread

From: Peter Eisentraut @ 2020-09-09 18:41 UTC (permalink / raw)
  To: pgsql-committers@lists.postgresql.org

Expose internal function for converting int64 to numeric

Existing callers had to take complicated detours via
DirectFunctionCall1().  This simplifies a lot of code.

Reviewed-by: Tom Lane <tgl@sss.pgh.pa.us>
Discussion: https://www.postgresql.org/message-id/flat/42b73d2d-da12-ba9f-570a-420e0cce19d9@phystech.edu

Branch
------
master

Details
-------
https://git.postgresql.org/pg/commitdiff/0aa8f764088ea0f36620ae2955fa6c54ec736c46

Modified Files
--------------
contrib/btree_gist/btree_numeric.c    |   2 +-
contrib/jsonb_plperl/jsonb_plperl.c   |   4 +-
src/backend/utils/adt/cash.c          |   7 +-
src/backend/utils/adt/dbsize.c        |  21 ++----
src/backend/utils/adt/formatting.c    |  19 ++----
src/backend/utils/adt/jsonpath_exec.c |  11 +---
src/backend/utils/adt/numeric.c       | 116 +++++++++-------------------------
src/include/utils/numeric.h           |   2 +
8 files changed, 50 insertions(+), 132 deletions(-)



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

* Re: pgsql: Expose internal function for converting int64 to numeric
  2020-09-09 18:41 pgsql: Expose internal function for converting int64 to numeric Peter Eisentraut <peter@eisentraut.org>
@ 2020-09-15 00:35 ` David Rowley <dgrowleyml@gmail.com>
  0 siblings, 0 replies; 2+ messages in thread

From: David Rowley @ 2020-09-15 00:35 UTC (permalink / raw)
  To: Peter Eisentraut <peter@eisentraut.org>; +Cc: pgsql-committers@lists.postgresql.org

On Thu, 10 Sep 2020 at 06:41, Peter Eisentraut <peter@eisentraut.org> wrote:
> src/backend/utils/adt/dbsize.c        |  21 ++----

This change introduced a new compiler warning on MSVC.

src\backend\utils\adt\dbsize.c(630): warning C4334: '<<': result of
32-bit shift implicitly converted to 64 bits (was 64-bit shift
intended?)

I see all of the calls all bit shift by a constant that''s always
below 32. So there's no actual danger here, but the attached at least
silences the warning.

I'll push it in a bit if nobody has other ideas.

David

Attachments:

fix_compiler_warning.patch (application/octet-stream, 551B) download diff --git a/src/backend/utils/adt/dbsize.c b/src/backend/utils/adt/dbsize.c index 7def7392b9..3319e9761e 100644 --- a/src/backend/utils/adt/dbsize.c +++ b/src/backend/utils/adt/dbsize.c @@ -627,7 +627,7 @@ numeric_shift_right(Numeric n, unsigned count) Datum divisor_numeric; Datum result; - divisor_numeric = NumericGetDatum(int64_to_numeric(1 << count)); + divisor_numeric = NumericGetDatum(int64_to_numeric(((int64) 1) << count)); result = DirectFunctionCall2(numeric_div_trunc, d, divisor_numeric); return DatumGetNumeric(result); }
^ permalink raw reply [nested|flat] 2+ messages in thread


end of thread, other threads:[~2020-09-15 00:35 UTC | newest]

Thread overview: 2+ messages (download: mbox mbox.gz follow: Atom feed)
-- links below jump to the message on this page --
2020-09-09 18:41 pgsql: Expose internal function for converting int64 to numeric Peter Eisentraut <peter@eisentraut.org>
2020-09-15 00:35 ` David Rowley <dgrowleyml@gmail.com>

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