From: bgrundmann@janestreet.com
To: pgsql-bugs@postgresql.org
Subject: BUG #14111: After minor upgrade (9.2.6 -> 9.2.16): ERROR: failed to build any 2-way joins
Date: Mon, 25 Apr 2016 12:03:28 +0000
Message-ID: <20160425120328.2710.24609@wrigleys.postgresql.org> (raw)
List-Unsubscribe: <mailto:majordomo@postgresql.org?body=unsub%20pgsql-bugs>
The following bug has been logged on the website:
Bug reference: 14111
Logged by: Benedikt Grundmann
Email address: bgrundmann@janestreet.com
PostgreSQL version: 9.2.16
Operating system: Linux
Description:
From all I know so far we have a query that used to work last week and after
upgrading from 9.2.6 to 9.2.16 this weekend, we get
ERROR: failed to build any 2-way joins
when trying to plan the same query (that is either run the query or even
just explain it). The query is this:
explain
SELECT
COALESCE(x11.x13, x10.x13) AS x13,
SUM(ABS(COALESCE(x11.x14,0) - COALESCE(x10.x14,0))) AS x15,
SUM(COALESCE(x11.x14,0) - COALESCE(x10.x14,0)) AS x16,
SUM(ABS((COALESCE(x11.x14,0) - COALESCE(x10.x14,0)) * COALESCE(x2.x17,0)))
AS x18,
SUM((COALESCE(x11.x14,0) - COALESCE(x10.x14,0)) * COALESCE(x2.x17,0)) AS
x25,
COALESCE(SUM(ABS((COALESCE(x11.x14,0) - COALESCE(x10.x14,0)) *
COALESCE(x2.x17,0)))/(x4.x12 * x5.divisor),0)
AS gross_pct,
COALESCE(SUM((COALESCE(x11.x14,0) - COALESCE(x10.x14,0)) *
COALESCE(x2.x17,0))/(x4.x12 * x5.divisor),0) AS net_pct
FROM (
SELECT x3.x22, x3.x13, x3.x23, x3.x14 FROM x3 WHERE x3.x22 = '4/25/2016'
) x11 FULL JOIN (
SELECT x3.x22, x3.x13, x3.x23, x3.x14 FROM x3 WHERE x3.x22 = '4/22/2016'
) x10 ON x11.x13 = x10.x13 AND x11.x23 = x10.x23
LEFT JOIN x2 ON x2.x22 = (( SELECT x20('4/25/2016', (-1)) AS x20)) AND
x2.x24 = COALESCE(x11.x23,x10.x23)
LEFT JOIN x4 ON ('4/25/2016' = x4.x22 AND COALESCE(x11.x13,x10.x13) =
x4.x13)
LEFT JOIN x5 ON ('4/25/2016' = x5.x22 AND COALESCE(x11.x13,x10.x13) =
x5.x13)
WHERE (COALESCE(x11.x14, 0) - COALESCE(x10.x14, 0)) <> 0
GROUP BY COALESCE(x11.x13, x10.x13), (x4.x12 * x5.divisor)
ORDER BY COALESCE(SUM(ABS((COALESCE(x11.x14,0) - COALESCE(x10.x14,0)) *
COALESCE(x2.x17,0)))/(x4.x12 * x5.divisor),0)
DESC;
--
Sent via pgsql-bugs mailing list (pgsql-bugs@postgresql.org)
To make changes to your subscription:
http://www.postgresql.org/mailpref/pgsql-bugs
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-bugs@postgresql.org
Cc: bgrundmann@janestreet.com
Subject: Re: BUG #14111: After minor upgrade (9.2.6 -> 9.2.16): ERROR: failed to build any 2-way joins
In-Reply-To: <20160425120328.2710.24609@wrigleys.postgresql.org>
References: <20160425120328.2710.24609@wrigleys.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