pg.ddx.io pgsql-hackers@postgresql.org mailing list archive
help / color / mirror / Atom feed From: Tom Lane <tgl@sss.pgh.pa.us>
To: Dean Rasheed <dean.a.rasheed@gmail.com>
Cc: Yugo NAGATA <nagata@sraoss.co.jp>
Cc: PostgreSQL Hackers <pgsql-hackers@lists.postgresql.org>
Cc: Dave Page <dpage@pgadmin.org>
Subject: Re: Numeric x^y for negative x
Date: Fri, 06 Aug 2021 12:15:18 -0400
Message-ID: <2492411.1628266518@sss.pgh.pa.us> (raw )
In-Reply-To: <CAEZATCXZvcsuD3Nrm3F33YYavvKzMwRnjNw=3Of=Ra95oR6a4Q@mail.gmail.com >
References: <CAEZATCW6Dvq7+3wN3tt5jLj-FyOcUgT5xNoOqce5=6Su0bCR0w@mail.gmail.com >
<CAEZATCUoVETahg892Qu3umjXX-V8J-F2xqQqunxckd5Se8KLyg@mail.gmail.com >
<CAEZATCWAiXp7ocU3AMV6Pyvgv3O8x4-UBY+d=w+pziXXegdyOA@mail.gmail.com >
<20210720181509.51a037ed0a8cb0f6d3ffda3a@sraoss.co.jp >
<CAEZATCXGk5QQPRNjeXrd7EAkzhwwjgjLhEOp=zZwktX=zYradQ@mail.gmail.com >
<20210722141136.573c11dfc06f4dd46b661bca@sraoss.co.jp >
<CAEZATCW+yCy_11f56oDUecQzSrdO18gwPmOVwgbw6L0_HYJJeg@mail.gmail.com >
<CAEZATCUWUV_BP41Ob7QY12oF+qDxjTWfDpkdkcOOuojrDvOLxw@mail.gmail.com >
<2394813.1628179479@sss.pgh.pa.us >
<CAEZATCX-giGez-yYFUbBAkKhUOOG+rAQuTbnXkemJma8gouWSQ@mail.gmail.com >
<2449471.1628218684@sss.pgh.pa.us >
<CAEZATCXZvcsuD3Nrm3F33YYavvKzMwRnjNw=3Of=Ra95oR6a4Q@mail.gmail.com >
Dean Rasheed <dean.a.rasheed@gmail.com> writes:
> So the "test for overflow by reverse-conversion" obviously isn't
> working as intended, and it's going through power_var_int() when it
> shouldn't. I don't think there's anything wrong with that code, so I
> think this is a compiler bug.
Yeah, looks like one.
> I guess the best thing to do is just test the value against
> PG_INT32_MIN/MAX, which is what int84() does. There are 2 other places
> in numeric.c that use similar code to check for int16/32 overflow, so
> it's possible that they're broken in the same way on that platform,
> but they aren't covered by the regression tests, so it's also possible
> that they're OK. Anyway, something like the attached seems likely to
> be safer.
Looks plausible by eyeball (I've not tested).
regards, tom lane
view thread (27+ messages) latest in thread
Message-ID: <2492411.1628266518@sss.pgh.pa.us>
Permalink: ../2492411.1628266518@sss.pgh.pa.us/
Also on: postgresql.org/message-id/2492411.1628266518@sss.pgh.pa.us
copy link · copy postgr.es
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-hackers@postgresql.org
Cc: tgl@sss.pgh.pa.us, dean.a.rasheed@gmail.com, nagata@sraoss.co.jp, pgsql-hackers@lists.postgresql.org, dpage@pgadmin.org
Subject: Re: Numeric x^y for negative x
In-Reply-To: <2492411.1628266518@sss.pgh.pa.us>
* 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