From: Alexander Korotkov <a.korotkov@postgrespro.ru>
To: Tom Lane <tgl@sss.pgh.pa.us>
Cc: Teodor Sigaev <teodor@sigaev.ru>
Cc: pgsql-committers <pgsql-committers@postgresql.org>
Subject: Re: pgsql: Fix behavior of ~> (cube, int) operator
Date: Tue, 10 Apr 2018 14:33:51 +0300
Message-ID: <CAPpHfdvTakCmjcbAcsaSB0XZ=WCLHRTmA+F2N3P12OCOWZfjBQ@mail.gmail.com> (raw)
In-Reply-To: <10131.1516566042@sss.pgh.pa.us>
References: <E1eZbEj-0000Zi-Hl@gemulon.postgresql.org>
<10131.1516566042@sss.pgh.pa.us>
On Sun, Jan 21, 2018 at 11:20 PM, Tom Lane <tgl@sss.pgh.pa.us> wrote:
> Teodor Sigaev <teodor@sigaev.ru> writes:
> > Fix behavior of ~> (cube, int) operator
>
> This patch has caused Coverity to complain, correctly AFAICS, about
> dead code in cube_coord_llur in the back branches:
>
> 1628 /* Inverse value if needed */
> 1629 if (inverse)
> >>> CID 1463943: Control flow issues (DEADCODE)
> >>> Execution cannot reach this statement: "result = -result;".
> 1630 result = -result;
> 1631
> 1632 PG_RETURN_FLOAT8(result);
>
> Seems to be due to sloppy division of changes between f50c80dbb (which
> was not back-patched) and 563a053bd. Please fix.
>
Thank you for catching this. You diagnosis is right.
I propose to commit the attached patch to 10 and 9.6.
------
Alexander Korotkov
Postgres Professional: http://www.postgrespro.com
The Russian Postgres Company
Attachments:cube_backpatch_fix.patch (application/octet-stream, 858B) download
commit be49af2216a127a82089366fdb5b335fb2f4e0c2
Author: Alexander Korotkov <a.korotkov@postgrespro.ru>
Date: Tue Apr 10 14:27:55 2018 +0300
Remove wrongly backpatched piece of code in cube.c
Due to sloppy division of changes between f50c80dbb (which was not
back-patched) and 563a053bd, this piece of code was wrongly backpatched to
REL_10_STABLE and REL9_6_STABLE. This code never causes real error because
its condition is never satisfied, but it's a dead code, which needs to be
removed.
diff --git a/contrib/cube/cube.c b/contrib/cube/cube.cindex e695a5e16c..b72053a1d5 100644--- a/contrib/cube/cube.c+++ b/contrib/cube/cube.c@@ -1592,11 +1592,6 @@ cube_coord_llur(PG_FUNCTION_ARGS)
*/
result = 0.0;
}
-- /* Inverse value if needed */- if (inverse)- result = -result;-
PG_RETURN_FLOAT8(result);
}
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 from your mail client; the link fills in
the headers below: reply via email
Some clients, webmail especially, drop In-Reply-To and References from
a link, and the reply then starts a new thread: use the mbox below.
To: pgsql-committers@postgresql.org
Cc: a.korotkov@postgrespro.ru, tgl@sss.pgh.pa.us, teodor@sigaev.ru
Subject: Re: pgsql: Fix behavior of ~> (cube, int) operator
In-Reply-To: <CAPpHfdvTakCmjcbAcsaSB0XZ=WCLHRTmA+F2N3P12OCOWZfjBQ@mail.gmail.com>
References: <E1eZbEj-0000Zi-Hl@gemulon.postgresql.org> <10131.1516566042@sss.pgh.pa.us> <CAPpHfdvTakCmjcbAcsaSB0XZ=WCLHRTmA+F2N3P12OCOWZfjBQ@mail.gmail.com>
* 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