Received: from malur.postgresql.org ([217.196.149.56]) by arkaria.postgresql.org with esmtp (Exim 4.84_2) (envelope-from ) id 1ee52s-0001SE-39 for pgsql-bugs@arkaria.postgresql.org; Tue, 23 Jan 2018 20:19:50 +0000 Received: from localhost ([127.0.0.1] helo=malur.postgresql.org) by malur.postgresql.org with esmtp (Exim 4.84_2) (envelope-from ) id 1ee52q-0004Uq-Fx for pgsql-bugs@arkaria.postgresql.org; Tue, 23 Jan 2018 20:19:48 +0000 Received: from makus.postgresql.org ([2001:4800:1501:1::229]) by malur.postgresql.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_CBC_SHA384:256) (Exim 4.84_2) (envelope-from ) id 1ee52q-0004Ug-6x for pgsql-bugs@lists.postgresql.org; Tue, 23 Jan 2018 20:19:48 +0000 Received: from sss.pgh.pa.us ([66.207.139.130]) by makus.postgresql.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_CBC_SHA384:256) (Exim 4.89) (envelope-from ) id 1ee52j-0005uA-Dq for pgsql-bugs@postgresql.org; Tue, 23 Jan 2018 20:19:47 +0000 Received: from sss1.sss.pgh.pa.us (localhost [127.0.0.1]) by sss.pgh.pa.us (8.14.4/8.14.4) with ESMTP id w0NKJb0N026534; Tue, 23 Jan 2018 15:19:37 -0500 From: Tom Lane To: Elvis Pranskevichus cc: pgsql-bugs@postgresql.org Subject: Re: ERROR: could not devise a query plan for the given query (UNIONS and LATERAL) In-reply-to: <5981018.zdth1YWmNy@hammer.magicstack.net> References: <5981018.zdth1YWmNy@hammer.magicstack.net> Comments: In-reply-to Elvis Pranskevichus message dated "Tue, 23 Jan 2018 13:10:59 -0500" MIME-Version: 1.0 Content-Type: text/plain; charset="us-ascii" Content-ID: <26532.1516738777.1@sss.pgh.pa.us> Date: Tue, 23 Jan 2018 15:19:37 -0500 Message-ID: <26533.1516738777@sss.pgh.pa.us> List-Id: List-Help: List-Subscribe: List-Post: List-Owner: List-Archive: Precedence: bulk Elvis Pranskevichus writes: > The following (admittedly bizzare) query causes the error in the subject > on all recent versions of Postgres: Interesting. What this shows is that reparameterize_path has to be able to work on an AppendPath, because if you've got nested appendrels that's the only sort of path there will be for that particular child of the outer appendrel. I'm a little worried about whether this doesn't mean that reparameterize_path needs to be able to work on any kind of path. However, given that it's been there quite some time without previous reports of trouble, jumping to that conclusion may be premature. I'm also wondering where reparameterize_path_by_child came from and why it's so enormously more ambitious than reparameterize_path in terms of its path-type coverage. regards, tom lane