From: Elvis Pranskevichus <elprans@gmail.com>
To: pgsql-bugs@postgresql.org
Subject: ERROR: could not devise a query plan for the given query (UNIONS and LATERAL)
Date: Tue, 23 Jan 2018 13:10:59 -0500
Message-ID: <5981018.zdth1YWmNy@hammer.magicstack.net> (raw)
Hi,
The following (admittedly bizzare) query causes the error in the subject
on all recent versions of Postgres:
SELECT
"q2"."v"
FROM
LATERAL
(SELECT
"q11"."v"
FROM
(
(SELECT 2::bigint AS "v") UNION ALL
(SELECT 3::bigint AS "v")
) AS "q11"
) AS "q1"
CROSS JOIN LATERAL
(
(SELECT
"q3"."v"
FROM
(
(SELECT 4::bigint AS "v") UNION ALL
(SELECT 5::bigint AS "v")
) AS "q3"
)
UNION ALL
(SELECT "q1"."v")
) AS "q2"
ORDER BY
"q2"."v";
Interestingly, removing UNION from either "q3" or "q11", as well as
removing the ::bigint casts makes it work.
Elvis
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-bugs@postgresql.org
Cc: elprans@gmail.com
Subject: Re: ERROR: could not devise a query plan for the given query (UNIONS and LATERAL)
In-Reply-To: <5981018.zdth1YWmNy@hammer.magicstack.net>
* 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