BUG #14111: After minor upgrade (9.2.6 -> 9.2.16): ERROR: failed to build any 2-way joins - Mailing list pgsql-bugs

From bgrundmann@janestreet.com
Subject BUG #14111: After minor upgrade (9.2.6 -> 9.2.16): ERROR: failed to build any 2-way joins
Date
Msg-id 20160425120328.2710.24609@wrigleys.postgresql.org
Whole thread Raw
Responses Re: BUG #14111: After minor upgrade (9.2.6 -> 9.2.16): ERROR: failed to build any 2-way joins
List pgsql-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;

pgsql-bugs by date:

Previous
From: Michael Paquier
Date:
Subject: Re: BUG #14109: pg_rewind fails to update target control file in one scenario
Next
From: John Lumby
Date:
Subject: Re: BUG #14109: pg_rewind fails to update target control file in one scenario